Skip to content

Commit 12f78be

Browse files
Expanded the MmaOpI concept to support an extra int arg to the exec function
Also added a test for this. Signed-off-by: Chris Tsiaousis <chris.tsiaousis@streamhpc.com>
1 parent 9266f57 commit 12f78be

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

projects/composablekernel/include/ck_tile/core/arch/mma/amdgcn_mma.hpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "ck_tile/core/arch/arch.hpp"
77
#include "ck_tile/core/arch/mma/mma_op_family.hpp"
88
#include "ck_tile/core/config.hpp"
9+
#include "ck_tile/core/numeric/half.hpp"
10+
#include "ck_tile/core/numeric/pk_fp4.hpp"
911
#include "ck_tile/core/numeric/vector_type.hpp"
1012
#include "ck_tile/core/utility/ignore.hpp"
1113

@@ -23,6 +25,20 @@ struct Unsupported;
2325
#if CK_TILE_CONCEPTS && CK_TILE_CONCEPTS_HEADER
2426

2527
#include <concepts>
28+
/**
29+
* @concept HasExecSignature
30+
* @brief Helper concept for exec signature check.
31+
*/
32+
template <typename MmaOp, typename... ExecArgs>
33+
concept HasExecSignature = requires {
34+
{
35+
MmaOp::exec(typename MmaOp::AVecType{},
36+
typename MmaOp::BVecType{},
37+
typename MmaOp::CVecType{},
38+
std::declval<ExecArgs>()...)
39+
} -> std::convertible_to<typename MmaOp::CVecType>;
40+
};
41+
2642
/**
2743
* @concept MmaOpI
2844
* @brief Expresses the meta-data interface required for each MmaOp policy.
@@ -48,13 +64,7 @@ concept MmaOpI = requires(MmaOp op) {
4864
{ MmaOp::kCNLane } -> std::convertible_to<unsigned int>;
4965
{ MmaOp::kCM0PerLane } -> std::convertible_to<unsigned int>;
5066
{ MmaOp::kCM1PerLane } -> std::convertible_to<unsigned int>;
51-
52-
// Static exec function
53-
{
54-
MmaOp::exec(
55-
typename MmaOp::AVecType{}, typename MmaOp::BVecType{}, typename MmaOp::CVecType{})
56-
} -> std::convertible_to<typename MmaOp::CVecType>;
57-
};
67+
} && (HasExecSignature<MmaOp> || HasExecSignature<MmaOp, int>);
5868

5969
#endif // CK_TILE_CONCEPTS && CK_TILE_CONCEPTS_HEADER
6070

projects/composablekernel/test/ck_tile/core/arch/mma/test_amdgcn_sparse_mma.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ TEST(SparseMMATrait, MmaOpTraitsIntegration)
7171
std::cout << "MmaOpTraits correctly integrates sparse operations" << std::endl;
7272
}
7373

74+
TEST(SparseMMATrait, TestConceptRequirements)
75+
{
76+
#if CK_TILE_CONCEPTS && CK_TILE_CONCEPTS_HEADER
77+
using TestSparseMmma = amdgcn_mma<fp16_t,
78+
fp16_t,
79+
fp32_t,
80+
16u,
81+
16u,
82+
32u,
83+
DefaultSparseMfmaCtrlFlags,
84+
CompilerTargetGfx950,
85+
MmaOpFamily::SPARSE>;
86+
static_assert(MmaOpI<TestSparseMmma>);
87+
static_assert(MmaOpSparseI<TestSparseMmma>);
88+
#else
89+
GTEST_SKIP() << "Not compiled with concepts. Skipping test.";
90+
#endif // CK_TILE_CONCEPTS && CK_TILE_CONCEPTS_HEADER
91+
}
92+
7493
TEST(SparseMMATrait, DenseVsSparseDistinction)
7594
{
7695
// Dense MFMA from mfma/mfma_gfx9.hpp

0 commit comments

Comments
 (0)