Skip to content

Reduce kernel launch and first-use latency - #3237

Merged
maleadt merged 4 commits into
mainfrom
tb/latency
Aug 17, 2026
Merged

maleadt merged 4 commits into
mainfrom
tb/latency

Conversation

@maleadt

@maleadt maleadt commented Aug 17, 2026

Copy link
Copy Markdown
Member

Reduce overhead in common kernel compilation and launch paths:

  • avoid redundant allocation and stream-capture queries when tracking managed memory;
  • use a function barrier for launches with runtime-length argument splats;
  • precompile GPU-dependent initialization and reflection paths;
  • record the CUDA environment in benchmark logs.

Locally, type-unstable launch overhead dropped from 2625 ns and 21 allocations to 1653 ns and 6 allocations. First-kernel latency improved by roughly 150 ms, while package import time remained unchanged.

maleadt and others added 4 commits August 17, 2026 13:12
Thread-safe launch tracking added a set allocation, a sort, and one stream-capture query per managed allocation. This cost about 300 ns, or 4-7% on small-kernel benchmarks.

Sort a copy and deduplicate adjacent entries, bypass that work for a single allocation, and query capture state once per launch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A runtime-length argument splat leaves the tuple type uninferred at the @cuda call site, causing dynamic dispatch at each conversion, compilation, and launch stage.

Put the pipeline behind one function barrier so it specializes on the concrete tuple after a single dispatch. This recovers the 4% regression in the by-value slices benchmark.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The device-free precompile workload cannot reach context creation or reflection, leaving about 150 ms of compilation on the first kernel.

Move context creation out of the memoization closure into a named function, and precompile it together with compiler configuration and the common code_native/code_llvm signatures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Driver and toolkit changes on the benchmark agent have caused dashboard steps that were otherwise difficult to attribute. Print CUDA.versioninfo() before the suite so the job log records the environment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maleadt
maleadt merged commit 12db784 into main Aug 17, 2026
1 of 2 checks passed
@maleadt
maleadt deleted the tb/latency branch August 17, 2026 16:29
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.35%. Comparing base (36c226d) to head (a50cf54).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3237      +/-   ##
==========================================
- Coverage   92.38%   92.35%   -0.04%     
==========================================
  Files         184      184              
  Lines       16084    16084              
==========================================
- Hits        14860    14855       -5     
- Misses       1224     1229       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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