Repository navigation
[Engine] Inkling 2 on RTX 30: use the faster int8 prompt kernel - #300
Open
okada-shogo wants to merge 4 commits into
Open
okada-shogo wants to merge 4 commits into
okada-shogo wants to merge 4 commits into
Conversation
…bits) On sm_75 the int8 prompt kernel's tile of 128 activation rows takes 59-63 KB of the multiprocessor's 64 KB, so one block decodes a stage and multiplies it by turns. For Inkling 2 Mini's types (IQ4_NL, Q8_0, NVFP4, IQ2_XXS, IQ2_XS, IQ2_S) in tiles of 32 and 128 rows, the Turing pass now takes stages of 128 values with 256 threads (two blocks a multiprocessor), half of the int32 sums made floats by an exact add in place of the conversion, and for the i-quants shared rows without padding (pieces swizzled by row). The passes for Ampere and newer compile these shapes empty. Each output's terms are added in the same order: the same bits. Other cards, and STRATA_I8M_TURING=0, take the tile as before. RTX 2070 Super, poly_i8m_shapes_test --time: IQ4_NL experts gate|up 5,489 -> 5,002 us, down 3,075 -> 2,551; Q8_0 dense [2304 -> 3072] 615 -> 543; NVFP4 down 3,391 -> 2,681; IQ2_XXS 5,876 -> 5,095. poly_i8m_shapes_test: each shape against the old one, bit for bit (--time: their times), and the launcher's own pick; also rows of 704 and 1,088 values, 2,280 outputs, rows read and written by index with experts without rows; it fails where a Turing shape fits fewer than two blocks a multiprocessor. The kernel is VecSzn's (i8_mma.cuh); this changes only its tile shape on Turing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Registered as a rollback of the 128-value int8 tile stages on Turing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… they beat the default (same bits) On a card with 100 KB of shared memory a multiprocessor (the sm_86 pass: RTX 30, and RTX 40 builds without their own pass) the int8 prompt kernel's 128-row tile also runs one block a multiprocessor. The Turing shapes (stages of 128, 256 threads, two blocks a multiprocessor) now run there too, for the products where they beat the launcher's own pick, its raw stage copy included (i8m_amp_shape()): IQ4_NL where the raw copy is not taken (the experts' downs), IQ2_XXS, NVFP4's downs, Q8_0 in the widest tile up to 1,024 outputs. Each output's terms are added in the same order: the same bits. STRATA_I8M_AMPERE=<types> sets the types (0: none). RTX 3090, poly_i8m_shapes_test --ab 7 (medians, against main's pick): IQ4_NL down 965 -> 782 us, IQ2_XXS 1,672 -> 1,451, NVFP4 down 1,012 -> 940, Q8_0 [2304 -> 1024] 80.6 -> 74.0. Prompt tok/s, IQ4_NL, all experts in VRAM: 2K +2.2%, 8K +2.3%; UD-Q2_K_XL +0.5% / +0.6%. poly_i8m_shapes_test --ab N: main's pick, the launcher's pick and the new shape forced on, interleaved with the order turning every round; medians and every round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Registered as a research setting (the types that take Turing's tile shapes on sm_86). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
okada-shogo
force-pushed
the
port/i8m-sm86-select
branch
from
November 25, 2026 03:48
975c0cb to
1d10434
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.
Stacked on #286 (port/i8m-sm75, the Turing int8 tiles). The diff shows that PR's commit too until it merges.
Problem and result
#286 gave the int8 prompt kernel a tile that loads its inputs in stages of 128 values, so two blocks fit on one SM.
Cards with 100 KB of shared memory per SM use the sm_86 build target (RTX 30, and RTX 40 builds without their own
target). There the default tile also runs only one block per SM. This PR uses the Turing tile on the sm_86 target,
but only for the products where it measured faster than main's default launcher choice (including main's cp.async
stage copy). The outputs are the same bits. On an RTX 3090, prompts get 2.2-2.3% faster on IQ4_NL and 0.5-0.6% on
UD-Q2_K_XL.
Prompt speed, RTX 3090 24 GB (all experts in VRAM), default flags (tok/s, higher is better, mean of 3 runs):
An earlier run with only the first two products switched (IQ4_NL downs, IQ2_XXS) gave IQ4_NL 2K +3.0% and 8K +3.2% on
the same card. Each run is in the details below.
Related discussion
none
Approach
i8m_amp_shape()picks the products. They come from interleaved A/B runs against main's own launcher pick:card.arch == 860). sm_80 (164 KB) already fits two blocks of theold tile. Other targets compile the new shapes as empty.
STRATA_I8M_AMPERE=<types>sets the types (0: none).poly_i8m_shapes_test --ab Ninterleaves main's pick, this PR's pick and the new shape forced on. The order rotatesevery round, and it prints the medians.
Kernel times: RTX 3090 (µs, lower is better, median of 7 interleaved rounds)
poly_i8m_shapes_test --ab 7. "main" is main's own launcher pick, with its raw stage copy where it takes it.With the new shape forced on, IQ2_S, NVFP4 gate·up and Q8_0 experts are 2-5% slower, so they keep main's shape.
Rows that end inside a stage (IQ4_NL K = 704, NVFP4 K = 1,088) gain too: +15.5% and +8.7%.
Each run (tok/s)
Each run is a fresh
--serveprocess, with one warm-up request before the measured one. The round order alternates.main is cdfae80 and this PR is 975c0cb, CUDA 12.9, on a Salad container (Ryzen 9 5950X).
Validation
Passed:
STRATA_I8M_AMPERE(and, from [Engine] Inkling 2 on RTX 20: faster int8 prompt kernel #286 which this branch contains,STRATA_I8M_TURING) are registered.python3 tools/settings_register.py --checkandtools/test_settings_register.py: OK at this commit. No engine code changed in this commit.poly_i8m_shapes_test --ab 7on the RTX 3090 (sm_86): main's pick, this PR's pick and the new shape forced on givethe same bits on all 18 products. Besides Inkling's shapes, these include K = 704 and 1,088, 2,280 outputs, and
rows read and written by index with empty experts.
--top-probs 20,frozen experts (all 3,072 in VRAM): token ids and top-20 lines the same as main, with CUDA graphs and with
--no-graphs, at default flags and with--prompt-int8(+STRATA_PREFILL_NVFP4=w4a8,STRATA_INK_FAST_CTRL=1,STRATA_INK_PRESTAGE=1). Main cdfae80 and a build of this PR's tree (the same tree as 975c0cb).greedy tokens,
--top-probs 20, frozen experts (all 3,072 in VRAM), CUDA graphs and--no-graphs, default flags and--prompt-int8with the same three env flags: token ids and top-20 lines the same as main in all four settings.Failed:
Not run:
card.arch == 860only).Limits
differently.
🤖 Generated with Claude Code