Enable opt-in host-pageable CUDA GatherBlockQuantized - #32626
Draft
kunal-vaishnavi with Copilot wants to merge 11 commits into
Draft
kunal-vaishnavi with Copilot wants to merge 11 commits into
kunal-vaishnavi with Copilot wants to merge 11 commits into
Conversation
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The current implementation introduces an ABI hazard, default-path regressions, and unsafe lazy-copy state publication.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds opt-in host-pageable access for FP8 CUDA GatherBlockQuantized, with device-copy fallback and CUDA plugin support.
Changes:
- Adds provider-option plumbing and host/device data policies.
- Implements persistent and per-run CUDA fallback copies.
- Adds capability, CUDA Graph, option, and fallback tests plus documentation.
File summaries
| File | Description |
|---|---|
onnxruntime/test/util/default_providers.cc |
Forwards the option to CUDA plugin tests. |
onnxruntime/test/contrib_ops/gather_block_quantized_op_test.cc |
Adds policy, fallback, direct-host, and graph tests. |
onnxruntime/core/providers/cuda/plugin/cuda_kernel_adapter.h |
Exposes plugin runtime configuration. |
onnxruntime/core/providers/cuda/plugin/cuda_ep.h |
Adds plugin configuration state. |
onnxruntime/core/providers/cuda/plugin/cuda_ep.cc |
Propagates plugin configuration to kernels. |
onnxruntime/core/providers/cuda/plugin/cuda_ep_factory.cc |
Parses the plugin option. |
onnxruntime/core/providers/cuda/cuda_provider_factory.cc |
Converts bundled provider options. |
onnxruntime/core/providers/cuda/cuda_kernel.h |
Exposes provider state to kernels. |
onnxruntime/core/providers/cuda/cuda_execution_provider.h |
Exposes the option from the CUDA EP. |
onnxruntime/core/providers/cuda/cuda_execution_provider_info.h |
Stores and hashes the option. |
onnxruntime/core/providers/cuda/cuda_execution_provider_info.cc |
Parses and serializes the option. |
onnxruntime/contrib_ops/cuda/quantization/gather_block_quantized.h |
Defines policies and persistent storage. |
onnxruntime/contrib_ops/cuda/quantization/gather_block_quantized.cuh |
Identifies eligible FP8 types. |
onnxruntime/contrib_ops/cuda/quantization/gather_block_quantized.cc |
Implements direct-host and fallback paths. |
include/onnxruntime/core/providers/cuda/cuda_provider_options.h |
Adds the option to the V2 struct. |
docs/cuda_host_pageable_gather.md |
Documents requirements and limitations. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
…-gather-block-quantized # Conflicts: # onnxruntime/core/providers/cuda/cuda_execution_provider_info.cc # onnxruntime/core/providers/cuda/cuda_execution_provider_info.h # onnxruntime/core/providers/cuda/cuda_provider_factory.cc Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
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.
Description
Add the
enable_host_pageable_gatherCUDA EP option and use it to keep constant FP8com.microsoft::GatherBlockQuantizeddata in CPU/file-backed memory on devices that support pageable access through host page tables. Unsupported devices and CUDA Graph configurations warn and use a persistent device copy, including a thread-safe lazy copy when prepacking is disabled.Also includes CUDA plugin plumbing, provider-option/policy/fallback/capability-gated tests, and documentation of memory-accounting, sharing, and performance limitations.
Motivation and Context
Large sparse FP8 embedding tables can exceed practical GPU memory capacity even though each inference accesses only a few rows. Direct host-pageable access preserves file-backed demand paging and avoids allocating or copying the complete table on supported unified-memory systems.
Validation: clang-format and secret scanning passed. Automated review reported no findings; its CodeQL database scan was skipped because the database was too large. A CPU provider-test build remains in progress, and the capability-gated direct CUDA test could not be run because this environment has no CUDA toolkit/hardware.