Skip to content

Studio int8 GEMM: the unlisted-card race switch acts between loads - #17084

Merged
danielhanchen merged 2 commits into
mainfrom
studio/int8-race-switch-between-loads
Nov 9, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
studio/int8-race-switch-between-loads

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

#17026 races a few Triton tiles for the int8 GEMM on cards with no measured tile table (unlisted sm80+ cards), and keeps the winner for the process. UNSLOTH_DIFFUSION_INT8_GEMM_RACE=0 is meant to keep the fallback tile. device_config re-reads the unlisted path per call "so its switch acts between loads", but the race switch was only read before a winner was kept:

  • first load with the race on: the winner, e.g. (256, 128, 128, 8, 8, 3);
  • set UNSLOTH_DIFFUSION_INT8_GEMM_RACE=0, next load: still the raced winner instead of the fallback (128, 128, 64, 8, 4, 4).

The fused-vs-stock latency verdict was also cached per (card, mode) without the tile, so a verdict measured for one tile was reused for another.

A process started with the switch already off behaved correctly. Only an in-process change (a rollback between loads, an A/B in one server) was ignored.

Change

  • _unlisted_tile reads the switch on every load, ahead of the kept winner: off returns the fallback tile, on returns the kept winner (no second race).
  • The latency verdict is keyed by (card, mode, tile).

Nothing changes for a process that never flips the switch: the same race, the same persisted winner, the same verdict.

Tests

test_race_switch_acts_between_loads_after_a_winner_is_kept (fake sm86 probe / race / latency harness): winner, then the fallback with the switch off (with its own latency check), then the kept winner again with one race in total.

arm test_diffusion_int8_gemm_unlisted.py + test_diffusion_int8_gemm.py
main (a174823) 116 passed, 1 failed (the new test: the raced winner with the switch off)
this PR 117 passed

UNSLOTH_DIFFUSION_INT8_GEMM_RACE=0 was read only before a winner was kept, so turning it off after the
first load still returned the raced tile; the latency verdict was also keyed without the tile. The switch
is now read per load ahead of the kept winner (off = the fallback tile), and the verdict is keyed by tile.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T03:55:51.929584Z 2c4eefd 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.

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 2c4eefdccf

ℹ️ 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".

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