Skip to content

test(marlin): derive large-K tile expectation from SM count - #6672

Merged
Qubitium merged 1 commit into
mainfrom
fix/marlin-small-grid-sm-expectation
Dec 1, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/marlin-small-grid-sm-expectation

Conversation

@Qubitium

@Qubitium Qubitium commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

test_large_k_keeps_narrow_when_it_still_splits_k hard-codes the narrow
{threads=128, thread_n=64, thread_k=128} tile for five large-K shapes. That
contract was measured on 128-SM Ada parts, where the narrow tile's 64 output
tiles still leave at least two threadblocks per tile to split K. On the 48-SM
GB10 the same 64 output tiles already exceed the SM count, so the planner
correctly keeps the wide tile; the test failed on every shape although the
kernel was correct.

No issue number: this was found by a GB10 regression sweep, not filed upstream.

What Changed

No production code changed. The two "AllSpark rejects sm_121" GPU tests are
left untouched; they are by design.

Tests

# Branch (GB10, 48 SMs), full file
PYTHONPATH=$PWD /root/gptqmodel-work/venv/bin/python -P -m pytest -q \
  -p no:cacheprovider -p no:xdist tests/kernels/test_marlin_small_grid_tiles.py
# 30 passed

# Origin/main (0127a0313), full file
python -P -m pytest -q -p no:cacheprovider -p no:xdist \
  tests/kernels/test_marlin_small_grid_tiles.py
# 5 failed, 25 passed

# Mutation check: temporarily forced marlin_prefers_narrow_small_grid() to
# return true, then reran the five cases on the branch
# 5 failed: actual (128, 64, 128), expected wide

# Branch lint
bash format/check.sh
# ruff 0.14.2; All checks passed!

Measured Impact

Wide vs narrow tile on the 48-SM GB10, fp16, min of 5 trials x 200 iterations
after warmup (CUDA events; auto output matched the wide tile bitwise):

M K N wide (ms) narrow (ms) narrow / wide
32 14336 4096 0.123 0.119 0.97x
64 14336 4096 0.152 0.141 0.93x
128 14336 2048 0.087 0.102 1.17x
16 8192 2048 0.026 0.026 0.99x
16 4096 4096 0.026 0.026 1.00x

The narrow tile is not "clearly faster" on 48 SMs: it is 17% slower at M=128
and within run-to-run noise elsewhere. Both tiles match the FP64 oracle on
these shapes (max errors 0.0104-0.0211), so the planner's wide choice is valid
and the test's constant was the stale part.

Model Support / Module Plan

Not applicable: test-only change.

AWQ onboarding safety

Not applicable: no AWQ changes.

Logic Flow Documentation

Not applicable: test-only change; no runtime selection or data flow changes.

Review Requirements

I or an AI agent (such as Codex or Claude) have:

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions.
  • Avoided unnecessary monkeypatching and used the project's normal extension points where possible.
  • Minimized and compacted the impacted code surface.
  • Considered and eliminated potential regressions.

Kernel Accuracy Requirements

Not applicable: no kernel changed. The existing test still compares every
launch with an independent FP64 oracle, and the five affected shapes were
checked with both tiles during the benchmark.

Notes

The 48-SM GB10 cannot give the narrow tile two K blocks per output tile for
these shapes. The helper models that hardware constraint, not a hard-coded SM
number: on a 128-SM part it returns the narrow tile and the test still pins
#5281's choice. The mutation check confirms the test fails when the planner is
forced to pick narrow on GB10.

`test_large_k_keeps_narrow_when_it_still_splits_k` hard-coded the narrow 128x64 tile for five large-K shapes. That contract was measured on 128-SM Ada parts, where 64 narrow output tiles still leave room for two K blocks per tile. On the 48-SM GB10 the same 64 tiles already exceed the SM count, so the planner correctly keeps the wide tile; the test failed on every shape although the kernel was correct (verified against the FP64 oracle and a wide-vs-narrow benchmark).

Derive the expected tile from the device's SM count and the narrow tile's actual K-split, including #5281's four-way rule for 16-row tiles. The test still pins the narrow tile on 128-SM parts and now expects the wide tile on 48-SM parts. Mutation check: forcing the planner to always prefer narrow makes all five cases fail.
@Qubitium
Qubitium marked this pull request as ready for review December 1, 2026 17:46
@Qubitium
Qubitium merged commit 8c10e50 into main Dec 1, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/marlin-small-grid-sm-expectation branch December 1, 2026 17:46
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