-
Notifications
You must be signed in to change notification settings - Fork 38
GFX1250 changes with updated AITER #732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
99d2207
5cced7a
d668d29
88b9669
4f651ad
1e97485
12ad9e7
9048129
fe1cf36
5b657ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| +7 −6 | ck_build_interceptor.py | |
| +98 −23 | ck_jit_build.py | |
| +100 −0 | codegen_jit_hints_22ee91463.patch |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,21 +58,18 @@ if(USE_ROCM) | |
| test_dequantize_nvfp4.cu | ||
| test_cublaslt_gemm.cu | ||
| test_ck_grouped_gemm.cu | ||
| test_ck_grouped_mxfp8.cu | ||
| test_cast_mxfp4_transpose.cu | ||
| test_multi_quantize_mxfp8.cu) | ||
|
|
||
| list(FIND CMAKE_HIP_ARCHITECTURES "gfx1250" _gfx1250_idx) | ||
| if(NOT _gfx1250_idx EQUAL -1) | ||
| list(APPEND test_cuda_sources test_ck_grouped_mxfp8.cu) | ||
| target_include_directories(test_operator BEFORE PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/composable_kernel/include) | ||
| endif() | ||
|
|
||
| TE_GetHipifiedSources("${test_cuda_sources}" ${CMAKE_CURRENT_SOURCE_DIR} test_hip_sources) | ||
| TE_AddHipifyDeps("${test_cuda_sources}" ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| message("${message_line}") | ||
| message(STATUS "test_operator hipified sources: ${test_hip_sources}") | ||
| set_target_properties(test_operator PROPERTIES SOURCES "${test_hip_sources}") | ||
| target_include_directories(test_operator BEFORE PRIVATE | ||
|
Comment on lines
68
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This include directory was previously added only when gfx1250 was in
|
||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/composable_kernel/include) | ||
|
|
||
| endif() | ||
|
|
||
| # Find required packages | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -515,6 +515,47 @@ std::pair<double, double> getTestTolerances(const DType type, bool use_fp8, bool | |||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| void checkMxFP8Support(const TestParams& params, const cudaDeviceProp& prop, bool &use_mxfp8, bool &use_hipkittens_mxfp8) { | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Consequence: on a device where MXFP8 isn't supported (e.g. gfx942 running Suggested fix: have the helper report rather than skip, and skip at the call site, e.g. return a if (auto reason = checkMxFP8Support(params, prop, use_mxfp8, use_hipkittens_mxfp8)) {
GTEST_SKIP() << *reason;
} |
||||||||||
| use_mxfp8 = (params.scaling_mode == NVTEScalingMode::NVTE_MXFP8_1D_SCALING); | ||||||||||
| if (!use_mxfp8) { | ||||||||||
| use_hipkittens_mxfp8 = false; | ||||||||||
| return; | ||||||||||
| } | ||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
| if (!(prop.major == 9 && prop.minor >= 5) && !(prop.major >= 12)) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires gfx950 or newer"; | ||||||||||
| } | ||||||||||
| #endif | ||||||||||
| if (params.m % 16 || params.n % 16) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires M & N to be multiples of 16"; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
| const size_t required_k_multiple = (prop.major == 12 && prop.minor == 5) ? 32 : 128; | ||||||||||
| #else | ||||||||||
| const size_t required_k_multiple = 128; | ||||||||||
| #endif | ||||||||||
| if (params.k % required_k_multiple) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires K to be a multiple of " << required_k_multiple; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| use_hipkittens_mxfp8 = !params.force_hipblaslt; | ||||||||||
| if (!use_hipkittens_mxfp8) { | ||||||||||
| return; | ||||||||||
| } | ||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
| if (!(prop.major == 9 && (prop.minor == 4 || prop.minor == 5))) { | ||||||||||
| GTEST_SKIP() << "HipKittens requires gfx942 or gfx950"; | ||||||||||
| } | ||||||||||
| if (params.m % 256 || params.n % 256 || params.k < 256) { | ||||||||||
| GTEST_SKIP() << "HipKittens requires M and N 256-aligned, K >= 256"; | ||||||||||
| } | ||||||||||
| #else | ||||||||||
| GTEST_SKIP() << "HipKittens requires ROCm"; | ||||||||||
| #endif | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| template <typename A_Type, typename B_Type, typename Bias_Type, typename Gelu_Type, typename D_Type> | ||||||||||
| void performTest(const TestParams& params) { | ||||||||||
| DType atype = TypeInfo<A_Type>::dtype; | ||||||||||
|
|
@@ -524,30 +565,19 @@ void performTest(const TestParams& params) { | |||||||||
| DType dtype = TypeInfo<D_Type>::dtype; | ||||||||||
|
|
||||||||||
| const bool has_fp8 = isFp8Type(atype) || isFp8Type(btype); | ||||||||||
| const bool use_mxfp8 = params.scaling_mode == NVTEScalingMode::NVTE_MXFP8_1D_SCALING; | ||||||||||
| const bool use_hipkittens_mxfp8 = use_mxfp8 && !params.force_hipblaslt; | ||||||||||
|
|
||||||||||
| cudaDeviceProp prop; | ||||||||||
| (void)cudaGetDeviceProperties(&prop, 0); | ||||||||||
|
|
||||||||||
| bool use_mxfp8 = false; | ||||||||||
| bool use_hipkittens_mxfp8 = false; | ||||||||||
| checkMxFP8Support(params, prop, use_mxfp8, use_hipkittens_mxfp8); | ||||||||||
|
|
||||||||||
| if (use_mxfp8) | ||||||||||
| { | ||||||||||
| if (!has_fp8) { | ||||||||||
| GTEST_SKIP() << "MXFP8 scaling mode requires Float8 types"; | ||||||||||
| } | ||||||||||
| if (params.m % 16 || params.n % 16) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires M & N to be multiples of 16"; | ||||||||||
| } | ||||||||||
| size_t required_k_multiple = 128; | ||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
| required_k_multiple = (prop.major == 12 && prop.minor == 5) ? 32 : 128; | ||||||||||
| #endif | ||||||||||
| if (params.k % required_k_multiple) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires K to be a multiple of " << required_k_multiple; | ||||||||||
| } | ||||||||||
| if (use_hipkittens_mxfp8 && (params.m % 256 || params.n % 256 || params.k < 256)) { | ||||||||||
| GTEST_SKIP() << "HipKittens requires M and N 256-aligned, K >= 256"; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
|
|
@@ -580,10 +610,6 @@ void performTest(const TestParams& params) { | |||||||||
| if (!fp8_supported) { | ||||||||||
| GTEST_SKIP() << "FP8 is not supported in current config"; | ||||||||||
| } | ||||||||||
| const bool mxfp8_supported = (prop.major == 9 && prop.minor >= 5) || prop.major >= 12; | ||||||||||
| if (use_mxfp8 && !mxfp8_supported) { | ||||||||||
| GTEST_SKIP() << "MXFP8 is not supported in current config"; | ||||||||||
| } | ||||||||||
| if (!use_hipkittens_mxfp8 && params.use_bias) { | ||||||||||
| GTEST_SKIP() << "MXFP8 GEMM with bias is not supported by hipBLASLt"; | ||||||||||
| } | ||||||||||
|
|
@@ -759,28 +785,11 @@ void performDqTest(const TestParams ¶ms) { | |||||||||
| cudaDeviceProp prop; | ||||||||||
| (void)cudaGetDeviceProperties(&prop, 0); | ||||||||||
|
|
||||||||||
| if (params.m % 16 || params.n % 16) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires M & N to be multiples of 16"; | ||||||||||
| } | ||||||||||
| size_t required_k_multiple = 128; | ||||||||||
| #ifdef __HIP_PLATFORM_AMD__ | ||||||||||
| required_k_multiple = (prop.major == 12 && prop.minor == 5) ? 32 : 128; | ||||||||||
| #endif | ||||||||||
| if (params.k % required_k_multiple) { | ||||||||||
| GTEST_SKIP() << "MXFP8 requires K to be a multiple of " << required_k_multiple; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| bool mxfp8_supported = (prop.major == 9 && prop.minor >= 5) || prop.major >= 12; | ||||||||||
| const bool use_hipkittens_mxfp8 = !params.force_hipblaslt; | ||||||||||
| if (!mxfp8_supported) { | ||||||||||
| GTEST_SKIP() << "MXFP8 is not supported in current config"; | ||||||||||
| } | ||||||||||
| bool _unused = false; | ||||||||||
| checkMxFP8Support(params, prop, _unused, _unused); | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Passing the same object for two independent non-const out-params aliases them. It happens to be harmless today only because Two separate locals would remove the coupling and read better:
Suggested change
|
||||||||||
| if (params.use_bias || params.use_gelu) { | ||||||||||
| GTEST_SKIP() << "DqGEMMTestSuite does not yet have reference for bias/gelu epilogues"; | ||||||||||
| } | ||||||||||
| if (use_hipkittens_mxfp8 && (params.m % 256 || params.n % 256 || params.k % 128 || params.k < 256)) { | ||||||||||
| GTEST_SKIP() << "HipKittens requires M and N 256-aligned, K >= 256"; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // hipBLASLt on gfx950 produces incorrect results for certain MXFP8 | ||||||||||
| // GEMMs with non-TN layouts. | ||||||||||
|
|
@@ -940,7 +949,7 @@ INSTANTIATE_TEST_SUITE_P(OperatorTest, GEMMTestSuite, | |||||||||
| ::testing::Values(false, true), //use_gelu | ||||||||||
| ::testing::ValuesIn(kLayouts), //transa,transb | ||||||||||
| ::testing::Values(false), //use mxfp8 | ||||||||||
| ::testing::Values(false)), //force hipblaslt | ||||||||||
| ::testing::Values(true)), //force hipblaslt | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this flip intentional (same on line 961)? Both suites pass What does change is every test name in |
||||||||||
| GEMMTestName); | ||||||||||
|
|
||||||||||
| INSTANTIATE_TEST_SUITE_P(OperatorTestFP8, FP8GEMMTestSuite, | ||||||||||
|
|
@@ -949,7 +958,7 @@ INSTANTIATE_TEST_SUITE_P(OperatorTestFP8, FP8GEMMTestSuite, | |||||||||
| ::testing::Values(false, true), //use_gelu | ||||||||||
| ::testing::ValuesIn(kLayouts), //transa,transb | ||||||||||
| ::testing::Values(false), //use mxfp8 | ||||||||||
| ::testing::Values(false)), //force hipblaslt | ||||||||||
| ::testing::Values(true)), //force hipblaslt | ||||||||||
| GEMMTestName); | ||||||||||
|
|
||||||||||
| INSTANTIATE_TEST_SUITE_P(OperatorTestMXFP8, FP8GEMMTestSuite, | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition contradicts the comment directly above it.
gpu_arch >= 120also matches gfx1200/gfx1201 (RDNA4), which per the comment do not support NVFP4 — only gfx1250 does. On those parts the example would now claim NVFP4 support and fail at runtime.