Skip to content

[release/internal/3.5.x] Fix null-ptr crash in TritonAMDGPUOptimizeDotOperands when tt.trans takes load result directly#929

Open
mstankov-amd wants to merge 1 commit into
release/internal/3.5.xfrom
fix_triton_amdgpu_optimize_dot_operands
Open

[release/internal/3.5.x] Fix null-ptr crash in TritonAMDGPUOptimizeDotOperands when tt.trans takes load result directly#929
mstankov-amd wants to merge 1 commit into
release/internal/3.5.xfrom
fix_triton_amdgpu_optimize_dot_operands

Conversation

@mstankov-amd
Copy link
Copy Markdown

@mstankov-amd mstankov-amd commented Mar 3, 2026

[AMD] Fix null-ptr crash in TritonAMDGPUOptimizeDotOperands when tt.trans takes load result directly

Problem

TritonAMDGPUOptimizeDotOperands crashes with PassManager::run failed when
compiling the flex attention backward kernel on gfx120x. The
failure is a null-pointer dereference in the ReuseShmemForDirectAndTransposedUse
pattern.

When tt.trans uses the load result directly,
transOp.getSrc().getDefiningOp<ConvertLayoutOp>() returns nullptr. The code
then passes this null cvtOp into rewriter.modifyOpInPlace(cvtOp, ...),
crashing the pass manager. There is also a latent null-dereference in the LDBG
line immediately after (debug builds only).

Fix

One-line null check: if no ConvertLayoutOp precedes tt.trans, skip this user
with continue. The pattern then falls through to the existing if (!transDot)
guard and returns notifyMatchFailure gracefully, leaving the IR unchanged.

cvtOp = transOp.getSrc().getDefiningOp<ttg::ConvertLayoutOp>();
if (!cvtOp)
  continue;

Ref #ROCM-1778

The file has changed in upstream/main, so this should be only 3.5 specific change. There is no failure on version 3.6

@mstankov-amd mstankov-amd changed the title Fix null-ptr crash in TritonAMDGPUOptimizeDotOperands when tt.trans takes load result directly [release/internal/3.5.x] Fix null-ptr crash in TritonAMDGPUOptimizeDotOperands when tt.trans takes load result directly Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant