Replace tl.make_block_ptr with plain pointer arithmetic for Triton 3.8 - #2003
Open
yuyzhang512 wants to merge 1 commit into
Open
Replace tl.make_block_ptr with plain pointer arithmetic for Triton 3.8#2003yuyzhang512 wants to merge 1 commit into
yuyzhang512 wants to merge 1 commit into
Conversation
Contributor
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
yuyzhang512
force-pushed
the
fix/triton38-drop-make-block-ptr
branch
from
August 24, 2026 06:23
403ffd8 to
a188e33
Compare
Triton 3.8 removed block pointers. `tl.make_block_ptr` still exists as a symbol
but raises at trace time:
NotImplementedError: Block pointers have been removed in favor of the
tensor descriptor API
so every kernel using it fails to compile. This is an API removal, not a GPU
issue - it reproduces on gfx950 and gfx942 alike.
Convert all 181 block accesses to plain pointer arithmetic with explicit bounds
masks:
fla_ops/fused_merge_recompute.py 34 fla_ops/wy_fast.py 7
fla_ops/solve_tril.py 28 fla_ops/chunk_o.py 6
fla_ops/chunk_fused.py 24 fla_ops/chunk_o_vk.py 6
fla_ops/chunk_delta_h.py 23 fla_ops/minimax_m3/sparse_attn.py 6
fla_ops/chunk_delta_h_vk.py 23 fla_ops/fused_cumsum_kkt.py 5
fla_ops/cumsum.py 8 fla_ops/chunk_scaled_dot_kkt.py 4
sglang/minimax_m3_sparse.py 4 fla_ops/l2norm.py 2
minimax_m3/index_topk.py 1
Semantics are preserved exactly:
* masks cover only the dims listed in the original boundary_check; a dim the
author left unchecked was already known in-bounds, and masking it would
change codegen for no reason
* padding_option="zero" and the default both become other=0.0
* <ptr>.dtype.element_ty is retargeted to the base pointer
cumsum.py needed manual conversion: both of its kernels select between two
alternative block pointers in an if/else and then issue a single load, so the
branch-dependent base pointer and stride are hoisted into the branches and the
masked access is shared.
Validated on gfx950 with triton 3.8.0+amd.rocm7.1.0.gitf6a045ff - kernels
compiled and run against torch references:
chunk_local_cumsum_scalar max |err| = 2.4e-06
chunk_local_cumsum_vector max |err| = 0.0
l2norm_fwd max |err| = 3.0e-08
solve_tril max |err| = 5.2e-04 (vs torch.linalg.inv(I + A))
All 14 affected modules import cleanly and the repo is free of make_block_ptr.
yuyzhang512
force-pushed
the
fix/triton38-drop-make-block-ptr
branch
from
August 24, 2026 06:29
a188e33 to
1e74301
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.
Motivation
Triton 3.8 removed block pointers.
tl.make_block_ptrstill exists as a symbol but raises at trace time:so every kernel using it fails to compile. This is an API removal, not a GPU issue — it reproduces identically on gfx950 and gfx942. ATOM currently has 181 such sites across 15 files, all of which break the moment the Triton wheel moves to 3.8.
Technical Details
All 181 block accesses become plain pointer arithmetic with explicit bounds masks:
fla_ops/fused_merge_recompute.pyfla_ops/wy_fast.pyfla_ops/solve_tril.pyfla_ops/chunk_o.pyfla_ops/chunk_fused.pyfla_ops/chunk_o_vk.pyfla_ops/chunk_delta_h.pyminimax_m3/sparse_attn.pyfla_ops/chunk_delta_h_vk.pyfla_ops/fused_cumsum_kkt.pyfla_ops/cumsum.pyfla_ops/chunk_scaled_dot_kkt.pysglang/.../minimax_m3_sparse.pyfla_ops/l2norm.pyminimax_m3/index_topk.pySemantics are preserved exactly:
boundary_check. Several sites here check just dim 0 (boundary_check=(0,),padding_option="zero"); a dim the author left unchecked was already known in-bounds, and masking it would change codegen for no reason.padding_option="zero"and the default both becomeother=0.0.<ptr>.dtype.element_tyis retargeted to the base pointer.tl.advanceanywhere in the repo, so no pointer-advancing loops needed restructuring.cumsum.pywas converted by hand rather than mechanically. Both of its kernels select between two alternative block pointers in anif/elseand then issue a single load, so a naive "nearest preceding declaration" rewrite would silently bind the load to theelsevariant and drop theifone. The branch-dependent base pointer and stride are hoisted into the branches and the masked access is shared. No other file has this shape.Test Plan
gfx950, triton
3.8.0+amd.rocm7.1.0.gitf6a045ff:tl.make_block_ptrsites and no syntax errors repo-wide.Test Result
Zero
make_block_ptrsites remain (was 181), no syntax errors, and all 14 affected modules import.Kernels compiled and ran against torch references:
chunk_local_cumsum_scalar(1-D, hand-converted branchy path)chunk_local_cumsum_vector(2-D, hand-converted branchy path)l2norm_fwdsolve_tril(vstorch.linalg.inv(I + A))Validation scope — please review with this in mind
The four kernels above are numerically verified. The remaining files — notably
fused_merge_recompute.py(34 sites) andchunk_delta_h{,_vk}.py(23 each) — are converted by the same audited transform and import cleanly, but I could not find a test in this repo that exercises them numerically, so they are compile-validated only. Those are the places most worth a careful reviewer pass.blackcould not be run here (it targets py3.15, the box has py3.12), so formatting has not been checked against the repo linter.