cuda: Linear with column-major weights gives wrong results
Author: crutcherCreated Jul 30, 2026Updated Sep 29, 2026
Labelsbugquestion
Describe the bug Divergent behavior versus all other backends on CUDA.
It appears (look at the body of the test) that Linear::forward when the weights have Col layout on cuda (on this build, at least) uses a broken kernel.
The attached test is a side-by-side versus flux; but you can use wgpu (or metal, though not on the same machine) and they all match the golden set.
My bunsen PR: https://github.com/zspacelabs/bunsen/pull/153
$ get checkout [email protected]:zspacelabs/bunsen.git
$ cd bunsen
$ cargo test --package bunsen --lib --features cuda -- kits::speech::silero_vad::cross_test::tests::backend_golden_crosstest --exact
Compiling bunsen v0.30.1 (/home/crutcher/git/bunsen/crates/bunsen)
Finished `test` profile [unoptimized + debuginfo] target(s) in 8.62s
Running unittests src/lib.rs (target/debug/deps/bunsen-38988ac2e73a0fdf)
running 1 test
test kits::speech::silero_vad::cross_test::tests::backend_golden_crosstest ... FAILED
failures:
---- kits::speech::silero_vad::cross_test::tests::backend_golden_crosstest stdout ----
unrolled::frame_features
unrolled::lstm_step::gates::features.forward
thread 'kits::speech::silero_vad::cross_test::tests::backend_golden_crosstest' (1298462) panicked at crates/bunsen/src/kits/speech/silero_vad/cross_test.rs:127:14:
Tensors are not approx eq:
=> Position 0: -1616.0963 != 1579.2357
diff (rel = +1.98e0, abs = +3.20e3), tol (rel = +5.00e-3, abs = +1.00e-5)
=> Position 1: 525.3915 != 847.7675
diff (rel = +3.80e-1, abs = +3.22e2), tol (rel = +5.00e-3, abs = +1.00e-5)
=> Position 2: -763.0256 != 1342.8739
diff (rel = +1.57e0, abs = +2.11e3), tol (rel = +5.00e-3, abs = +1.00e-5)
=> Position 3: -771.724 != 461.7889
diff (rel = +1.60e0, abs = +1.23e3), tol (rel = +5.00e-3, abs = +1.00e-5)
=> Position 4: -1615.7505 != -1121.3165
diff (rel = +3.06e-1, abs = +4.94e2), tol (rel = +5.00e-3, abs = +1.00e-5)
506 more errors...
note: run with `RUST_BACKTRACE=1` environment variable to display a backtraceDesktop (please complete the following information):
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.4 LTS
Release: 24.04
Codename: noble
$ nvidia-smi -L
GPU 0: NVIDIA GeForce RTX 3090 (UUID: GPU-1ba6fbf2-eea7-1e83-350d-9c9fa6ec4ae9)
GPU 1: NVIDIA GeForce RTX 3090 (UUID: GPU-a1fad247-10f8-5714-37c1-274af1a1f94a)
$ env | grep CUDA
CUDA_HOME=/usr/local/cuda-13.0
$ dpkg -l | grep nvidia
ii libnvidia-cfg1-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 Shared files used by the NVIDIA libraries
rc libnvidia-compute-580:amd64 580.159.03-1pop1~1777480649~24.04~5a62809~dev amd64 NVIDIA libcompute package
ii libnvidia-compute-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA libcompute package
ii libnvidia-compute-595:i386 595.71.05-1pop1~1778517566~24.04~dd7d311~dev i386 NVIDIA libcompute package
ii libnvidia-decode-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA Video Decoding runtime libraries
ii libnvidia-decode-595:i386 595.71.05-1pop1~1778517566~24.04~dd7d311~dev i386 NVIDIA Video Decoding runtime libraries
ii libnvidia-egl-wayland1:amd64 1:1.1.20-1pop1~1759419563~24.04~6d277c8~dev amd64 Wayland EGL External Platform library -- shared library
ii libnvidia-egl-wayland1:i386 1:1.1.20-1pop1~1759419563~24.04~6d277c8~dev i386 Wayland EGL External Platform library -- shared library
ii libnvidia-encode-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVENC Video Encoding runtime library
ii libnvidia-encode-595:i386 595.71.05-1pop1~1778517566~24.04~dd7d311~dev i386 NVENC Video Encoding runtime library
ii libnvidia-extra-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 Extra libraries for the NVIDIA driver
ii libnvidia-fbc1-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-fbc1-595:i386 595.71.05-1pop1~1778517566~24.04~dd7d311~dev i386 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-gl-595:amd64 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii libnvidia-gl-595:i386 595.71.05-1pop1~1778517566~24.04~dd7d311~dev i386 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii nvidia-compute-utils-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA compute utilities
rc nvidia-dkms-580 580.159.04-1ubuntu1 amd64 NVIDIA DKMS package
ii nvidia-dkms-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA DKMS package
ii nvidia-driver-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA driver metapackage
ii nvidia-firmware-595-595.71.05 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 Firmware files used by the kernel module
rc nvidia-kernel-common-580 580.159.04-1ubuntu1 amd64 Shared files used with the kernel module
ii nvidia-kernel-common-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 Shared files used with the kernel module
ii nvidia-kernel-source-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA kernel source package
rc nvidia-persistenced 595.71.05-1ubuntu1 amd64 daemon to maintain persistent software state in the NVIDIA driver
ii nvidia-settings 510.47.03-0ubuntu4.24.04.1 amd64 Tool for configuring the NVIDIA graphics driver
ii nvidia-utils-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA driver support binaries
ii screen-resolution-extra 0.18.3ubuntu0.24.04.1 all Extension for the nvidia-settings control panel
ii xserver-xorg-video-nvidia-595 595.71.05-1pop1~1778517566~24.04~dd7d311~dev amd64 NVIDIA binary Xorg driverSource: tracel-ai/burn