Skip to content

[NDTensors] Fix UndefVarError on CUDA.jl v6.0 in vendored extension#1728

Merged
mtfishman merged 2 commits into
mainfrom
mf/cuda-v6-vendored-tpa
Apr 26, 2026
Merged

[NDTensors] Fix UndefVarError on CUDA.jl v6.0 in vendored extension#1728
mtfishman merged 2 commits into
mainfrom
mf/cuda-v6-vendored-tpa

Conversation

@mtfishman

@mtfishman mtfishman commented Apr 26, 2026

Copy link
Copy Markdown
Member

CUDA.jl v6.0 refactored its module structure: default_memory moved from CUDA to CUDA.CUDACore. The vendored TypeParameterAccessors CUDA extension's reference to CUDA.default_memory therefore raises UndefVarError on 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_memory once at extension load via isdefined(CUDA, :default_memory), falling back to CUDA.CUDACore.default_memory on 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 from NDTensors/test/Project.toml, which had StridedViews = "0.4" (and cuTENSOR = "2"). CUDA v6 transitively requires StridedViews >= 0.5 via 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.

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

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.09%. Comparing base (3c3b448) to head (7f0bf05).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@mtfishman mtfishman merged commit e6d2480 into main Apr 26, 2026
18 checks passed
@mtfishman mtfishman deleted the mf/cuda-v6-vendored-tpa branch April 26, 2026 18:34
ipasichnyk pushed a commit to ipasichnyk/ITensors.jl that referenced this pull request May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant