Skip to content

Triton int8 TMA fault: needs Triton >= 3.8.0 and ptxas >= 13.3 to go away (evidence/triton_tma) - #142

Merged
SamMausberg merged 8 commits into
mainfrom
upstream/triton-tma-evidence
Oct 1, 2026
Merged

SamMausberg merged 8 commits into
mainfrom
upstream/triton-tma-evidence

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Adds evidence/triton_tma/ and experiments/triton_tma/: which Triton builds give wrong products when an int8 tile loaded through a 64-byte TMA box is converted to BF16 for tl.dot. This is the certified head's 64-byte-box fault, and the question was whether it lies in Triton's generated code or in ptxas, and which builds fix it. Correctness only; nothing is timed.

Result (evidence/triton_tma/README.md, run evidence-20261001T171930Z at 4b54d73). The certified head's raw-product kernel (TMA path) gives wrong products, NaN and Inf among them, in builds that lack either Triton 3.8.0 or newer or ptxas 13.3 or newer:

Build Triton ptxas (sm_90) head kernel, wrong cases of 150 minimal kernel
t371 3.7.1 (SGLang venv) 12.8.93 72 0
t371_ptxas134 3.7.1 13.4.59 68 0
t380 3.8.0 12.9.86 57 0
t380_ptxas133 3.8.0 13.3.33 (the wheel's own ptxas-blackwell) 0 0
t380_ptxas134 3.8.0 13.4.59 0 0
tmain main 3931812707 (nightly wheel) 13.4.59 0 0
tmain_ptxas129 main 3931812707 12.9.86 49 0

Every wrong case uses BLOCK_K = 64 (a 64-byte int8 box) at 65,536 or 248,320 int8 rows, with random and with real head data. None fails at 8,192 rows or with BLOCK_K = 128. The two identical runs of a wrong case almost always differ in their counts (72 of 72 on 3.7.1). The pattern matches triton-lang/triton#9433, which is closed: a register-operand wgmma hazard whose fix has a Triton half (#9514 and #9530, in 3.8.0) and a ptxas half (CUDA 13.3). I did not inspect the SASS, so that attribution rests on the version pattern. The fix is already upstream, so no Triton issue was filed.

Consequence for the certified head. On Triton 3.7.1, the SGLang venv's version, refusing 64-byte int8 boxes stays necessary. On Triton 3.8.0, TRITON_PTXAS_PATH set to the wheel's own ptxas-blackwell gave correct results in every case here.

How it was produced.

  • Code committed first (946f24c, deb77cf, 4b54d73), then scripts/gpu_lock.sh -s experiments/triton_tma/run_versions.sh <dir>. The script runs the seven builds one at a time. An earlier concurrent run at deb77cf gave the same pattern and is described in the README as superseded.
  • Each cases/<build>.jsonl header records the Triton version, the ptxas it used for sm_90, the override variables, the GPU and driver, and repo_commit/repo_dirty.
  • The venvs live outside the repository; their commands, including the nightly wheel artifact, are in the README.
  • Hardware and software: GH200, driver 570.195.03 with the CUDA 13.0 compat libraries, torch 2.13.0+cu130.

Not covered. The certified head's second fault (envelope misses with a 128-byte box) is not tested. Nor is why the minimal kernel never fails.

Files: about 350 KB in total. int8_tma_summary.json (55 KB) is the per-tile summary; cases/*.jsonl (about 42 KB each) hold every case.

Codex review of 0681090. All four comments were right. 4b54d73 fixes them, and the evidence was regenerated with the fixed script (08113d8):

  • run_versions.sh now sources scripts/sglang_env.sh.
  • It clears TRITON_PTXAS_PATH and TRITON_PTXAS_BLACKWELL_PATH before applying each run's own override.
  • It runs the builds one at a time, which keeps the shared job under its 20 GB budget.
  • int8_tma_check.py replaces an existing --out instead of appending to it.

int8_tma_check.py runs the certified head's raw-product kernel (TMA path) and a
minimal kernel against an FP64 reference, for 64- and 128-byte int8 boxes, three
sizes and random or real head data, each case twice. run_versions.sh runs it
under Triton 3.7.1, 3.8.0 and main with their own and swapped ptxas, and
summarize.py reduces the cases to per-tile counts.
Main passes with ptxas 13.4 and fails with 12.9, so the 3.8.0 runs separate a
ptxas fix from a Triton one.
… ptxas >= 13.3 to go away

Run evidence-20261001T160757Z at deb77cf. The certified head's raw-product kernel
gives wrong products with 64-byte int8 boxes at 65,536 and 248,320 rows on Triton
3.7.1 (with ptxas 12.8 or 13.4), 3.8.0 with ptxas 12.9, and main with ptxas 12.9;
it is correct on 3.8.0 with ptxas 13.3 or 13.4 and on main with 13.4. The
minimal kernel is never wrong.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T19:46:30.434849Z 8e90e62 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 068109010b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread evidence/triton_tma/README.md Outdated
The run, under the shared GPU lock, from the repository root:

```sh
scripts/gpu_lock.sh -s experiments/triton_tma/run_versions.sh ~/vp-data/upstream/triton/runs/evidence-20261001T160757Z

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Source the required environment before the GPU run

The documented reproduction command starts a GPU workload without first sourcing scripts/sglang_env.sh. Although run_versions.sh reconstructs part of the CUDA environment, it does not apply the complete pinned PATH and SGLang setup, so this is not a supported invocation on the Lambda host and may select different tooling as the machine environment changes. Prefix the command with source scripts/sglang_env.sh.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4b54d73: run_versions.sh now sources scripts/sglang_env.sh itself, so the documented command loads the machine's CUDA 13 environment. Each build still runs under its own interpreter, and the README says so. The evidence was regenerated with this script (08113d8).

Comment thread experiments/triton_tma/run_versions.sh Outdated
Comment on lines +42 to +43
env TRITON_CACHE_DIR="$out/cache-$name" "${override/#-/TRITON_PTXAS_UNSET=1}" \
timeout --foreground 900 "$py" "$repo/experiments/triton_tma/int8_tma_check.py" --real \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear inherited ptxas overrides for bundled runs

When the caller already has TRITON_PTXAS_PATH or TRITON_PTXAS_BLACKWELL_PATH set, env inherits it; assigning the unrelated TRITON_PTXAS_UNSET variable for - does not unset either override. In that scenario the supposedly bundled t371, t380, or tmain cases silently use the caller's compiler, invalidating the build comparison. Explicitly unset both override variables before applying the per-run override.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4b54d73: every run now starts from env -u TRITON_PTXAS_PATH -u TRITON_PTXAS_BLACKWELL_PATH, and only that run's own override is added, so a caller's setting cannot reach the bundled runs.

Comment thread experiments/triton_tma/run_versions.sh Outdated
Comment on lines +43 to +45
timeout --foreground 900 "$py" "$repo/experiments/triton_tma/int8_tma_check.py" --real \
--out "$out/$name.jsonl" >"$out/$name.log" 2>&1 &
pids+=($!)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the shared GPU job within its memory budget

The README runs this under gpu_lock.sh -s, whose shared-job contract limits non-server jobs to 20 GB, but this loop backgrounds all seven experiments simultaneously. At the largest case, each process holds the roughly 0.64 GB int8 head, two roughly 0.51 GB FP64 reference arrays, and several result/comparison buffers, so the combined peak exceeds that shared allocation before CUDA-context and allocator overhead. Run the variants sequentially or require the exclusive lock so concurrently admitted jobs are not starved or OOM-killed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4b54d73: the seven builds now run one at a time (each process peaks at about 3.5 GB), which keeps the job within the shared budget. The committed evidence comes from the sequential run (evidence-20261001T171930Z); the README describes the earlier concurrent run as superseded.

Comment on lines +165 to +166
with args.out.open('a') as f:
f.write(json.dumps({'env': environment()}) + '\n')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Replace prior output instead of appending another run

When int8_tma_check.py is invoked directly as documented and the output path already exists—for example after an interrupted run—append mode leaves the previous header and cases in place. A subsequent summarize.py call then treats the second {"env": ...} header as a case and raises KeyError: 'kernel' (or duplicated cases distort consumers that do not reject it). Open a fresh file in write mode or fail explicitly if the path exists.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4b54d73: int8_tma_check.py now opens --out in write mode, so an existing file is replaced, and the docstring says so.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (0681090, 4 blocking: Codex's four comments; the evidence itself checks out)

Review of 946f24c, deb77cf and 0681090.

Evidence: every claim checks out.

  • Committed files match the run. The seven cases/*.jsonl files and int8_tma_summary.json are byte-identical to ~/vp-data/upstream/triton/runs/evidence-20261001T160757Z. Every header records repo_commit deb77cf and repo_dirty false, together with the Triton version, the sm_90 ptxas path, the override variables and the GPU/driver.
  • Build table. Recounted from the case lines: head-kernel cases wrong in each build are 72, 65, 55, 0, 0, 0 and 46; the minimal kernel is never wrong.
    • All wrong cases have BLOCK_K = 64 and 65,536 or 248,320 rows.
    • Random and real data both fail: 35 and 37 cases for t371, 34 and 31 for t371_ptxas134, 27 and 28 for t380, 22 and 24 for tmain_ptxas129.
    • The override variables are null in the bundled runs, as the build table says.
  • Per-tile 3.7.1 table. Every cell matches. 128x128x64 with 4 warps has NaN or Inf in all 20 of its wrong cases, and the 128-byte control is 0/30.
  • ptxas versions. The full numbers (12.8.93, 13.4.59, 12.9.86, 13.3.33) match --version of the binaries at the recorded paths. The JSON keeps only major.minor.
  • Triton references.
    • RAW hazard with pipelined wgmma and LHS in register triton-lang/triton#9433 is closed, and chsigg confirmed on 2026-05-28 that ptxas 13.3 fixes the hazard.
    • #9514 and #9530 are in v3.8.0 and not in v3.7.1 (compare API: behind v3.8.0, diverged from v3.7.1).
    • #12035 ("Reland CUDA 13 ptxas for Hopper") merged 2026-09-30.
    • The attribution is hedged correctly, as a version pattern without SASS inspection.
  • Repository hygiene. The two README rows are fine. Host identity: 0 hits. Attribution: clean.

Blocking: Codex's four comments on 0681090 are valid.

  1. r4157721743 (P1). The README's run command must source scripts/sglang_env.sh first (AGENTS.md). The hold script did not source it either; say so if the committed run is kept.
  2. r4157721753 (P2). For the bundled runs, run_versions.sh should unset both TRITON_PTXAS_PATH and TRITON_PTXAS_BLACKWELL_PATH, not set a dummy variable. The committed run is unaffected: its headers show both null for t371, t380 and tmain.
  3. r4157721767 (P2). Seven processes ran on the GPU at once under the shared lock. Each holds the 0.64 GB int8 head and FP64 reference, tolerance and result arrays of about 0.5 GB each at 248,320 x 256, which is roughly 3-4 GB per process with its context, so the job very likely exceeded the 20 GB shared budget for its 30 seconds (16:07:57 to 16:08:27).
    • Run the builds one after another, which matters for the comparison as well as the budget: the fault depends on timing, and the builds ran concurrently.
    • State in the README how the committed run was made: seven concurrent processes, memory not recorded, probably above the shared budget.
  4. r4157721775 (P2). int8_tma_check.py appends to --out. Write a fresh file, or refuse an existing path.

If the README states what the committed run did, the evidence can stay; a rerun after the script fixes is not required. The fixes need pre-commit; I could not run it here because an exclusive hold is running, and I will run it on the fix head.

Suggestions (not blocking)

  • "In 71 of the 72 wrong cases ... different numbers of wrong entries": that is 71 when counting finite wrong entries only. With NaN and Inf counted as wrong, which is the README's own definition, all 72 differ; the 72nd is real data, 248,320 rows, 128x128x64 with 4 warps, with NaN 8 against 7 and Inf 7 against 6.
  • Scope: "the certified head's second fault ... at 64x128x128 with 3 stages" could say "with a 128-byte box and 128 BF16 rows per tile". The faulty configurations found since then all have that shape.

Address Codex on #142: run_versions.sh sources scripts/sglang_env.sh, clears
TRITON_PTXAS_PATH and TRITON_PTXAS_BLACKWELL_PATH before each run's own override,
and runs the seven builds sequentially to stay within the shared-job memory
budget; int8_tma_check.py replaces an existing --out instead of appending.
Run evidence-20261001T171930Z at 4b54d73 (the seven builds one at a time):
head-kernel wrong cases 72, 68, 57, 0, 0, 0, 49; the minimal kernel none. The
README records the superseded concurrent run at deb77cf and scopes the second
fault to the 64 x 128 x 128 tile.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 08113d8: Codex has not yet reviewed this head, and pre-commit is queued in the CPU window. I will confirm or withdraw once both finish.)

4b54d73 and 08113d8 resolve all four Codex comments from 0681090.

  • run_versions.sh sources sglang_env.sh, runs every build with env -u TRITON_PTXAS_PATH -u TRITON_PTXAS_BLACKWELL_PATH, and runs the builds one after another. int8_tma_check.py writes --out fresh.
  • The regenerated evidence matches the README.
    • The cases files and int8_tma_summary.json are byte-identical to evidence-20261001T171930Z. Every header has repo_commit 4b54d73 and repo_dirty false.
    • Head-kernel wrong cases, recounted from the case lines: 72, 68, 57, 0, 0, 0, 49. The minimal kernel is never wrong.
    • Every wrong case has BLOCK_K = 64 and 65,536 or 248,320 rows, and random and real data both fail.
    • The 3.7.1 per-tile table matches, including 64x128x64 at 7/10 and 5/10, and 128x128x64 with 4 warps all NaN or Inf.
    • On 3.8.0's own ptxas, 64x128x64 fails 2 of 30.
    • Wrong-entry counts differ between repeats in 72/72, 67/68, 57/57 and 48/49.
  • The earlier concurrent run at deb77cf is described as superseded, with its counts (72, 65, 55, 0, 0, 0, 46) and its seven concurrent processes. The second-fault scope names the 64 x 128 x 128 tile.
  • The branch merges cleanly into main. Host identity: 0 hits.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08113d8175

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

twice on the same inputs. One JSON line per case, after a header line with the environment; an existing output file is
replaced.

scripts/gpu_lock.sh -s python experiments/triton_tma/int8_tma_check.py --out cases.jsonl

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Source the CUDA environment in the direct invocation

Although run_versions.sh now sources the required environment, this separate documented command still launches python through gpu_lock.sh using the caller's environment; the lock wrapper only serializes the job and does not configure CUDA. From a fresh shell on the prescribed Lambda host, this can omit the CUDA 13 compatibility libraries or select a different Python/Triton installation, causing the reproducer to fail or test the wrong toolchain. Source scripts/sglang_env.sh as part of this invocation.

AGENTS.md reference: AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0bc2339: the documented direct run is now scripts/gpu_lock.sh -s bash -c 'source scripts/sglang_env.sh && python experiments/triton_tma/int8_tma_check.py --out cases.jsonl', and the docstring points to run_versions.sh for the build comparison. Only the docstring changed; the committed evidence comes from run_versions.sh, which already sourced the environment.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (08113d8; withdraws my provisional approval; 1 blocking, a one-line docstring fix)

Codex r4159453606 (P1) is valid. The docstring of int8_tma_check.py still documents a direct run, scripts/gpu_lock.sh -s python experiments/triton_tma/int8_tma_check.py --out cases.jsonl, with no sglang_env.sh. gpu_lock.sh does not set up CUDA, so from a fresh shell that command can miss the CUDA 13 compatibility libraries or pick another Python and Triton (AGENTS.md).

Write it as scripts/gpu_lock.sh -s bash -c 'source scripts/sglang_env.sh && python experiments/triton_tma/int8_tma_check.py --out cases.jsonl', or point it at run_versions.sh. Everything else from my comment on 08113d8 stands.

Address Codex on #142 (08113d8): the docstring's direct command now loads the
CUDA 13 environment, and points to run_versions.sh for the build comparison.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 0bc2339: Codex has not yet reviewed this head. I will confirm or withdraw once it does.)

0bc2339 fixes my one item (Codex r4159453606). The docstring's direct run now sources scripts/sglang_env.sh inside the gpu_lock.sh -s command, so it runs under the SGLang venv's Triton, and it names run_versions.sh for the comparison across builds. Only the docstring changed; the generator and the evidence are as I verified them at 08113d8. Pre-commit from c6c121c to 0bc2339 is clean, and the commit has no hostname or AI attribution.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 0bc233916a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on 0bc2339)

This confirms my provisional approval. Codex found no issues on this head (19:25 UTC).

…vidence

# Conflicts:
#	experiments/README.md
evidence/certified_head (tma_repro.json and its README section) merged with #45,
so the README points to it instead of describing the runs.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional, on 8e90e62: Codex has not reviewed this head yet.)

I will confirm once Codex reviews 8e90e62.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 8e90e62832

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on 8e90e62)

This confirms my provisional approval. Codex found no issues on this head.

SamMausberg added a commit that referenced this pull request Oct 1, 2026
#142 (evidence/triton_tma) tested the certified head's int8 TMA kernel on seven Triton and
ptxas builds: the four without both Triton >= 3.8.0 and ptxas >= 13.3 gave wrong products,
the three with both did not, a version pattern that matches the closed issue
triton-lang/triton#9433 (the README's attribution rests on that pattern alone). Section 4.5
now says so with a new register entry, triton-tma, added after kernel-tma with the appendix
editor's agreement; the issue is named in text, not cited, so references.bib is unchanged.
To keep the page budget, Section 4.5 drops a parenthetical on how compaction keeps whole
tiles.
SamMausberg added a commit that referenced this pull request Oct 1, 2026
…atches

- gumbel_sample ran its two guards after a refused batch too. With no
  candidates, the small-probability guard compared -inf with a stale ymax and
  could add its bit to rows already marked refused (x9e's GPU tests caught it:
  status 576 instead of 64 in test_quantization_data_must_belong_to_the_weight).
  The guards check a decision, so they now run only after one; a refused
  batch keeps the single status refused. A CPU test with stale buffers fails
  without the fix. Outputs never changed (refused rows take the stock chain),
  and no committed evidence or paper number counts the extra bit: every
  certified-head evidence file was produced at or before 9f7f369, before the
  guards (09bf64e, ec46d55, 2c36737), and no other workstream's committed
  evidence ran the certified head.
- Codex on 00f305f: in check mode, the fixed-noise comparison with SGLang's
  seeded sampler adds its mismatches after attach_ids has written the
  counters, so a mismatch on the last sampled replay was never recorded.
  Patch 0008 (engine/kernel a28946e0d4) writes them again after the
  comparison.
- Main now carries #142: the evidence README cites evidence/triton_tma for the
  first TMA fault (clean only with Triton >= 3.8.0 and ptxas >= 13.3 together,
  matching triton-lang/triton#9433 by version pattern; the 64-byte refusal
  stays on Triton 3.7.1).
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