-
Notifications
You must be signed in to change notification settings - Fork 35
Experimental Triton GEMM backend for TE PyTorch (BF16/FP16/FP32/FP8/MXFP8) #667
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
Open
wenchenvincent
wants to merge
37
commits into
dev
Choose a base branch
from
triton_gemm_mxfp8_rebase_2.15
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ddb0d8e
[AMD] Experimental GEMM implementation with Triton
wenchenvincent 8486379
Very rudimentary enablement of bf16. No epilogues.
wenchenvincent f319f79
Add FP8 support to te_generic_gemm_triton() wrapper
wenchenvincent 760bd42
Add MXFP8 support for Triton GEMM backend
wenchenvincent 9b5f353
Add MXFP8 GEMM test suite
wenchenvincent 0297a51
Fix the fp8 data type for gfx950.
wenchenvincent 26f38b0
Fix MXFP8 Triton implementation to match BLAS behavior
wenchenvincent 281c511
Fix MXFP8 dimension handling in kernel call
wenchenvincent 47b0c59
Fix MXFP8TensorWrapper size determination for columnwise-only tensors
wenchenvincent 0bac3ef
Adopted API change in v2.10.
wenchenvincent dfdd863
Restructured tests and disabled Triton GEMM for fp8 hybrid recipe due…
wenchenvincent 56268f4
A mxfp8 Triton bug required pytorch release 2.10
wenchenvincent 7fc4c8e
Remove temporary debug/analysis files accidentally included in 2de8c6d
wenchenvincent 46c657c
Fix Triton GEMM tests after rebase onto dev
wenchenvincent e1fda4d
Fix bias epilogue wiring in te_generic_gemm_triton wrapper
wenchenvincent 2e5ec67
Triton GEMM: α/β accumulate, gfx950 test fixes, mixed-FP8 skip gate, …
wenchenvincent 1d841f7
Triton GEMM: narrow mxfp8/ CI sweep to our tests; drop mxfp8/__init__.py
wenchenvincent b34b086
Triton GEMM: tighten mixed-FP8 skip gate to torch>=(2,14)
wenchenvincent 818c4d7
Triton GEMM CI: split multi-file mxfp8 line into two calls
wenchenvincent 4695d4b
Triton GEMM: promote M/N pointer offsets to int64 to fix >2^31 addres…
wenchenvincent 8d5542f
test_float8_current_scaling_exact: skip HYBRID recipe under Triton GEMM
wenchenvincent f2a19d2
Triton GEMM: refuse unsupported QuantizedTensorStorage; skip gate-hit…
wenchenvincent 6892337
test_numerics: skip grouped-vs-sequential equivalence tests under Triton
wenchenvincent 8b3f7d6
Triton GEMM: apply output quantizer when caller requests FP8 output
wenchenvincent 26b3e37
Triton GEMM: prune redundant skip logic and tighten comments
wenchenvincent e1c5dda
Triton GEMM: move gemm_triton.py into triton_kernels/gemm/ subpackage
wenchenvincent 6177136
Triton GEMM tests: relocate under tests/pytorch/triton_kernels/
wenchenvincent db6c724
tests/pytorch/mxfp8/: drop our old README
wenchenvincent 3b9bb72
Triton GEMM tests: consolidate test_gemm_fp8 into test_gemm; rename
wenchenvincent 8751219
Triton GEMM: address PR review comments (lazy import, style, tests)
wenchenvincent e5099e4
Triton GEMM: address wangye805 PR review batch
wenchenvincent 3077ef6
Triton GEMM tests: drop test_gemm_mxfp8.py, redundant with test_gemm.py
wenchenvincent 7a74c6d
test_numerics: reframe grouped-under-Triton skip as sequential-vs-mul…
wenchenvincent fe5d9d6
Triton GEMM: drop Float8TensorWrapper / MXFP8TensorWrapper, read stor…
wenchenvincent 2379e73
Triton GEMM: post-refactor follow-ups from thorough review
wenchenvincent f209e01
test_gemm_kernel: reuse str_to_torch_dtype from test_common
wenchenvincent 27a2828
Trigger CI rerun after failures were confirmed to be flakes/unrelated
wenchenvincent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved. | ||
| # | ||
| # See LICENSE for license information. | ||
|
|
||
| """Convert Triton GEMM backend refusals (HYBRID, mixed FP8, NVFP4, ...) | ||
| into pytest.skip so the CI sweep under NVTE_USE_GEMM_TRITON=1 does not | ||
| flag intentionally-unsupported combinations as failures. | ||
| The gates raise ValueError from quantization.py and | ||
| triton_kernels/gemm/gemm_wrapper.py; when they are relaxed the marker | ||
| text disappears and this hook stops firing. | ||
| """ | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| # Substrings identifying our Triton GEMM backend refusals. Kept short so | ||
| # they are easy to grep. | ||
| _TRITON_GEMM_GATE_MARKERS = ( | ||
| # Mixed FP8 (e4m3 x e5m2) refused at the low-level matmul entry. | ||
| "Mixed FP8 types", | ||
| # Covers both quantization.py::check_recipe_support (HYBRID) and | ||
| # gemm_wrapper._classify_input's refusal of NVFP4 / other | ||
| # QuantizedTensorStorage subclasses. | ||
| "The Triton GEMM backend (NVTE_USE_GEMM_TRITON=1) does not support", | ||
| ) | ||
|
|
||
|
|
||
| @pytest.hookimpl(hookwrapper=True) | ||
| def pytest_runtest_call(item): | ||
| """Convert known Triton GEMM backend gate errors into skips.""" | ||
| outcome = yield | ||
| if outcome.excinfo is None: | ||
| return | ||
| exc = outcome.excinfo[1] | ||
| if not isinstance(exc, ValueError): | ||
| return | ||
| msg = str(exc) | ||
| if any(marker in msg for marker in _TRITON_GEMM_GATE_MARKERS): | ||
| outcome.force_exception( | ||
| pytest.skip.Exception(f"Triton GEMM backend gate: {msg}") | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.