Skip to content

Incorrect scalar-sparse matrix multiplication #3010

@albertomercurio

Description

@albertomercurio

Describe the bug

The scalar-matrix multiplication returns a wrong matrix after updating to v5.9.6

To reproduce

The Minimal Working Example (MWE) for this bug:

using SparseArrays, LinearAlgebra
using CUDA
using CUDA.CUSPARSE

A = spdiagm(1 => sqrt.(1:20))
# A = 20 * sprand(20, 20, 0.2) # this surprisingly works
dA = CuSparseMatrixCSC(A)

B = 0.1 * A
dB = 0.1 * dA

SparseMatrixCSC(dB) - B |> norm # 0.447213595499958
Manifest.toml

The file content was too big. I can upload it if necessary.

Expected behavior

A correct matrix

Version info

Details on Julia:

Julia Version 1.12.3
Commit 966d0af0fdf (2025-12-15 11:20 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900KF
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 16 default, 1 interactive, 16 GC (on 32 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1
  JULIA_NUM_THREADS = 16

Details on CUDA:

CUDA toolchain: 
- runtime 13.0, artifact installation
- driver 580.95.5 for 13.0
- compiler 13.1

CUDA libraries: 
- CUBLAS: 13.1.0
- CURAND: 10.4.0
- CUFFT: 12.0.0
- CUSOLVER: 12.0.4
- CUSPARSE: 12.6.3
- CUPTI: 2025.3.1 (API 13.0.1)
- NVML: 13.0.0+580.95.5

Julia packages: 
- CUDA: 5.9.6
- GPUArrays: 11.3.2
- GPUCompiler: 1.7.5
- KernelAbstractions: 0.9.39
- CUDA_Driver_jll: 13.1.0+0
- CUDA_Compiler_jll: 0.4.0+0
- CUDA_Runtime_jll: 0.19.2+0

Toolchain:
- Julia: 1.12.3
- LLVM: 18.1.7

1 device:
  0: NVIDIA GeForce RTX 4090 (sm_89, 20.744 GiB / 23.988 GiB available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions