Repository navigation
chore: prepare shared host and Tile crates for v0.5.0 - #1614
Merged
Merged
Conversation
Signed-off-by: Melih Elibol <1884921+elibol@users.noreply.github.com>
elibol
requested review from
binarybana,
cryos,
kkraus14,
nihalpasham,
roivanov and
rparolin
as code owners
October 22, 2026 22:57
This was referenced Oct 22, 2026
1 task done
nihalpasham
added a commit
that referenced
this pull request
Oct 23, 2026
#1615) ## Summary Update `cuda-bindings`, `cuda-core`, and `cuda-core-derive` from `0.4.0` to `0.5.0` in the 17 `Cargo.lock` files introduced by #1598 (`primitives_api_compile` plus the 14 `cute-rs-preview` examples and 2 models) to align with the `v0.5.0` bump in #1614 (`0143af5cc`). ```text Before: 17 cute-rs-preview / fixture Cargo.lock files -> cuda-core 0.4.0 (fails --locked on main) After: 17 cute-rs-preview / fixture Cargo.lock files -> cuda-core 0.5.0 ``` ## Validation - `bash cuda-oxide/scripts/sync-example-locks.sh --check` - `bash cuda-oxide/scripts/check-dependency-licenses.sh` - `bash cuda-oxide/scripts/check-example-license-policy.sh` ## Checklist - [x] All commits signed off (`git commit -s`) Signed-off-by: nihalpasham <nihalp@nvidia.com>
elibol
added a commit
that referenced
this pull request
Oct 30, 2026
…py (#1516) Closes #1506. First change under #1460; implements the `bool` decision recorded there and in #1461 and #1503. Safe element casts previously checked size and alignment but could turn a byte containing `2` into a Rust `bool`. This PR rejects those casts, supports initialized `bool` buffers, and closes the host-side initialization, atomic-reference, kernel-argument, and pinned-alignment holes found during review and follow-up auditing. ## Element validity `DeviceBuffer::cast_elem`, `cast_chunks`, `can_cast_chunks`, and `Tensor::reinterpret` require `bytemuck::AnyBitPattern` on the target. Casting into `bool` is therefore a compile error. The two safe buffer casts also require `T: bytemuck::NoUninit` on their source: padding or `MaybeUninit` bytes must not become initialized destination values. `can_cast_chunks` remains a layout query. These bounds do not restrict `DeviceCopy` itself, and bool-to-byte casts remain supported. `bool` implements `DeviceCopy`: valid values can be copied between host and device, and its all-zero representation is valid. `DeviceCopy` does not promise that every bit pattern is valid. It remains independent of `DType`. The numeric `DType` newtypes implement `Pod`, and `half` enables its bytemuck feature, preserving numeric reinterpretation targets. cuda-core re-exports `bytemuck` for downstream marker implementations. Vector types in cuda-device also implement `Pod`, preserving `cast_chunks` usage. ## Owned atomic-buffer conversions `wrap_elem` and `peel_elem` use the unsafe marker `DeviceRepr<Inner>`. Its contract requires identical layout, valid initialized representations in both directions, no element destruction, and no additional ownership obligations. It has no methods and grants no reference conversions. The integer and floating-point atomic macros implement `DeviceRepr`, not `TransparentWrapper`. Consequently, safe `DeviceAtomicU32::wrap_ref(&u32)` and the reverse `peel_ref` conversion are unavailable. Owned scalar buffers can still be wrapped for atomic kernel access and peeled for readback, retaining their allocation, context, and deallocation stream. Kernel accesses must obey the existing borrowing and synchronization contracts. The marker lives in the dependency-free, `no_std` cuda-repr crate and is re-exported by cuda-core and cuda-device. This lets both sides share one trait without making kernel-only crates depend on the host runtime. The dependent lockfiles add this local package without changing registry or git dependencies. CI path filters include the new crate. The atomic examples use `wrap_elem`/`peel_elem`. `KernelSliceArg` is not restricted to `DeviceCopy`, since atomic wrappers are legitimate kernel element types that cannot implement `Copy`. ## Completed zero-initialization `DeviceBuffer::zeroed` queues the zero-fill and synchronizes its stream before returning. A safe readback or launch on another stream can therefore rely on initialization having completed, including for `bool`. Empty allocations retain their fast path. This makes nonempty `zeroed` a blocking constructor. Asynchronous initialization with automatically retained completion dependencies belongs to the subsequent runtime work; callers are not asked to repair a safe API through manual synchronization. ## Host-side argument contracts and pinned alignment `KernelInputStored` and `KernelOutputStored` now require `unsafe impl`. Their contracts cover truthful dtype/layout/specialization metadata, argument ABI, addressable extent, and storage/access retention through completion and graph replay. Previously an entirely safe custom binding could present `Tensor<bool>` storage as `u8` output, so a normal byte kernel could write invalid bool values. The input counterpart could similarly mislabel arbitrary byte storage as booleans. The safe `KernelInput`/`KernelOutput` conversion traits remain available and must return stored bindings satisfying those contracts. Existing owned, borrowed, view, and mapped bindings retain their behavior. `PinnedHostBuffer` reserves alignment slack, exposes an aligned interior pointer, and retains the original CUDA pointer for deallocation. It also rejects allocation sizes that exceed Rust slice/pointer-arithmetic limits. Empty and zero-sized buffers keep their aligned dangling pointers and allocation-free behavior. ## Tensor alias accounting Tensor aliases and lazy copy operations share a separate ownership token. Completion leases retain the storage itself without contributing to that token. Uniqueness therefore stays correct while a lease is being registered or destroyed: a real alias cannot become a mutable partition, and retiring a lease cannot spuriously reject a unique tensor. Access exclusion and completion retention remain enforced. The acquisition and destruction regressions fail on the previous implementation and pass with this change. A separate test preserves ownership held by an unsubmitted copy operation. ## Compatibility and validation The new `AnyBitPattern` target and `NoUninit` source bounds are breaking changes for safe casts whose element types do not implement those traits. Numeric targets remain supported; atomics use the owned-buffer conversions. Tuple types remain usable as buffer elements but are not reinterpretation targets. Custom stored Tile argument implementations must now explicitly uphold the documented unsafe contract. Earlier validation of the underlying changes: - Full cuda-core and cuda-device tests, including GPU buffer tests, compile-fail tests for invalid bool casts and both atomic shared-reference conversions, and layout checks for all 21 scoped atomic types. - A gated-stream regression that fails without the initialization synchronization and passes with it. It inspects bytes, avoiding invalid Rust bool values in the failing case. - Owned wrapper roundtrip coverage for pointer identity, context, stream retention, and readback. - GPU runs of `legacy_atomic_rmw_cas`, `legacy_atomic_fadd`, and `hashmap` on an RTX 5090; all six Tile tensor reinterpretation tests. - Clippy for cuda-core/cuda-repr, cuda-device/cuda-host, and cutile; host and component formatting; cuda-core/cuda-repr rustdoc with warnings denied. - Device-only build, example lock consistency, dependency-license/SPDX/source-reference/test-matrix guards, and cargo-deny for the host, SIMT, backend, device-only, and Tile workspaces. The Tile UI snapshot now uses the normalized external-crate path. Both UI harness tests (all 12 compile-fail cases) pass, and the CPU CI script now runs them. The version-only update to the planned v0.5.0 API boundary has landed on main in #1614; host and Tile semver checks pass. SIMT workflow branch filters now include stacked PRs targeting `pull-request/<n>` prerequisite mirrors. Follow-up validation for the host-side argument and pinned-buffer fixes: - Both new compile-fail cases compiled before the fix and now fail specifically because `unsafe impl` is required; snapshots were reviewed and rerun without overwrite. - The pinned alignment regression failed before the fix, without constructing misaligned references. It now passes, alongside over-aligned copying, empty/ZST coverage, and allocation-size boundary tests. - Full cuda-core suite: 105 passed, 3 ignored. Selected Tile library/GPU/tensor/view suites: 168 passed, 2 ignored. Submission-lifetime suite: all 9 passed, including forgotten borrowed work and graph replay. - cuda-core and cutile Clippy with warnings denied, host/Tile formatting, and SPDX checks passed. cuda-core rustdoc with warnings denied passed. Tile documentation builds, but its stricter warnings-as-errors check reports 12 existing link warnings outside the added trait documentation. Earlier host-argument follow-up validation: the complete CPU runner passes (1,408 tests, 98 intentionally ignored), including the Tile UI suites. All 25 targeted GPU buffer and pinned-host-buffer tests pass, including the cross-stream initialization regression. The branch includes the #1602 debug-source fixes and the same version metadata as #1614. Current validation (2026-10-30): head `117205c1277a9e6d422df20499342690b412bc16` includes main through `76ac10216`. The new regression fixture compiled before the source-validity fix, then all five trybuild cases passed afterward without snapshot regeneration. The new-main `math_special` example lockfile includes the host dependencies at the versions used by other examples; the full example dependency-policy guard passes. Fresh CI is running. GitHub dismissed the previous approval after the source changes, and renewed review has been requested. The expanded atomics example from current main uses owned `wrap_elem`/`peel_elem` conversions, with explicit checked ownership transfer for its standard-library atomic case. Strict example Clippy passes, and all 24 runtime atomic cases pass on both this PR and the combined shared-host stack on RTX 5090 / CUDA 13.3. Merge-readiness refresh (2026-10-30): head `c5ea583c5b5f06b424a9ab0c48174c771e99ff52` includes main through the merged #1480 (`b025a8b31`). The only manual conflict resolution preserved both changelog entries; source and tests from #1480 merged unchanged. The combined release candidate has an identical source/test tree to previously validated `c6c5a860a` (only the changelog and merge ancestry changed). New-head CI is running. Merge #1516 into main first, then retarget #1603 to main and merge it, then retarget #1604 to main and merge it. Do not merge the children into the temporary `pull-request/*` bases. Issue/release inclusion tracking: #1606. --------- Signed-off-by: Melih Elibol <1884921+elibol@users.noreply.github.com> Co-authored-by: Melih Elibol <1884921+elibol@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.
The next shared-host and cuTile Rust release is v0.5.0, but
mainstill declares v0.4.0. Set the shared host crates and Tile workspace to v0.5.0 so API compatibility checks evaluate incoming changes against the intended release version.Update their path dependency requirements and every tracked lockfile that resolves those local packages, including the SIMT examples. SIMT package versions remain v0.2.1. This changes package metadata only; publishing remains a separate release step.
Validation:
cargo metadata --locked --offlinepassed for all 245 affected lockfiles/workspaces.git diff --checkpassed.cargo denypassed for the host, SIMT, backend, device-only fixture and Tile workspaces, plus the example-policy check.Separate from the host-runtime changes in #1516, #1603 and #1604. Release integration #1613 remains pending the reported uniqueness race and launch-overhead analysis.