For adding TDM in separate PRs, deleted TDM related code that is inaccurate, incomplete, or incorrect#3377
Open
glen-amd wants to merge 1 commit into
Open
For adding TDM in separate PRs, deleted TDM related code that is inaccurate, incomplete, or incorrect#3377glen-amd wants to merge 1 commit into
glen-amd wants to merge 1 commit into
Conversation
|
Jenkins build for 709d7a87a6a0eeceeccfec75d2d81f14e8b3df09 commit finished as FAILURE |
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.
Remove non-functional gfx1250 TDM (Tensor Data Mover) autotuning path
Summary
Removes the Inductor "TDM" code added in
8f31771df8d ("Temp 2.11 1250 tdm"). That change was built on an incorrect premise and never actually produced TDM instructions; this PR deletes it cleanly along with its now-dead arch helper, and reverts the one pre-existing method it had modified.Background / motivation
The removed code assumed:
This is not how the AMD Triton backend (gfx1250) works. TDM is emitted only from tensor-descriptor ops (
tl.make_tensor_descriptor/ Gluontdm.*), which lower tollvm.amdgcn.tensor.load.to.lds/tensor.store.from.ldsand synchronize vias_wait_tensorcnt. A plaintl.load+num_stages > 1lowers to the generic async-copy-to-LDS path (global_load_async_to_lds_*,s_wait_asynccnt) — a different hardware mechanism with a different counter (asynccntvstensorcnt). It is never TDM.Consequently
use_triton_tdm_template()only selected the stockpersistent_mm_template(raw pointer loads) — the same template the ROCm TMA path already falls back to — and emitted no descriptors and no TDM. The gate also onlylog.debug'd on misaligned/non-unit strides instead of rejecting them. The feature is off by default (TORCHINDUCTOR_ENABLE_TDM_CONFIGS=0) and additionally gated on gfx1250 + Triton ≥ 3.6, so in practice the path was dead. The original commit message ("Temp") reflects its provisional nature.A correct, descriptor-based implementation is being pursued separately; this PR clears the misleading stopgap so it doesn't ship or mislead readers.
Changes
config.py— removeenable_tdm_configsflag andclass tdmconstants.utils.py— removeuse_triton_tdm_template()and theis_gfx1250_arch()helper (introduced solely to support the TDM gate; no remaining callers).template_heuristics/triton.py— remove_is_gfx1250_device(),_filter_tdm_block_k_configs(),tdm_persistent_mm_configs,uses_tdm_configs, thepreprocess_mm_configsoverride, and the gfx1250 branch inPersistentMMTemplateConfigHeuristic.__init__. RevertROCmConfigHeuristic._filter_configsto its pre-TDM body (this method pre-existed and was only modified by the TDM commit).kernel/mm.py— remove the"tdm"dispatch branch in_append_persistent_mm_templateand its import.kernel/flex/common.py— removeapply_tdm_num_stages()and revert theconfigimport.kernel/flex/flex_attention.py,flex_decoding.py— remove the TDM call sites and imports (can_use_tmaretained).test_max_autotune.pyandTestFlexAttentionTDMOptionsintest_flex_attention.py.Scope / what is intentionally kept
The "Temp" commit also bundled non-TDM gfx1250 work that this PR deliberately leaves intact:
_append_persistent_mm_templaterefactor (Blackwell-TMA branch, ROCm TMA→persistent fallback);test_shared_memory_estimation_counts_num_stages_once(exercises the pre-existingget_shared_memory_estimation, not TDM);build.sharch handling.Risk
Low. The removed path was disabled by default and functionally inert. Net
+5 / −454across 9 files. A repo-wide grep confirms no remaining references to any removed symbol;_filter_configsis restored to its original behavior so non-gfx1250 ROCm autotuning is unchanged.Test plan
python -m pytest test/inductor/test_max_autotune.pypython -m pytest test/inductor/test_flex_attention.pypython -c "import torch._inductor.kernel.mm, torch._inductor.template_heuristics.triton")