Skip to content

Resolve dispatch pipeline variants outside command recording - #196

Closed
kvark wants to merge 9 commits into
perf/attention-autotune-2026-09-19from
perf/resolved-pipelines-2026-09-19
Closed

kvark wants to merge 9 commits into
perf/attention-autotune-2026-09-19from
perf/resolved-pipelines-2026-09-19

Conversation

@kvark

@kvark kvark commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Stacked on #194, which includes the merged #195.

Implementation

Resolve each dispatch's pipeline variant after compilation, tuning, attention-sequence replacement and tuning swaps. step() uses the installed choice instead of allocating candidate lists and rehashing generated kernels. Profiling keys report that same choice.

Commands and descriptors are freshly recorded, with current buffers bound on every step. No command replay, new API, dependency, test executable or device/model threshold. The runtime change is 26 added / 20 removed lines.

Pipeline-selection results

Three fresh processes per arm and GPU, rotated order, on the matched SmolLM2-135M diagnostic. Intel recording falls from 1.347 to 1.283 ms and decode from 4.696 to 4.640 ms (about 1.2%; all three pairs improve). NVIDIA decode is mixed: 2.398 to 2.415 ms with overlapping process ranges; no decode gain is established. Both prefill medians improve about 1%. This is a small cleanup, not the main explanation of the gap.

Separate scheduling finding

The source-only sweep on experiment/submission-overlap-2026-09-19 changes only the existing submission count, keeping kernel choices fixed within each process. With three processes per GPU and forward/reverse sweeps, eight freshly recorded chunks give:

GPU Single-submit decode Eight chunks llama.cpp
RTX 5070 2.416 ms 1.415 ms 1.366 ms
Arc B570 4.608 ms 3.648 ms 3.439 ms

Nsight confirms GPU work starts before the final chunk is submitted in all 320 captured eight-chunk decode steps. Prefill becomes 7.279/19.903 ms versus llama.cpp's 7.120/15.639 ms. Intel prefill remains a substantial gap.

All thirteen settings produce bit-identical saved logits within each process; all 84 saved sets including llama.cpp retain 33/33 independent CPU-reference next-token choices. This is batch-one decode, with unchanged readback and arithmetic, not a batched-throughput result. Clocks were not fixed. More chunks eventually regress; this PR does not hard-code eight or change the one-submission default. A bounded scheduling search on representative work is still needed; the sweep is not an automatically selected held-out result.

Revisions, full tables, limitations and reproduction.

Verification

452 library tests pass. All four existing opt-in GPU tests pass on both GPUs, including repeated attention-sequence replacement and swaps that preserve distinct training states. The 18 pipeline-comparison logit sets also pass. All kernel comparisons qualify within unchanged budgets. Formatting and all-feature/all-target Clippy pass.

Implementation CI passes all six jobs, including Metal, Windows, MSRV and coverage. Rust host line coverage is 83.7% overall (81.1% in runtime.rs); WGSL is not instrumented. The final commit is documentation only. The known Naga Workgroup ArrayStride warning remains.

Raw timings, logits, native captures and binaries remain outside Git. The submitted paper and frozen Inferena cohort are unchanged.

@kvark
kvark marked this pull request as ready for review September 19, 2026 22:40
Base automatically changed from perf/native-projection-fusion-2026-09-19 to perf/attention-autotune-2026-09-19 September 20, 2026 01:50

kvark commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #200 as requested: one simplified PR against current main with focused commits. The existing branch and measured revisions remain available for reproducibility. Closing this PR so review can continue in one place.

@kvark kvark closed this Sep 20, 2026
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