Repository navigation
[xpu][test] Enable int8 mixed-precision training tests (test/prototype/test_quantized_training.py) and register scaled_int8_mm for XPU - #4630
Open
karol-brejna-i wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4630
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
karol-brejna-i
marked this pull request as ready for review
August 3, 2026 11:52
karol-brejna-i
requested review from
andrewor14,
jerryzh168 and
vkuzo
as code owners
August 3, 2026 11:52
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
3 times, most recently
from
August 5, 2026 05:38
8392a9d to
f9ab78c
Compare
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
from
August 20, 2026 15:21
f9ab78c to
262b974
Compare
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
from
September 8, 2026 16:02
262b974 to
6981b61
Compare
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
2 times, most recently
from
September 9, 2026 17:43
6387405 to
44a5886
Compare
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
from
September 10, 2026 10:32
44a5886 to
3a5664e
Compare
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
from
September 14, 2026 15:51
3a5664e to
dec22c0
Compare
Replace the CPU/CUDA-only _DEVICES list so the supported int8 weight-only tests also run on XPU and other available accelerators.
Switch the import to the surrounding parenthesized multiline style.
Register the backend-neutral Triton implementation for XPU, then run the int8 mixed-precision and BitNet tests on the current accelerator.
Replace the torchao helper with torch.accelerator.current_accelerator() and remove the now-unused import.
karol-brejna-i
force-pushed
the
dev/kbrejna/xpu/scaled-int8-mm-xpu
branch
from
September 24, 2026 15:31
dec22c0 to
07980dd
Compare
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
The PR consists of two parts.
1. Make
test_int8_mixed_precision_trainingandtest_bitnet_training(intest/prototype/test_quantized_training.py) accelerator-generic:@pytest.mark.skipif(not torch.cuda.is_available(), ...)→@pytest.mark.skipif(not torch.accelerator.is_available(), reason="GPU not available")device = "cuda"→device = get_current_accelerator_device()The tests use
scaled_int8_mm, which need to be properly registered for XPU.2. Register the existing Triton kernel under the XPU dispatch key in
torchao/prototype/quantized_training/int8_mm.py:Why
Both callers select the Triton path on any backend whenever
torch.utils._triton.has_triton()is true — which includes XPU, because the CI image installs
pytorch-triton-xpu:So on XPU the op is called but has no XPU dispatch key — it raises
NotImplementedErrorinstead of falling back to
torch._int_mm.Neither part is independently valid (kernel registration and UT enablement), hence one PR:
torch.ops.torchao.scaled_int8_mmand errors out, turning a silent skip into a red XPU failure.Validation
Environment: Intel XPU node, Python 3.12,
torch 2.14.0.dev20260729+xpu,pytorch-triton-xpupresent, single card viaZE_AFFINITY_MASK=0.Quick smoke test
Before (main):
After (PR branch):
Full test —
pytest -rs test/prototype/test_quantized_training.py16 test IDs move
SKIPPED→PASSED: the full parametrization oftest_int8_mixed_precision_training(compile× 4Int8MixedPrecisionTrainingConfigs ×module_swap), including thecompile=Truehalf, i.e. inductor-xpu. No test moves in the other direction.CPU-only collection check
CPU-only collection is unaffected — checked explicitly:
CUDA_VISIBLE_DEVICES="" ZE_AFFINITY_MASK=99 pytest -q --collect-only test/prototype/test_quantized_training.pyCollection succeeds with the same test count as
main. No regressions.Notes
test_bitnet_trainingkeeps@pytest.mark.skip("Flaky on CI")— this PR only removes the CUDA gate; it stays skipped on all platforms.CUDAregistration is untouched.Will rebase once [xpu][test] Use device-agnostic device list in test_quantized_training #4628 lands.