Skip to content

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

Open
0ax1 wants to merge 3 commits into
ad/cuda-file-mapping-cachefrom
ad/cuda-mapped-release
Open

0ax1 wants to merge 3 commits into
ad/cuda-file-mapping-cachefrom
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 degrade performance by 12.09%

2 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

⚠️ 21 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

⚡ 7 improved benchmarks
❌ 8 regressed benchmarks
✅ 2393 untouched benchmarks
⏩ 12 skipped benchmarks1
🗄️ 43 archived benchmarks run2

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime threshold_neon[8] 1.4 µs 3.1 µs -55.7%
❌ Walltime filter_neon[8] 932 ns 1,788 ns -47.87%
❌ Walltime threshold_neon[64] 2.6 µs 4.2 µs -38.41%
❌ Walltime filter_neon[64] 1.8 µs 2.8 µs -34.96%
❌ Walltime filter_neon[80] 2.7 µs 3.4 µs -22.37%
❌ Walltime threshold_neon[80] 3.8 µs 4.5 µs -15.67%
❌ CPU Simulation test_repeated_scan_scalar_at[int_str_float] 493.5 µs 577.2 µs -14.51%
❌ CPU Simulation test_repeated_scan_scalar_at[int_float] 373.4 µs 423.3 µs -11.79%
⚡ CPU Simulation decode_primitives[i64, (1000, 8)] 37.6 µs 24.2 µs +55.51%
⚡ CPU Simulation test_scan_filter_to_arrow_array[int_float] 4.1 ms 3.5 ms +15.98%
⚡ Walltime starts_with_avx512[8, VarBin] 46.2 µs 39.9 µs +15.87%
⚡ Walltime starts_with_avx512[64, VarBin] 62.8 µs 56.4 µs +11.51%
⚡ CPU Simulation test_repeated_scan_filter[int] 2.7 ms 2.5 ms +11.39%
⚡ CPU Simulation test_scan_filter_to_arrow_array[int] 2.8 ms 2.5 ms +11.07%
⚡ CPU Simulation test_scan_filter[int] 3 ms 2.8 ms +10.02%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ad/cuda-mapped-release (8845ef7) with ad/cuda-file-mapping-cache (a149621)

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 added 2 commits October 23, 2026 16:42
On devices that read pageable memory through host page tables, copy resident mapped-file ranges directly into device memory. Preserve staged reads for uncached ranges and direct I/O, source and destination alignment, cancellation safety, and mapping lifetime guards. Use the existing file-read chunk size so this feature is independent of chunk-size tuning.

Original-commit: b546d93814
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Cache mappings by file identity and version so repeated scans reuse filled page tables. Add Rust and C APIs to release cached mappings before cold-cache eviction while active readers retain their mappings. Include reuse, versioning, release, and concurrent-read coverage.

Original-commit: a31e77427e
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
@0ax1
0ax1 force-pushed the ad/cuda-file-mapping-cache branch from 18c5897 to a149621 Compare October 23, 2026 15:43
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 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

This branch has not been deployed

No deployments
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