Skip to content

device-tests: a lane-passing convention probe (#27) - #36

Merged
feitreim merged 1 commit into
mainfrom
issue-27-measure
Jul 27, 2026
Merged

feitreim merged 1 commit into
mainfrom
issue-27-measure

Conversation

@feitreim

Copy link
Copy Markdown
Owner

Adds a permanent lane-convention codegen probe to device-tests, and the measurement issue #27 asked for. Measurement only — this does not do the sweep, so it does not close #27.

Six kernels, three conventions at two widths, launched by nothing and checking nothing (same discipline as softmax_probe). The probe leans on every lane-taking op in one loop body: a coordinate-addressed load of a [32, N] block, a RegVec::row vector into sub_row, a ColVec::column vector into add_col, a second coordinate pass for a causal mask, and a store_fragment per [16, 16] block that fits the staging tile.

  • HOISTED — today's rule: one warp::lane_id(), threaded through
  • PER_OP — each op reads %laneid itself
  • PER_QUERY — each row/column query reads it, the pessimistic bound

modal run modal_app.py::regcount, sm_100a, no spills anywhere:

kernel regs stack
lane_probe_128_hoisted 198 2816
lane_probe_128_per_op 168 2816
lane_probe_128_per_query 168 2816
lane_probe_32_hoisted 72 256
lane_probe_32_per_op 40 512
lane_probe_32_per_query 40 512

PER_OP and PER_QUERY are identical on every column at both widths, and the emitted PTX holds exactly one %laneid move in all six kernels. The reads CSE; the count of warp::lane_id() calls is free. Full reasoning and the recommendation are in the issue comment.

Every pre-existing kernel in the table is byte-identical to origin/main, so the addition perturbs nothing.

Changes are confined to device-tests/src/main.rs and are strictly additive (one existing use line gains ColVec) — two other branches are editing that file.

Verified: modal run modal_app.py::build (clippy both crates, 33 host tests, real cargo oxide build --arch sm_100a for harness and examples), cargo fmt --check. No GPU function was run.

Refs #27.

Six codegen probes, three lane conventions at two widths, so `regcount`
can price what issue #27 asks about: whether a coordinate-dependent op
should take `lane: u32` or read `warp::lane_id()` itself.

The probe leans on every lane-taking op in one loop body — a
`coordinate`-addressed load, a `RegVec::row` vector into `sub_row`, a
`ColVec::column` vector into `add_col`, a second `coordinate` pass for a
causal mask, and a `store_fragment` per `[16, 16]` block — which is where
hoisting the lane would compound if it compounds anywhere.

It does not. `PER_OP` and `PER_QUERY` agree on registers, spills, stack
and instruction count at both widths, and the emitted PTX carries exactly
one `%laneid` move in all six kernels: the reads CSE. The measured
numbers are in the probe's doc comment.
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.

Settle the lane-passing convention before the op set grows

1 participant