Skip to content

[Bug] UnifiedMemory buffer changes during LinearAlgebra operations #2533

@kmp5VT

Description

@kmp5VT

Describe the bug

Linear algebra does not preserve buffer type.

To reproduce

The Minimal Working Example (MWE) for this bug:

using Pkg
Pkg.activate(temp=true)
Pkg.add("CUDA")
using CUDA
using LinearAlgebra
m = CuArray{Float64, 2, CUDA.UnifiedMemory}(rand(160,40))
USV = svd(m; alg=CUDA.CUSOLVER.QRAlgorithm())
@show typeof(USV.U)
  CuArray{Float64, 2, CUDA.DeviceMemory}
Manifest.toml

(jl_3A5ggZ) pkg> st
Status `/tmp/jl_3A5ggZ/Project.toml`
  [052768ef] CUDA v5.5.2

Expected behavior

The UnifiedMemory buffer should be preserved in the result of linear algebra.

Version info

Details on Julia:

julia> versioninfo()
Julia Version 1.11.0
Commit 501a4f25c2b (2024-10-07 11:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, cascadelake)
Threads: 1 default, 0 interactive, 1 GC (on 32 virtual cores)

Details on CUDA:

julia> CUDA.versioninfo()
CUDA runtime 12.6, artifact installation
CUDA driver 12.6
NVIDIA driver 550.107.2

CUDA libraries: 
- CUBLAS: 12.6.3
- CURAND: 10.3.7
- CUFFT: 11.3.0
- CUSOLVER: 11.7.1
- CUSPARSE: 12.5.4
- CUPTI: 2024.3.2 (API 24.0.0)
- NVML: 12.0.0+550.107.2

Julia packages: 
- CUDA: 5.5.2
- CUDA_Driver_jll: 0.10.3+0
- CUDA_Runtime_jll: 0.15.3+0

Toolchain:
- Julia: 1.11.0
- LLVM: 16.0.6

1 device:
  0: NVIDIA RTX A6000 (sm_86, 44.586 GiB / 47.988 GiB available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions