Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ad748da
GEMM reference HIP implementation
matthiasdiener Dec 9, 2025
11e090b
blockwise amax
matthiasdiener Dec 11, 2025
9006224
Merge branch 'dev' into compute-ref-offload
matthiasdiener Dec 18, 2025
3ecea7f
Change to use Tensor arguments, combine mxfp8/non-mxfp8 paths
matthiasdiener Jan 13, 2026
cafee59
Merge remote-tracking branch 'origin/dev' into compute-ref-offload
matthiasdiener Jan 14, 2026
86fbbac
skip on SwizzleScale limitation on gfx950
matthiasdiener Jan 14, 2026
54de3db
Revert "skip on SwizzleScale limitation on gfx950"
matthiasdiener Jan 14, 2026
311ddfe
MXFP8 fix
matthiasdiener Jan 14, 2026
306e432
Merge remote-tracking branch 'origin/dev' into compute-ref-offload
matthiasdiener Jan 15, 2026
445e64f
correct scale_inv packing and exp2(biased−127) conversion
matthiasdiener Jan 15, 2026
462945f
cleanups
matthiasdiener Jan 15, 2026
e32fb3d
Merge branch 'dev' into compute-ref-offload
matthiasdiener Jan 19, 2026
7bf8adb
Merge remote-tracking branch 'origin/dev' into compute-ref-offload
matthiasdiener Jan 22, 2026
e11e400
use Tensor class for more device objects
matthiasdiener Jan 22, 2026
325ece6
Pass D Tensor into run_reference and move RefD allocation into Perfor…
matthiasdiener Jan 23, 2026
fc64b8c
[WIP] proof-of-concept: grouped GEMM with ck_tile
matthiasdiener Jan 26, 2026
134b350
Merge branch 'dev' into ck-grouped-gemm
matthiasdiener Jan 28, 2026
9091e6c
restructure and enable tests
matthiasdiener Jan 29, 2026
7435062
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Jan 29, 2026
a00a1c8
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Jan 30, 2026
4e9ead9
grid improvements
matthiasdiener Jan 30, 2026
259645c
restructure
matthiasdiener Feb 3, 2026
9986bd4
reduce code duplication & simplify
matthiasdiener Feb 4, 2026
355ec2f
make the code more similar to nv, check emopty gelu/bias
matthiasdiener Feb 4, 2026
df5e3ea
Merge branch 'dev' into ck-grouped-gemm
matthiasdiener Feb 4, 2026
a42f7ca
further simplify & make closer to nv
matthiasdiener Feb 4, 2026
fac7c11
add ck_tile reference
matthiasdiener Feb 4, 2026
71b97e0
rename in error messages
matthiasdiener Feb 4, 2026
dd3ed2f
allow flattened higher-D tensors
matthiasdiener Feb 4, 2026
7b0413e
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 5, 2026
ebc005f
relax tolerance on gfx942
matthiasdiener Feb 5, 2026
c0bf502
enable more tests
matthiasdiener Feb 5, 2026
0b16287
return early when num_gemms<=0
matthiasdiener Feb 5, 2026
58b34e7
simplify normalization
matthiasdiener Feb 5, 2026
74f229a
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 10, 2026
e28c801
run hipblaslt for num_gemms==1
matthiasdiener Feb 11, 2026
6151b96
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 12, 2026
5c57d47
disable ck_tile when accumulate=true
matthiasdiener Feb 17, 2026
29d6ab7
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 17, 2026
6e9aae4
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 17, 2026
2e844d9
remove test file
matthiasdiener Feb 17, 2026
4aa8229
Merge branch 'dev' into ck-grouped-gemm
matthiasdiener Feb 23, 2026
f680d6a
fix copyright header
matthiasdiener Feb 23, 2026
6d85088
simplify calls in dispatch_grouped
matthiasdiener Feb 23, 2026
7910038
remove is_mi3*0_class
matthiasdiener Feb 23, 2026
e8ebb0e
disable unused constants
matthiasdiener Feb 23, 2026
deb7474
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 24, 2026
e866bc6
add another fallback
matthiasdiener Feb 24, 2026
ee438fb
implement Primus-Turbo selection logic, persistent descs
matthiasdiener Feb 25, 2026
b65dbfa
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 25, 2026
0cbf1cd
tighten tolerances
matthiasdiener Feb 25, 2026
98e0c66
use namespace, various cleanups
matthiasdiener Feb 25, 2026
36bd68e
avoid creating vector with Tensors
matthiasdiener Feb 26, 2026
070c58d
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 26, 2026
c5d83a4
merge dispatch_grouped into ck_tile_grouped_gemm
matthiasdiener Feb 26, 2026
56afb04
Merge remote-tracking branch 'origin/dev' into ck-grouped-gemm
matthiasdiener Feb 27, 2026
26dfbb6
same tolerances for gfx950
matthiasdiener Feb 27, 2026
7b1dbfa
add to readme
matthiasdiener Feb 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ legacy single-stage atomic kernel by setting:

NVTE_USE_ATOMIC_AMAX=1

Grouped GEMM using CK_Tile
^^^^^^^^^^^^^^^^^^^^^^^^^^

Transformer Engine provides a CK_Tile–based implementation of grouped GEMM
as an alternative to the hipBlasLt-based default grouped GEMM implementation.
This will provide performance improvements in most supported cases.

You can enable the CK_Tile-based backend using the same environment variables as in the
upstream CUTLASS implementation:

NVTE_USE_CUTLASS_GROUPED_GEMM=1 # Enable CK_Tile-based grouped GEMM
NVTE_CUTLASS_GROUPED_GEMM_WARN_FALLBACK=1 # Print a warning if falling back to hipBlasLt backend (e.g., due to an unsupported config)


Transformer Engine
******************
Expand Down
14 changes: 8 additions & 6 deletions tests/pytorch/test_numerics.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def rocm_attn_backend() -> tuple[bool, bool, bool]:

use_cutlass_grouped_gemm = [False]
# Only enable cutlass grouped gemm on Hopper
if torch.cuda.get_device_capability() == (9, 0):
if torch.cuda.get_device_capability() == (9, 0) or IS_HIP_EXTENSION:
use_cutlass_grouped_gemm.append(True)


Expand Down Expand Up @@ -1386,7 +1386,7 @@ def test_linear_accuracy_delay_wgrad_compute(dtype, bs, model, bias, fuse_wgrad_

if IS_HIP_EXTENSION:
if dtype not in (torch.float32,) and fuse_wgrad_accumulation and bias:
pytest.skip(f"Rocm does not support fused wgrad accumulation for {dtype}.")
pytest.skip(f"ROCm does not support fused wgrad accumulation for {dtype}.")

te_linear_ref = Linear(
config.hidden_size,
Expand Down Expand Up @@ -1678,7 +1678,7 @@ def test_layernorm_linear_accuracy_delay_wgrad_compute(
):
if IS_HIP_EXTENSION:
if dtype not in (torch.float32,) and fuse_wgrad_accumulation and bias:
pytest.skip(f"Rocm does not support fused wgrad accumulation for {dtype}.")
pytest.skip(f"ROCm does not support fused wgrad accumulation for {dtype}.")
config = model_configs[model]

ln_linear_ref = LayerNormLinear(
Expand Down Expand Up @@ -1892,7 +1892,7 @@ def test_layernorm_mlp_accuracy_delay_wgrad_compute(

if IS_HIP_EXTENSION:
if dtype not in (torch.float32,) and fuse_wgrad_accumulation and bias:
pytest.skip(f"Rocm does not support fused wgrad accumulation for {dtype}.")
pytest.skip(f"ROCm does not support fused wgrad accumulation for {dtype}.")

ln_mlp = LayerNormMLP(
hidden_size=config.hidden_size,
Expand Down Expand Up @@ -2042,7 +2042,7 @@ def test_grouped_linear_accuracy(

if IS_HIP_EXTENSION:
if dtype not in (torch.float32,) and fuse_wgrad_accumulation and not fp8:
pytest.skip(f"Rocm does not support fused wgrad accumulation for {dtype}.")
pytest.skip(f"ROCm does not support fused wgrad accumulation for {dtype}.")
if fp8 and fp8_model_params and NVTE_TEST_NVINSPECT_ENABLED:
pytest.skip("FP8 parameters are not supported in debug mode.")

Expand Down Expand Up @@ -2121,6 +2121,8 @@ def test_grouped_linear_accuracy(
atol, rtol = 0, 0
if use_cutlass:
atol, rtol = 1e-3, 1e-3
if IS_HIP_EXTENSION:
atol, rtol = 1e-3, 8e-3
if use_triton:
atol, rtol = get_tolerances(dtype)
if dtype == torch.float32:
Expand All @@ -2131,7 +2133,7 @@ def test_grouped_linear_accuracy(


@pytest.mark.skipif(
torch.cuda.get_device_capability() != (9, 0),
torch.cuda.get_device_capability() != (9, 0) and not IS_HIP_EXTENSION,
reason="Only enable CUTLASS grouped gemm on Hopper",
)
@pytest.mark.parametrize("dtype", param_types, ids=str)
Expand Down
6 changes: 5 additions & 1 deletion transformer_engine/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was modified for portability to AMDGPU
# Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2026, Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# See LICENSE for license information.
Expand Down Expand Up @@ -202,6 +202,7 @@ else()
fused_attn_rocm/fused_attn_ck.cpp
fused_attn_rocm/utils.cpp
gemm/rocm_gemm.cu
gemm/ck_grouped_gemm.cpp
amd_detail/system.cpp)

# process source code files
Expand Down Expand Up @@ -250,6 +251,9 @@ if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER 12.0)
else()
message(FATAL_ERROR "cutlass gemm/cutlass_grouped_gemm.cu kernel required sm 90a")
endif()
else()
set(CK_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/aiter/3rdparty/composable_kernel)
target_include_directories(transformer_engine PRIVATE ${CK_ROOT}/include)
endif() #USE_CUDA

# Configure dependencies
Expand Down
Loading