Conversation
The frame gather stages through a pageable vector, so the driver bounces it through pinned memory of its own before the H2D. Gathering straight into a pinned buffer removes that bounce. Measured over three interleaved passes against 2962282, it changes nothing: +4.0 % at the 64 KB rung, +0.1 % at 256 KB, -2.0 % at 1 MB, with the two sides overlapping at every rung and disagreeing in direction between rungs. That is one distribution rather than two. Flat refuses it under the rule the issue pre-registered, so no decoder code ships. The record says why it is flat: the removed bounce is one pass over 102 MB against a ~450 ms floor made of the gather's own memcpy, the content checksum over 212 MB of output, and the transfers, and the frame entry point owns no reusable context so it pays cudaHostAlloc on every call. Only the shape the issue names was measured. A bounded pinned wave that overlaps the gather with the transfer is a different mechanism and nothing here evaluates it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #135.
Measured-negative. No decoder code ships. This PR is the record.
What was measured
The gather in
DecodeAndAssemblewas changed to write into acudec_cuda::PinnedBufoftotal_srcbytes instead of a pageablestd::vector, keeping the single H2D, the byte layout, the order and theoffsets. That is exactly the shape the issue's Done-when names.
The claim was that removing the driver's internal bounce copy shows up in the
end-to-end wall time. It does not.
Numbers
Three interleaved passes, after / before / after / before / after / before in
one session, both binaries built from the same tree, recorded 2026-08-10 inside
the digest-pinned
nvidia/cuda:12.6.2-devel-ubuntu24.04container(
sha256:738fba0fbdb225b7a2931c58a5c8f03a84d3cd2f6a84975826a157339ef750b8) onthe RTX 3080 (sm_86, driver 560.94, CUDA 12.6, nvcc V12.6.77), 3 warmup + 30
measured runs per rung, output byte-verified against the original once per rung
before timing. Baseline is
2962282.The sides overlap at every rung and disagree in direction between rungs, off
samples that interleave with each other. One distribution, not two. The issue's
own rule is that flat refuses the change, so it is refused.
Why it is flat
The bounce copy this removes is one pass over 102 MB. The timed call also pays
the gather's own memcpy over the same bytes, the content checksum over 212 MB
of output, and both transfers, which is the roughly 450 ms floor every rung
shares. Pinning 102 MB is not free either, and
cudaHostAlloclands on everycall because the frame entry point owns no reusable context to amortize it
across.
What this does not claim
Only the shape the issue names was measured: one pinned buffer of
total_src,one H2D. A bounded pinned wave that overlaps the gather with the transfer is a
different mechanism and nothing here evaluates it. That belongs where overlap is
owned, in the streaming context, which holds a buffer across calls and so does
not pay the pinning per call.
The hostile-input concern in the issue's constraints is not resolved by this
result and is not made worse by it either:
total_srcis still the sum of anuntrusted frame's parsed block lengths, and the gather still allocates that much
pageable memory, which is the state the tree was already in.
Gate
The pinned variant built and passed the full suite before it was reverted:
frame_twinandframe_host_negativeare both in that set. The tree as shippedhere differs from
mainonly indocs/BENCHMARKS.md.The device-side sanitizer net did NOT run. Compute Sanitizer cannot attach to
this device through the WSL2 paravirtualized path, which is #258, and the remedy
the tool names is a machine-wide elevation that is not taken here. Nothing here
should be read as having passed that gate.
This change had no second reader. The evidence above stands in place of one.