← Back to Pull requests

Do not wait for a thunk's input buffers before executing #3686

Closed
unknown closed this pull request without merging on Nov 04, 2026 23:26 UTC
View on GitHub
unknown unknown commented on Nov 04, 2026 21:23 UTC
Author

Found while profiling PracticalLuxBench's U-net (Lux + Reactant, batch 16). In the training loop the host spends ~7.5 ms of each 9.5 ms step blocked in cuLaunchHostFunc/future wait, then does ~2 ms of launch work while the GPU sits idle: the generated thunk calls XLA.synced_buffer on every input, and the inputs of step n+1 are the outputs of step n.

PJRT (and IFRT) already order an execution after the computations that produce its input buffers (definition events on the device stream), the same way JAX dispatches without waiting on input futures. So pass the buffers through without waiting (unsynced_buffer) and leave each buffer's future in place, so to_host/synchronize/raw pointer access on the host still wait.

Train step: 9.5 → 8.5 ms/step with identical losses (same env, stock JLL). Together with EnzymeAD/Enzyme-JAX#3841 (cuDNN backward-filter lowering of the transposed-conv filter gradient) the step is 5.7–6.2 ms, vs. 6.8 ms for torch.compile on the same RTX 5090.

Error propagation: if a producing execution failed, PJRT surfaces the error on the dependent execution and on the buffer's future, so a failing step is still reported at the next step or on readback rather than lost.

Tests run locally on CUDA: core/compile core/buffer_donation core/aliasing core/autodiff core/control_flow core/array_ops core/ops, 1249/1250 passing; the one failure (condition12: compile test, -1.78e-15 ≈ 0.0) fails identically on unmodified main (a GPU reduction-order rounding against an exact zero).

🤖 Generated with Claude Code

https://claude.ai/code/session_01K1GPCnUaQKiMLASni1N1eu

Diff: 213 lines (+159 / -54) across 2 files Reviewer: giordano Review duration: 123m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 213 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.321
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3686"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.6% (MEDIUM) · Higher = larger blast radius
36.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.4% · Safe to merge
14.4%