perf(cudf): Defer cache H2D past submission lock - #113
Merged
thirtiseven merged 2 commits intoSep 3, 2026
Merged
Conversation
sperlingxx
self-requested a review
September 2, 2026 14:22
sperlingxx
approved these changes
Sep 2, 2026
sperlingxx
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Great catch!
The deferred policy will not launch a NEW thread for asynchronous execution. Instead, it put off the execution to escape the scope of cuDF's global mutex device_read_mutex elegantly.
Velox gives BufferedInputDataSource to cuDF
↓
cuDF fetch_byte_ranges_to_device_async_impl()
↓
cuDF acquires device_read_mutex()
↓
cuDF calls datasource.device_read_async()
↓ virtual dispatch
Velox BufferedInputDataSource::device_read_async()
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.
Summary
GLUTEN_CUDF_CACHE_H2D_INLINE=1.Motivation
cuDF #22586 serializes
device_read_async()submission through a process-wide mutex. The existing inline cache path performs cache lookup, cache-page traversal, pin retention, and H2D submission before returning a ready future, so all of that work runs while cuDF holds the mutex. Unrelated scan drivers then form a lock convoy.This change returns a
std::launch::deferredfuture instead. Creating the future is cheap; cuDF releases its submission mutex before waiting on it, and the actual copy still runs inline on the waiting caller thread. This preserves the intended inline execution model and cache-pin lifetime while restoring concurrency across callers.This is a consumer-side mitigation for cuDF issue #23799. cuDF PR #23823 remains the cleaner owner-side fix; this shim should be re-evaluated once a qualified runtime contains that change.
Validation
directCachePageH2dAvoidsHostStaginganddeferredCacheH2dDoesNotHoldCudfSubmissionMutex(2/2).g7.8xlarge, Parquet SF1000 on S3, strict cold Q1-Q22, one iteration per arm.The recovered 8.167 seconds closely matches the independently isolated 8.068-second
GLUTEN_CUDF_CACHE_H2D_INLINE=1regression introduced by cuDF #22586. This change addresses that mutex convoy only; it does not claim to eliminate every performance difference between cuDF releases.