Skip to content

Relocate get_num_xcd into the dependency-free Triton launcher - #3180

Merged
AmesingFlank merged 1 commit into
mainfrom
AmesingFlank/stack/94
Jul 30, 2026
Merged

Relocate get_num_xcd into the dependency-free Triton launcher#3180
AmesingFlank merged 1 commit into
mainfrom
AmesingFlank/stack/94

Conversation

@AmesingFlank

@AmesingFlank AmesingFlank commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Stacked PRs:


Relocate get_num_xcd into the dependency-free Triton launcher

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.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 28, 2026
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/93 branch from b9e69d2 to 2d9cafe Compare July 28, 2026 16:02
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/94 branch from bf1e00f to 0e5bc41 Compare July 28, 2026 16:02
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 28, 2026 16:29
@AmesingFlank
AmesingFlank marked this pull request as draft July 28, 2026 17:38
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 28, 2026 17:38
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 28, 2026 17:39
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 28, 2026 17:40
@AmesingFlank
AmesingFlank marked this pull request as draft July 28, 2026 20:09
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 28, 2026 20:09
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/94 branch from 0e5bc41 to 85d9f2d Compare July 28, 2026 20:09
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 28, 2026 20:10
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 28, 2026 20:10
@AmesingFlank
AmesingFlank marked this pull request as draft July 28, 2026 21:14
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 28, 2026 21:14
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 29, 2026 00:04
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 29, 2026 00:04
@AmesingFlank
AmesingFlank marked this pull request as draft July 29, 2026 05:05
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 29, 2026 05:05
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 29, 2026 05:05
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 29, 2026 05:06
@AmesingFlank
AmesingFlank marked this pull request as draft July 29, 2026 09:03
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 29, 2026 09:03
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 29, 2026 09:04
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 29, 2026 09:04
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
AmesingFlank marked this pull request as draft July 29, 2026 20:37
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 29, 2026 20:37
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/94 branch from 85d9f2d to 475b86a Compare July 29, 2026 20:37
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 29, 2026 20:38
@AmesingFlank
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
AmesingFlank marked this pull request as draft July 30, 2026 01:55
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 30, 2026 01:55
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/94 branch from 475b86a to 0d190b3 Compare July 30, 2026 01:56
@AmesingFlank
AmesingFlank changed the base branch from main to AmesingFlank/stack/93 July 30, 2026 01:56
@AmesingFlank
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
AmesingFlank marked this pull request as draft July 30, 2026 02:43
@AmesingFlank
AmesingFlank changed the base branch from AmesingFlank/stack/93 to main July 30, 2026 02:43
@AmesingFlank
AmesingFlank force-pushed the AmesingFlank/stack/94 branch from 0d190b3 to 63e6d7f Compare July 30, 2026 02:43
@AmesingFlank
AmesingFlank marked this pull request as ready for review July 30, 2026 02:43
@AmesingFlank
AmesingFlank merged commit 3aacf01 into main Jul 30, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants