Repository navigation
Replace CUDA C kernels with CUDA Oxide Rust - #23
Merged
Merged
Conversation
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 embeds CUDA C and invokes NVRTC instead of using the required CUDA Oxide Rust kernels. Replace all five CUDA C files and all 13 entry points with Rust kernels compiled to embedded PTX at build time. Reuse the checked Rust transforms and overlap arithmetic, and retain strict CUDA routing, output formats, asynchronous ownership, and overflow reporting.
The standalone device build pins CUDA Oxide and its compiler. CUDA execution builds require the Linux CUDA Oxide toolchain or
JXR_CUDA_OXIDE_PTX; builds without either retain device-free contracts and report CUDA unavailable. Hardware CI requires kernel compilation, and formatting checks include the standalone sources. Runtime execution requires the CUDA driver and does not invoke NVRTC.Validation completed on
ssh cudawith an RTX 4070 SUPER:jxr-math,jxr-cuda, andjxr-nativetests, focused Clippy, and formatting pass.Include the measured permutation fix: constant subscripts eliminate the high-pass kernel's 256-byte per-thread stack. On the matched profile of 1,080 launches using the 145×130 and 1019×677 fixtures, this reduced total GPU time from approximately 29.3 ms to 17.0 ms. Average high-pass time fell from 51.2 µs to 17.5 µs; the CUDA C baseline was 18.9 µs. The default portable PTX also compiles to zero high-pass stack use on the test GPU.
Performance parity remains incomplete: the CUDA C baseline totaled approximately 12.9 ms in that profile. Overlap and output remain optimization work; this PR does not claim equal overall kernel performance.