[rocm-libraries] ROCm/rocm-libraries#8310 (commit 003bc6b)

[CK Tile] Fix assert usage MX GEMM

## Motivation

See issue https://github.com/ROCm/rocm-libraries/issues/8223

## Technical Details

 - Use `std::runtime_error` in `mx_processing.hpp`
 - Use `static_assert` in `tensor_shuffle_utils.hpp`

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This commit is contained in:
Enrico Degregori
2026-06-12 11:42:38 +00:00
committed by assistant-librarian[bot]
parent d7609923b6
commit e75076c826
2 changed files with 15 additions and 6 deletions

View File

@@ -68,7 +68,11 @@ auto preShuffleScale(ck_tile::HostTensor<dtype>& src, const bool kLast)
HostTensor<dtype> shuffled(HostTensorDescriptor({static_cast<std::size_t>(MNPadded * K)},
{static_cast<std::size_t>(1)}));
assert(K % (KXdlPack * XdlKThread) == 0);
if(K % (KXdlPack * XdlKThread) != 0)
{
throw std::runtime_error("wrong! K must be a multiple of (KXdlPack * XdlKThread)");
}
const index_t K0 = K / KXdlPack / XdlKThread;
for(index_t n = 0; n < MNPadded; ++n)
@@ -120,7 +124,10 @@ auto preShuffleScalePermuteN(const HostTensor<dtype>& src, const bool kLast)
HostTensor<dtype> shuffled(HostTensorDescriptor({static_cast<std::size_t>(MNPadded * K)},
{static_cast<std::size_t>(1)}));
assert(K % (KXdlPack * XdlKThread) == 0);
if(K % (KXdlPack * XdlKThread) != 0)
{
throw std::runtime_error("wrong! K must be a multiple of (KXdlPack * XdlKThread)");
}
const index_t K0 = K / KXdlPack / XdlKThread;
for(index_t n = 0; n < MNPadded; ++n)

View File

@@ -164,9 +164,10 @@ auto shuffle_b_permuteN(const ck_tile::HostTensor<T>& t,
number<BlockedXDLNPerWarp>)
{
assert(t.get_lengths().size() == 2);
int n_ = t.get_lengths()[1];
int k_ = t.get_lengths()[0];
int NRepeat = gemmConfig.N_Tile / gemmConfig.N_Warp_Tile / gemmConfig.N_Warp;
int n_ = t.get_lengths()[1];
int k_ = t.get_lengths()[0];
constexpr ck_tile::index_t NRepeat =
GemmConfig::N_Tile / GemmConfig::N_Warp_Tile / GemmConfig::N_Warp;
if(ck_tile::is_gfx12_supported())
{
constexpr int divisor = 2;
@@ -185,7 +186,8 @@ auto shuffle_b_permuteN(const ck_tile::HostTensor<T>& t,
}
else
{
assert(NRepeat % BlockedXDLNPerWarp == 0);
static_assert(NRepeat % BlockedXDLNPerWarp == 0,
"wrong! NRepeat must be a multiple of BlockedXDLNPerWarp");
constexpr int KLane = ck_tile::get_warp_size() / GemmConfig::N_Warp_Tile;
constexpr int ItemsPerAccess =
std::min(detail::b_contiguous_items_per_access<GemmConfig, T>::value,