Relocate get_num_xcd into the dependency-free Triton launcher - #3180
Merged
Conversation
AmesingFlank
force-pushed
the
AmesingFlank/stack/93
branch
from
July 28, 2026 16:02
b9e69d2 to
2d9cafe
Compare
AmesingFlank
force-pushed
the
AmesingFlank/stack/94
branch
from
July 28, 2026 16:02
bf1e00f to
0e5bc41
Compare
This was referenced Jul 28, 2026
AmesingFlank
marked this pull request as ready for review
July 28, 2026 16:29
AmesingFlank
marked this pull request as draft
July 28, 2026 17:38
AmesingFlank
marked this pull request as ready for review
July 28, 2026 17:40
AmesingFlank
marked this pull request as draft
July 28, 2026 20:09
AmesingFlank
force-pushed
the
AmesingFlank/stack/94
branch
from
July 28, 2026 20:09
0e5bc41 to
85d9f2d
Compare
AmesingFlank
marked this pull request as ready for review
July 28, 2026 20:10
AmesingFlank
marked this pull request as draft
July 28, 2026 21:14
AmesingFlank
marked this pull request as ready for review
July 29, 2026 00:04
ethche
approved these changes
Jul 29, 2026
AmesingFlank
marked this pull request as draft
July 29, 2026 05:05
AmesingFlank
marked this pull request as ready for review
July 29, 2026 05:06
AmesingFlank
marked this pull request as draft
July 29, 2026 09:03
AmesingFlank
marked this pull request as ready for review
July 29, 2026 09:04
yushangdi
approved these changes
Jul 29, 2026
AmesingFlank
added a commit
that referenced
this pull request
Jul 29, 2026
`get_num_xcd` (AMD CDNA XCD count for `xcd_remap`) is runtime grid logic that generated code invokes as `helion.runtime.get_num_xcd(...)`, so it belongs with the other dependency-free launch helpers. Move it (and `_CUS_PER_XCD`) from `helion/_compat.py` into `helion/runtime/triton/launcher.py`, making the launcher the complete dependency-free home the precompiler bulk-exports. It is re-exported unchanged from `helion.runtime` (so the generated `helion.runtime.get_num_xcd(...)` still resolves); the two importers move to the new location (`autotuner/config_spec.py`, `_testing.py`). `get_num_xcd` stays torch-only, so no import cycle is introduced -- `config_spec` -> `helion.runtime.triton.launcher` is acyclic because the launcher imports no `helion` module. Verified on H100: `import helion` clean, `get_num_xcd` is identical from all re-export sites, `ruff`/`pyrefly` clean (83 baseline), `test_config_api` / `test_runtime` pass. stack-info: PR: #3180, branch: AmesingFlank/stack/94
AmesingFlank
marked this pull request as draft
July 29, 2026 20:37
AmesingFlank
force-pushed
the
AmesingFlank/stack/94
branch
from
July 29, 2026 20:37
85d9f2d to
475b86a
Compare
AmesingFlank
marked this pull request as ready for review
July 29, 2026 20:38
AmesingFlank
added a commit
that referenced
this pull request
Jul 30, 2026
`get_num_xcd` (AMD CDNA XCD count for `xcd_remap`) is runtime grid logic that generated code invokes as `helion.runtime.get_num_xcd(...)`, so it belongs with the other dependency-free launch helpers. Move it (and `_CUS_PER_XCD`) from `helion/_compat.py` into `helion/runtime/triton/launcher.py`, making the launcher the complete dependency-free home the precompiler bulk-exports. It is re-exported unchanged from `helion.runtime` (so the generated `helion.runtime.get_num_xcd(...)` still resolves); the two importers move to the new location (`autotuner/config_spec.py`, `_testing.py`). `get_num_xcd` stays torch-only, so no import cycle is introduced -- `config_spec` -> `helion.runtime.triton.launcher` is acyclic because the launcher imports no `helion` module. Verified on H100: `import helion` clean, `get_num_xcd` is identical from all re-export sites, `ruff`/`pyrefly` clean (83 baseline), `test_config_api` / `test_runtime` pass. stack-info: PR: #3180, branch: AmesingFlank/stack/94
AmesingFlank
marked this pull request as draft
July 30, 2026 01:55
AmesingFlank
force-pushed
the
AmesingFlank/stack/94
branch
from
July 30, 2026 01:56
475b86a to
0d190b3
Compare
AmesingFlank
marked this pull request as ready for review
July 30, 2026 01:56
`get_num_xcd` (AMD CDNA XCD count for `xcd_remap`) is runtime grid logic that generated code invokes as `helion.runtime.get_num_xcd(...)`, so it belongs with the other dependency-free launch helpers. Move it (and `_CUS_PER_XCD`) from `helion/_compat.py` into `helion/runtime/triton/launcher.py`, making the launcher the complete dependency-free home the precompiler bulk-exports. It is re-exported unchanged from `helion.runtime` (so the generated `helion.runtime.get_num_xcd(...)` still resolves); the two importers move to the new location (`autotuner/config_spec.py`, `_testing.py`). `get_num_xcd` stays torch-only, so no import cycle is introduced -- `config_spec` -> `helion.runtime.triton.launcher` is acyclic because the launcher imports no `helion` module. Verified on H100: `import helion` clean, `get_num_xcd` is identical from all re-export sites, `ruff`/`pyrefly` clean (83 baseline), `test_config_api` / `test_runtime` pass. stack-info: PR: #3180, branch: AmesingFlank/stack/94
AmesingFlank
marked this pull request as draft
July 30, 2026 02:43
AmesingFlank
force-pushed
the
AmesingFlank/stack/94
branch
from
July 30, 2026 02:43
0d190b3 to
63e6d7f
Compare
AmesingFlank
marked this pull request as ready for review
July 30, 2026 02:43
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.
Stacked PRs:
OutputCodeOptions(jax_fn=True)for Pallas (JAX-array entrypoints) #3186OutputCodeOptions(allow_helion_deps=False)for the Pallas backend (TorchTPU) #3184OutputCodeOptions(allow_helion_deps=False)toBoundKernel.to_codefor standalone Triton kernels #3181helion/runtime/pallas/launcher.py#3182get_num_xcdinto the dependency-free Triton launcher #3180Relocate
get_num_xcdinto the dependency-free Triton launcherget_num_xcd(AMD CDNA XCD count forxcd_remap) is runtime grid logic thatgenerated code invokes as
helion.runtime.get_num_xcd(...), so it belongs withthe other dependency-free launch helpers. Move it (and
_CUS_PER_XCD) fromhelion/_compat.pyintohelion/runtime/triton/launcher.py, making the launcherthe complete dependency-free home the precompiler bulk-exports.
It is re-exported unchanged from
helion.runtime(so the generatedhelion.runtime.get_num_xcd(...)still resolves); the two importers move to thenew location (
autotuner/config_spec.py,_testing.py).get_num_xcdstaystorch-only, so no import cycle is introduced --
config_spec->helion.runtime.triton.launcheris acyclic because the launcher imports nohelionmodule.Verified on H100:
import helionclean,get_num_xcdis identical from allre-export sites,
ruff/pyreflyclean (83 baseline),test_config_api/test_runtimepass.