cuda: support CUDA toolkits older than 12.2#494
Open
giannisanni wants to merge 1 commit into
Open
Conversation
The CUDA backend uses the cudaMemLocation overloads of cudaMemAdvise()
and cudaMemPrefetchAsync(), which were introduced in CUDA 12.2. On
systems with an older toolkit (e.g. Ubuntu 24.04 ships nvcc 12.0) the
build fails with:
ds4_cuda.cu(909): error: no suitable conversion function from
"cudaMemLocation" to "int" exists
Add inline overloads, guarded by CUDART_VERSION < 12020, that forward
to the legacy int-device signatures. Compiles to nothing on 12.2+.
Tested on Linux, nvcc 12.0, driver 580.82, RTX 4060 Ti (sm_89):
builds clean and SSD streaming inference runs correctly.
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.
The CUDA backend uses the
cudaMemLocationoverloads ofcudaMemAdvise()andcudaMemPrefetchAsync(), introduced in CUDA 12.2. Older toolkits (e.g. Ubuntu 24.04 ships nvcc 12.0) fail to build:This PR adds two inline overloads guarded by
CUDART_VERSION < 12020that forward to the legacy int-device signatures (cudaCpuDeviceIdwhen the location is host). On 12.2+ the block compiles to nothing.Tested on Linux / nvcc 12.0 / driver 580.82 / RTX 4060 Ti 16GB (sm_89): builds clean, and
--ssd-streaminginference on DeepSeek V4 Flash q2 runs correctly (2.2 t/s generation streaming from a PCIe 3 NVMe, 28.7 t/s prefill on a ~1k token prompt - happy to share fuller consumer-hardware benchmark data if useful).