Describe the bug
I can't mul!(::SubArray, ...).
To reproduce
The Minimal Working Example (MWE) for this bug:
using CUDA, CUDA.CUSPARSE
using LinearAlgebra
using SparseArrays
using Test
n = 100
A = sprandn(n, n, 2/n)
A = cu(A)
X = CUDA.randn(n, 2)
Y = CUDA.zeros(2n, 2)
Yv = @view Y[1:n, 1:2]
# Have the Y matrix be larger than Yv, such that Yv is non-contiguous.
# Only then we get an object of type SubArray in the end.
# See https://github.com/JuliaGPU/GPUArrays.jl/pull/704
@assert Yv isa SubArray
@testset "mul!(::Subarray, _, _)" begin
@test mul!(Yv, A, X) isa AbstractMatrix # scalar indexing
# These fail on Julia 1.12 but are fine on Julia 1.10:
@test mul!(Yv, I, X) isa AbstractMatrix # scalar indexing
@test mul!(Yv, 5, X) isa AbstractMatrix # scalar indexing
# See https://github.com/JuliaGPU/CUDA.jl/issues/3041#issuecomment-3996816271
end
Project.zip
Expected behavior
It should just work.
Version info
Julia 1.10.11
Julia Version 1.10.11
Commit a2b11907d7b (2026-03-09 14:59 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × Intel(R) Core(TM) Ultra 7 255H
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
JULIA_CPU_TARGET = goldmont
JULIA_PKG_PRECOMPILE_AUTO = 0
JULIA_PROJECT = @.
CUDA toolchain:
- runtime 13.3.0, artifact installation
- driver 595.84.0 for 13.3
- compiler 13.3.33, artifact installation
CUDA libraries:
- cuBLAS: 13.6.0
- cuSPARSE: 12.8.2
- cuSOLVER: 12.2.6
- cuFFT: 12.3.0
- cuRAND: 10.4.3
- CUPTI: 2026.2.1 (API 13.3.1)
- NVML: 13.0.0+595.84
Julia packages:
- CUDACore: 6.2.1
- GPUArrays: 11.5.10
- GPUCompiler: 1.23.0
- KernelAbstractions: 0.9.42
- CUDA_Driver_jll: 13.3.1+0
- CUDA_Compiler_jll: 0.4.4+1
- CUDA_Runtime_jll: 0.23.0+1
- NVPTX_LLVM_Backend_jll: 22.1.7+1
Toolchain:
- Julia: 1.10.11
- LLVM: 15.0.7
1 device:
0: NVIDIA RTX PRO 500 Blackwell Generation Laptop GPU (sm_120, 5.525 GiB / 5.970 GiB available)
compiles to sm_120a / PTX 9.3 (LLVM: sm_120a / PTX 9.0)
Julia 1.12.6
Julia Version 1.12.6
Commit 15346901f00 (2026-04-09 19:20 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × Intel(R) Core(TM) Ultra 7 255H
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, arrowlake)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)
Environment:
JULIA_CPU_TARGET = goldmont
JULIA_PKG_PRECOMPILE_AUTO = 0
JULIA_PROJECT = @.
CUDA toolchain:
- runtime 13.3.0, artifact installation
- driver 595.84.0 for 13.3
- compiler 13.3.33, artifact installation
CUDA libraries:
- cuBLAS: 13.6.0
- cuSPARSE: 12.8.2
- cuSOLVER: 12.2.6
- cuFFT: 12.3.0
- cuRAND: 10.4.3
- CUPTI: 2026.2.1 (API 13.3.1)
- NVML: 13.0.0+595.84
Julia packages:
- CUDACore: 6.2.1
- GPUArrays: 11.5.10
- GPUCompiler: 1.23.0
- KernelAbstractions: 0.9.42
- CUDA_Driver_jll: 13.3.1+0
- CUDA_Compiler_jll: 0.4.4+1
- CUDA_Runtime_jll: 0.23.0+1
- NVPTX_LLVM_Backend_jll: 22.1.7+1
Toolchain:
- Julia: 1.12.6
- LLVM: 18.1.7
1 device:
0: NVIDIA RTX PRO 500 Blackwell Generation Laptop GPU (sm_120, 5.525 GiB / 5.970 GiB available)
compiles to sm_120a / PTX 9.3 (LLVM: sm_120a / PTX 9.0)
Describe the bug
I can't
mul!(::SubArray, ...).To reproduce
The Minimal Working Example (MWE) for this bug:
Project.zip
Expected behavior
It should just work.
Version info
Julia 1.10.11
Julia 1.12.6