* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#ifndef CATLASS_GEMV_COORD_HPP
#define CATLASS_GEMV_COORD_HPP
#include "catlass/coord.hpp"
namespace Catlass {
template <
uint32_t M_ = 1,
uint32_t N_ = 1>
struct GemvShape {
static constexpr uint32_t M = M_;
static constexpr uint32_t N = N_;
static constexpr int64_t MN = M * N;
static constexpr int64_t COUNT = MN;
CATLASS_HOST_DEVICE
static Coord<2> ToCoord()
{
return MakeCoord(M, N);
}
};
struct GemvCoord : public Coord<2, uint32_t> {
using Index = uint32_t;
using Base = Coord<2, Index>;
static constexpr int M_INDEX = 0;
static constexpr int N_INDEX = 1;
CATLASS_HOST_DEVICE
GemvCoord()
{}
CATLASS_HOST_DEVICE
GemvCoord(Coord<2, Index> const& coord) : Base(coord)
{}
CATLASS_HOST_DEVICE
GemvCoord(Index m, Index n) : Base(MakeCoord(m, n))
{}
CATLASS_HOST_DEVICE
Index const& m() const
{
return this->At(M_INDEX);
}
CATLASS_HOST_DEVICE
Index& m()
{
return this->At(M_INDEX);
}
CATLASS_HOST_DEVICE
Index const& n() const
{
return this->At(N_INDEX);
}
CATLASS_HOST_DEVICE
Index& n()
{
return this->At(N_INDEX);
}
CATLASS_HOST_DEVICE
auto GetCoordMN() const
{
return this->GetCoordByAxis<M_INDEX, N_INDEX>();
}
};
}
#endif