Skip to content

perf(dsv41): add opt-in GPU sampling candidate selection - #11

Draft
sayyidfareed wants to merge 1 commit into
bertholomus:deepseek-v41-zigfrom
sayyidfareed:perf/dsv41-gpu-sampling-candidates
Draft

sayyidfareed wants to merge 1 commit into
bertholomus:deepseek-v41-zigfrom
sayyidfareed:perf/dsv41-gpu-sampling-candidates

Conversation

@sayyidfareed

@sayyidfareed sayyidfareed commented Oct 11, 2026 •

Copy link
Copy Markdown

What this changes

Add opt-in TF_DS_GPU_CANDIDATES=1 selection of a bounded set of exact top candidates on GPU while keeping the existing host sampler and fallback. The default remains off. Eligibility/count handling and CUDA glue are included; initialize profiling counters and widen candidate-count arithmetic to avoid supporting-state errors encountered while qualifying this path.

This is not a changed model, quantization or draft acceptance rule. It does not claim a broad speed lead. The host sampler and fallback remain authoritative; device exactness release gates below are still pending for this standalone PR.

Receipt

  • Environment: native base 4e80f05ecba89a4e90d16375ade2eddbdc0a10c4, Zig 0.17.0, Ubuntu 24.04.5 LTS, kernel 7.0.0-1019-nvidia, NVIDIA driver 580.178.04; Linux ARM64 CUDA environment; two NVIDIA GB10 nodes for historical live tests, SM121, Mia EXL3 2.9 bpw revision 64ba41b6c916a587db06eae2e19b7845f7be6e6b, recipe v0.6.1 kit. Container ARM64 image sha256:1ad8c1382c09861dee9c342b59f6e5e3e65fe7fde4a07b5e379bc985b66902dd.
  • Exact standalone source tested: e7ebb370d6cd5055bae60c77661f1c7f6c765057; command zig build test -j1 --summary all with a shared Zig cache.
  • Host result: Build Summary: 17/19 steps succeeded (1 failed); 135/136 tests passed (1 failed). Cached groups are additional; this count is executed tests, not an invented full-suite total.
  • Historical CUDA candidate test: 21 finite cases, 3 fallback cases and 1 tied case passed. Matched API medians (3 reps) against R2: sampled C1 69.65→72.63 tok/s; C8 aggregate 114.20→116.54. Other native on/off runs were effectively equal; these small differences do not establish a robust broad gain. R2 includes our transport/cache fixes, not stock. Public prompt token arrays and runner are in the linked recipe.
  • Lean checker: pinned baseline 1,420 findings; this branch 1420; zero new findings. Existing oversized family modules are inherited. zig fmt --check passes changed Zig files.
  • The sole host failure is the independently reproduced upstream direct_io buffered-reference bug, submitted separately; this PR does not suppress it.
  • Exactness: full drafted/plain, resumed/fresh, concurrent/solo and tensor seam gates on this standalone commit remain unrun; historical combined-device checks are not claimed as substitutes.
  • Decode/prefill: no fresh prescribed benchmark matrix for this standalone commit; no prompt-speed non-regression claim.
  • Not run: Metal M1–M5 and a clean-machine release installation. test-golden was attempted on the pinned source but that step does not exist, despite CONTRIBUTING.md naming it.
  • Public recipe and evidence and qualification limits. Draft pending remaining device/release gates and maintainer review.

Checklist

  • Every token still goes through lane rounds; no serial bypass (test-only N/A where applicable).
  • Drafted equals plain, resumed equals fresh, concurrent equals solo (test-only N/A).
  • No precision reduction is introduced; any unverified output equivalence is disclosed above.
  • Prompt processing is no slower than the last release (test-only N/A).
  • Tested and untested platforms are named.
  • Red/green regression evidence is available; other missing device gates remain disclosed.
  • Added comments are single lines; measurements/history remain in receipts.
  • Outgoing commits use the public GitHub noreply identity; no private hosts, paths, credentials or tool attribution.

Merge considerations

Two-way source revert. Preserve both ranks at the same source/runtime identity. This PR has not changed the default deployed upstream recipe.

@bertholomus

Copy link
Copy Markdown
Owner

Thank you @sayyidfareed — a bounded candidate set with the host sampler kept authoritative and a fallback is the right shape for this change.

We're not merging it now: it's a new runtime feature (opt-in GPU sampling), and in maintenance mode we only take small fixes that don't add runtime surface. Your own notes list the device exactness gates as pending — that plus the feature bar is why this stays open for the maintainers; the medians you attached will make the call easy in a development window. Thanks again.

@bertholomus

Copy link
Copy Markdown
Owner

Thank you again @sayyidfareed. Development is back on, so the "small fixes only" bar from my last note no longer applies. We merged this PR onto the current branch head (dfc8fe5) and ran the host tests: 184/184 pass. The direct_io test that failed in your notes also passes on this head, so that failure came from the older base. With TF_DS_GPU_CANDIDATES unset, the sampled tokens take the same path as before. When you mark the PR ready with your device results, we will review it for merging.

@bertholomus

Copy link
Copy Markdown
Owner

Thank you @sayyidfareed. A check on this draft, idle since 16 October: our releases now build from branch deepseek-v41-zig-tp2. Is this still active? If yes, a new PR against that branch is welcome.

@bertholomus

Copy link
Copy Markdown
Owner

Thank you for the work on this draft, @sayyidfareed. We are withdrawing our promise to review #11 for merging. It sits on deepseek-v41-zig, and we no longer build from that branch. A new PR on deepseek-v41-zig-tp2 is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants