Skip to content

perf(cuda): release closed mappings off the decode thread - #10718

Merged
0ax1 merged 1 commit into
developfrom
ad/cuda-mapped-release
Oct 23, 2026
Merged

0ax1 merged 1 commit into
developfrom
ad/cuda-mapped-release

Conversation

@0ax1

@0ax1 0ax1 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closing a mapped reader can stall decoding while waiting for GPU copies and releasing page tables.

Solution

Move synchronization and mapping release to a background worker; drain queued releases before explicit cache eviction.

Assessment

Falls back to synchronous release if queuing fails and retains mappings if completion is unknown. Depends on #10717.

@codspeed

codspeed Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 25.2%

3 warnings, 1 note

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ Unable to measure the execution of 2 benchmarks

These benchmarks measured no execution time, so their results are not comparable and count as unchanged. This usually happens when the compiler removes the code under test.

Prevent compiler optimizations

See affected benchmarks

⚠️ 24 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 40 benchmarks have no flamegraph

The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.

See affected benchmarks

⚡ 3 improved benchmarks
✅ 2405 untouched benchmarks
⏩ 12 skipped benchmarks1
🗄️ 43 archived benchmarks run2

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation bench_compare_primitive[(10000, 32)] 97 µs 72.9 µs +33.09%
⚡ CPU Simulation chunked_dict_primitive_canonical_into[f64, (1000, 1000, 10)] 191.8 µs 151.5 µs +26.64%
⚡ Walltime starts_with_avx512[8, VarBin] 46.1 µs 39.6 µs +16.45%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ad/cuda-mapped-release (5fadeca) with develop (6d44b35)

Open in CodSpeed

Footnotes

  1. 12 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. 43 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩

@0ax1 0ax1 added the changelog/performance A performance improvement label Oct 23, 2026 — with ChatGPT Codex Connector
@0ax1
0ax1 force-pushed the ad/cuda-mapped-release branch from 8ba0f78 to d91362d Compare October 23, 2026 13:13
@0ax1
0ax1 force-pushed the ad/cuda-file-mapping-cache branch from 8ed5762 to 18c5897 Compare October 23, 2026 13:13
@0ax1
0ax1 requested a review from robert3005 October 23, 2026 14:50
@0ax1
0ax1 marked this pull request as ready for review October 23, 2026 14:51

@robert3005 robert3005 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a thing that already runs on a per thread basis that we can move this to instead of having a thread

@0ax1
0ax1 force-pushed the ad/cuda-file-mapping-cache branch from 18c5897 to a149621 Compare October 23, 2026 15:43
@0ax1
0ax1 force-pushed the ad/cuda-mapped-release branch from d91362d to 8845ef7 Compare October 23, 2026 15:44
@0ax1
0ax1 force-pushed the ad/cuda-file-mapping-cache branch from a149621 to 34a45d9 Compare October 23, 2026 17:13
Base automatically changed from ad/cuda-file-mapping-cache to develop October 23, 2026 18:03
Move closed readers' copy-stream waits and mapping release onto a background worker. Drain queued releases before explicit cache eviction and retain mappings when synchronization fails. Include the release-before-return regression test.

Original-commit: e1b178661a
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1
0ax1 force-pushed the ad/cuda-mapped-release branch from 8845ef7 to 5fadeca Compare October 23, 2026 18:05
@0ax1
0ax1 merged commit a74fdc7 into develop Oct 23, 2026
108 of 109 checks passed
@0ax1
0ax1 deleted the ad/cuda-mapped-release branch October 23, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants