[NDTensors] Fix UndefVarError on CUDA.jl v6.0 in vendored extension#1728
Merged
Conversation
CUDA.jl v6.0 refactored its module structure and moved `default_memory` from `CUDA` to `CUDA.CUDACore`, which broke the vendored TypeParameterAccessors CUDA extension at load time on every downstream that pairs NDTensors with CUDA v6.0. Apply the same back-compat shim as the registered TypeParameterAccessors fix: resolve `default_memory` once via `isdefined(CUDA, ...)` so the extension keeps working with CUDA.jl v5 (`CUDA.default_memory`) and v6 (`CUDA.CUDACore.default_memory`). Bump NDTensors to 0.4.26.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1728 +/- ##
=======================================
Coverage 81.09% 81.09%
=======================================
Files 59 59
Lines 4676 4676
=======================================
Hits 3792 3792
Misses 884 884 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The package-level compat for these weakdeps was bumped earlier
(StridedViews to "0.2.2, 0.3, 0.4, 0.5" and cuTENSOR to "2, 6"),
but `test/Project.toml` was not updated. The test sandbox
inherits its compat constraints from `test/Project.toml`, so
`Pkg.add("CUDA")` in the GPU CI test path could not resolve to
CUDA.jl v6 — CUDA v6 transitively requires StridedViews >= 0.5
via the StridedViews CUDA extension, and the old
`StridedViews = "0.4"` cap forced the resolver back to CUDA v5.x.
Result: every CompatHelper bump for CUDA / cuTENSOR has shipped
without ever exercising the new declared range under CI. The
v6.0 `default_memory` regression (#124) was never observable in
GPU CI for that reason.
Mirror the package-level compat ranges into `test/Project.toml`
so the Jenkins GPU stage actually resolves to CUDA v6.0 and
verifies the back-compat shim in this PR.
ipasichnyk
pushed a commit
to ipasichnyk/ITensors.jl
that referenced
this pull request
May 25, 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.
CUDA.jl v6.0 refactored its module structure:
default_memorymoved fromCUDAtoCUDA.CUDACore. The vendored TypeParameterAccessors CUDA extension's reference toCUDA.default_memorytherefore raisesUndefVarErroron every downstream that pairs NDTensors with CUDA v6.0.This applies the same back-compat shim as the upstream TypeParameterAccessors fix (ITensor/TypeParameterAccessors.jl#125): resolve
default_memoryonce at extension load viaisdefined(CUDA, :default_memory), falling back toCUDA.CUDACore.default_memoryon CUDA.jl v6+.Patch bump: NDTensors 0.4.25 → 0.4.26.
Why GPU CI did not catch this
The Jenkins GPU stage runs
Pkg.test("NDTensors"; test_args=["cuda"])on a V100, which adds CUDA into the test sandbox. The earlier CompatHelper bump for[compat] CUDA = "5, 6"(#1724) merged green because the test sandbox inherits its compat fromNDTensors/test/Project.toml, which hadStridedViews = "0.4"(andcuTENSOR = "2"). CUDA v6 transitively requiresStridedViews >= 0.5via the StridedViews CUDA extension, so the resolver had no choice but to install CUDA v5.x — every CompatHelper bump for CUDA / cuTENSOR has merged without GPU CI ever actually exercising the new declared range.This PR therefore also bumps the corresponding
test/Project.toml [compat]entries (StridedViews = "0.4, 0.5",cuTENSOR = "2, 6") so the Jenkins sandbox can resolve to CUDA v6.0 and actually verify the back-compat shim above.Locally reproduced: develop NDTensors at this branch into a fresh env, mirror the test sandbox compat caps,
Pkg.add("CUDA")resolves to v6.0.0; without the StridedViews bump, the resolver falls back to v5.11.x.