MRCuda: add getRuntimeInfo() returning Expected<RuntimeInfo>; deprecate isCudaAvailable()#6307
Merged
Conversation
Grantim
approved these changes
Jun 23, 2026
- test_cuda_smoke: getRuntimeInfo() raises when no device, returns info with fitForComputations() when available - test_cuda_module_exists: check getRuntimeInfo symbol exists - cuda_placeholder.h: mirror new RuntimeInfo/getRuntimeInfo stub API
adalisk-emikhaylov
approved these changes
Jun 23, 2026
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
Introduces
Cuda::getRuntimeInfo()as the primary way to query CUDA availability and device capabilities, and re-expresses the existingisCudaAvailable()on top of it (now deprecated).The old
isCudaAvailable()packed several concerns into oneboolreturn plus four optional out-parameters: it queried the driver/runtime versions and the compute capability, and decided whether the device was suitable for computations — while discarding the underlying CUDA error on failure.New API:
getRuntimeInfo()returns the four versions on success, or a descriptive error string when no CUDA device is present or a CUDA call fails. The compute-capability-vs-runtime-version suitability logic now lives inRuntimeInfo::fitForComputations(), separate from the query.Changes
MRCudaBasic.h/.cpp— addRuntimeInfo+getRuntimeInfo(); propagate CUDA errors asExpectedvia theCUDA_RETURN_UNEXPECTEDmacro instead of returning a barefalse.isCudaAvailable()— kept for backward compatibility (existing callers, the Python/C bindings and downstream code keep working unchanged), now marked[[deprecated( "Use getRuntimeInfo" )]]and reimplemented as a thin wrapper: it fills the optional out-parameters fromgetRuntimeInfo()and returnsRuntimeInfo::fitForComputations().getCudaAvailableMemory()— no longer routes through the availability check; it triescudaSetDevice( 0 )directly and now also checks the result ofcudaMemGetInfo(previously ignored), returning 0 on failure.///Doxygen style.MRTestCuda— updated to the new API; logs the actual CUDA error message on failure and checksfitForComputations()explicitly.Notes
isCudaAvailable()keeps its old signature and semantics (out-parameters + the fit-for-computations result), so no binding regeneration or downstream changes are required.