[Pallas] Downgrade compact_worklist grouping gracefully when kernel doesn't match - #3206
Open
norx1991 wants to merge 3 commits into
Open
[Pallas] Downgrade compact_worklist grouping gracefully when kernel doesn't match#3206norx1991 wants to merge 3 commits into
norx1991 wants to merge 3 commits into
Conversation
…oesn't match `pallas_worklist_grouping` became a search-space knob independent of `pallas_loop_type` in #3131. Kernels whose source doesn't match the compact-worklist pattern (e.g. `examples/rms_norm.py::rms_norm_bwd`, which uses a nested `hl.tile` and no `hl.grid`) now hit `detect_compact_worklist_plan`'s `exc.InvalidConfig` raise whenever autotune picks `pallas_worklist_grouping in (1, 2)`, and that raise escapes past autotune's skip path, FAILing the whole sweep step. Catch `InvalidConfig` in `_setup_compact_worklist` and leave `env.compact_worklist_plan = None`. Downstream lowering paths already gate on `plan is not None`, so grouping silently downgrades to a no-op for kernels that can't use it. Regression seen in the 2026-07-28 TPU sweep: `rms_norm-bwd[8192,8192]` FAILed with "compact_worklist could not locate the owner hl.grid loop in source." after #3131 landed. Verified fixed on TPU v7 — both rms_norm-bwd shapes PASS full autotune, [8192,8192] gets a 2.34x speedup vs eager (matching pre-regression 2.62x within noise).
norx1991
force-pushed
the
yifeixu/pallas-worklist-graceful-downgrade
branch
from
July 30, 2026 00:06
b934298 to
f00103d
Compare
norx1991
marked this pull request as ready for review
July 30, 2026 21:03
norx1991
requested review from
AmesingFlank and
ethche
and removed request for
AmesingFlank
July 30, 2026 21:18
The raise this test asserted is exactly the behavior this PR removes: _setup_compact_worklist now catches InvalidConfig and downgrades grouping to a no-op instead of propagating past the autotuner. Convert it to test_unsupported_kernel_downgrades, asserting to_triton_code succeeds and emits no compact-worklist builder.
norx1991
added a commit
that referenced
this pull request
Jul 30, 2026
welford fails accuracy on the tritonbench TPU bridge for every implementation (Helion and torch.compile alike) while passing under run_tpu.py — a torch_tpu harness issue, not the kernel (a direct check produces correct output). Until that is understood, run welford via the run_tpu.py holdout (kernels_tpu) where it measures correctly; the bridge keeps everything else. rms_norm-bwd stays on the bridge: its bridge failures are fixed at the source (the backward harness fed each implementation a different random grad_output on TPU, meta-pytorch/tritonbench#1207; the pallas autotune crash is #3206), so it no longer needs the holdout.
jansel
approved these changes
Jul 31, 2026
…de alias The Pallas backend generates JAX/Pallas code, not Triton. The Triton-flavored method name is a backward-compat alias for to_code (see helion/runtime/kernel.py) that pre-dates multi-backend support; using it in a Pallas test is misleading.
norx1991
force-pushed
the
yifeixu/pallas-worklist-graceful-downgrade
branch
from
July 31, 2026 22:12
7f49323 to
e5e1b11
Compare
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.
Summary
pallas_worklist_groupingbecame an autotune knob independent ofpallas_loop_typein #3131. Its config-space gating (offer whenever the kernel has a nestedhl.tileshape) is looser thandetect_compact_worklist_plan's requirement (must have anhl.gridowner), so autotune can pickpallas_worklist_grouping in (1, 2)for kernels the compact-worklist detector can't handle. In that casedetect_compact_worklist_planraisesexc.InvalidConfig("compact_worklist could not locate the owner hl.grid loop in source.")— and that raise escapes past the autotuner's skip path (it's called via the pre-codegen setup, not via a config-compile-check), FAILing the whole sweep step.This regressed
rms_norm-bwd[8192,8192]in the 07-28 TPU sweep (was 2.62× on 07-07, now FAIL). Reproduces on any kernel with the nestedhl.tile(x, block_size=…)+hl.tile(mb_cta.begin, mb_cta.end)shape but nohl.grid— e.g.examples/rms_norm.py::rms_norm_bwd.Catch
exc.InvalidConfigin_setup_compact_worklistand leaveenv.compact_worklist_plan = None. Downstream lowering paths already gate onplan is not None, so grouping silently downgrades to a no-op for kernels that can't use it. Matches the "autotuner-skippable" semantic the raise's docstring already documented.Verification
test_grouping_downgrades_on_kernel_without_hl_grid): confirmed FAILs onmainwith the exactInvalidConfigmessage from the sweep and PASSes with this fix.test_unsupported_kernel_raises→test_unsupported_kernel_downgrades. It asserted the raise this PR intentionally removes; it now assertsto_triton_codesucceeds and emits no compact-worklist builder.test_invalid_worklist_grouping_raisesstill passes, confirming thetry/exceptdoesn't swallow the separate invalid-value validation. Fulltest_pallas_worklist.py: 86 passed on TPU v7.--subprocess-per-shape):rms_norm-bwd[2048,4096]rms_norm-bwd[8192,8192]