Repository navigation
feat(cuda-oxide): add Windows x86_64 MSVC support - #1770
Merged
Merged
Conversation
nihalpasham
requested review from
binarybana,
cryos,
elibol,
kkraus14,
roivanov and
rparolin
as code owners
November 10, 2026 10:21
nihalpasham
force-pushed
the
feat/windows-msvc-support
branch
7 times, most recently
from
November 11, 2026 12:36
94ce588 to
828b27a
Compare
Signed-off-by: ansidium <[email protected]> Signed-off-by: nihalpasham <[email protected]>
Signed-off-by: ansidium <[email protected]> Signed-off-by: nihalpasham <[email protected]>
Signed-off-by: ansidium <[email protected]> Signed-off-by: nihalpasham <[email protected]>
Signed-off-by: nihalpasham <[email protected]>
nihalpasham
force-pushed
the
feat/windows-msvc-support
branch
from
November 11, 2026 12:39
828b27a to
160bab3
Compare
5 tasks done
elibol
pushed a commit
that referenced
this pull request
Nov 11, 2026
Transplanted from `NVlabs/cutile-rs#318` onto `NVIDIA/cuda-rust` `main` (closes #1441) and pairs with #1770 to complete native Windows (`x86_64-pc-windows-msvc`) support. ## Overview On Linux (`x86_64-unknown-linux-gnu`), Clang maps unscoped C enums whose enumerators are all non-negative to unsigned `c_uint` (`u32`). On Windows MSVC (`x86_64-pc-windows-msvc`), the MSVC C ABI defaults all unscoped C enums to signed `c_int` (`i32`), causing 18 type-mismatch errors (`expected u32, found i32`) when compiling `cuda-core`: ```text CUDA C Header (`cuda.h`) enum CUstream_flags_enum { CU_STREAM_DEFAULT = 0x0, ... }; │ ├──► Linux SysV ABI (Clang / bindgen) │ pub type CUstream_flags_enum = c_uint; (u32) ──► matches cuda-core u32 APIs │ └──► Windows MSVC ABI (Clang / bindgen) Before: pub type CUstream_flags_enum = c_int; (i32) ──► 18 type-mismatch errors in cuda-core After: pub type CUstream_flags_enum = c_uint; (u32) ──► matches Linux & cuda-core u32 APIs ``` Standardizing the 9 non-negative CUDA driver enums to `::core::ffi::c_uint` (`u32`) in `cuda-bindings/build.rs` resolves the mismatch once at the binding generation boundary without scattering platform casts across `cuda-core` or downstream crates. Enums with negative values (such as `CUshared_carveout_enum` with `-1`) remain signed `c_int`. ## Changes | File | Change | |:-----------------------------------------------------------|:-----------------------------------------------------------------------------| | `cuda-bindings/build.rs` | Maps 9 non-negative CUDA driver enums from `c_int` to `::core::ffi::c_uint` | | `cutile-rs/cutile-compiler/src/cuda_tile_runtime_utils.rs` | Uses `tileiras_executable_name()` (`tileiras.exe` on Windows) in path tests | | `cutile-rs/cutile-ir/tests/bytecode_validate.rs` | Writes `tileiras` validation output to `NUL` instead of `/dev/null` on Win32 | | `cutile-rs/cutile-ir/tests/requirements.rs` | Normalizes `\r\n` line endings before comparing requirement tables | ### Standardized Enums (`cuda-bindings/build.rs`) - `CUstream_flags_enum` - `CUlaunchAttributeID_enum` - `CUctx_flags_enum` - `CUevent_flags_enum` - `CUevent_wait_flags_enum` - `cudaError_enum` - `CUdevice_attribute_enum` - `CUfunction_attribute_enum` - `CUjit_option_enum` ## Validation - [x] `cargo check --workspace --all-targets` (root host workspace on Windows 11 24H2 `x86_64-pc-windows-msvc`) - [x] `cargo test -p cuda-core --lib` (49 / 49 passed on Windows Blackwell `sm_120a`) - [x] `cargo test -p cutile-compiler --lib` (132 / 132 passed on Windows) - [x] `cargo test -p cutile-ir` (all unit, determinism, bytecode validation, and roundtrip suites passed on Windows) - [x] End-to-end `cuda-oxide` Windows smoke suite (`scripts/smoketest.sh`: 257 / 257 examples passed on Windows Blackwell `sm_120a` with #1770) Signed-off-by: Temo Tskipuri <[email protected]>
Contributor
|
I've published CUDA Rust Windows 0.4.0, a community distribution incorporating this PR, with a verified prebuilt backend and signed installer. Details, installer preview and test results: Show and tell. |
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
Adds native Windows (
x86_64-pc-windows-msvc) support forcuda-oxideacross the artifact writer, CUDA Toolkit discovery,cargo-oxidebackend build and runtime loader paths, and smoke test infrastructure (pairs with #1473 for sharedcuda-bindingsenum signedness; closes #139):oxide-artifactsandrustc-codegen-cuda:.oxartrelocatable object sections (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ) forx86_64-pc-windows-msvcandaarch64-pc-windows-msvcalongside Linux ELF..objobject extensions on Windows host targets inrustc-codegen-cudaand patches the isolated backend workspace to consume the in-tree COFF writer while keeping host runtimes on the crates.io release.cuda-toolkit-discovery,libnvvm-sys,nvjitlink-sys, andcuda-artifact-finalizer:cuda-toolkit-discoveryfor Linux and Windows CUDA Toolkit roots (CUDA_TOOLKIT_PATH,CUDA_HOME,CUDA_PATH,CUDA_PATH_V*, andC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v*) and versionednvvm64_*.dll/nvJitLink_*.dlldiscovery.cuda-host,cuda-oxide-codegen, andcuda-intrinsics-gen.cargo-oxideandcuda-macros:platform.rs), buildsrustc_codegen_cuda.dllin--releasewithlld-linkandffi.liblookup on Windows MSVC, and fixescargo oxide doctorllc.exedetection on Windows./alternatenamefallback stub on Windows MSVC in#[device] extern "C"blocks so host binaries do not fail to link device-only LTOIR extern symbols.scripts/smoketest.shto support Windows under Git Bash (pwd -W,ptxas -o NUL, andrelease/rustc_codegen_cuda.dllbackend pinning), addsscripts/smoketest.ps1, and adds the Windows setup guide incuda-oxide-book/getting-started/windows.md.Test plan
just -f cuda-oxide/Justfile fmt-checkjust -f cuda-oxide/Justfile check-guardsjust -f cuda-oxide/Justfile clippycargo test -p oxide-artifacts --features objectcargo test -p cuda-toolkit-discovery -p libnvvm-sys -p nvjitlink-sys -p cuda-artifact-finalizer -p cargo-oxidex86_64-pc-windows-msvc, Blackwellsm_120a):cargo oxide setup,cargo oxide doctor,scripts/smoketest.ps1,bash scripts/smoketest.sh, andcargo oxide sanitize vecadd --arch sm_120a