Skip to content

opencl: keep half-precision matrix-vector products on the GEMM path - #3727

Draft
melonakos wants to merge 2 commits into
masterfrom
fix/3674-half-gemv
Draft

opencl: keep half-precision matrix-vector products on the GEMM path#3727
melonakos wants to merge 2 commits into
masterfrom
fix/3674-half-gemv

Conversation

@melonakos

@melonakos melonakos commented Sep 11, 2026

Copy link
Copy Markdown
Member

On OpenCL a fp16 matrix times a single column goes to CLBlast's half GEMV. With the same fp16 data the GEMM path is correct and the GEMV path is not, on an Intel Arc B580 (driver 32.0.101.8991) and a UHD 770 (32.0.101.7088), with the pinned CLBlast and with 1.7.0; that GEMV call is the one #3674's strided fp16 convolutions make when the unwrapped input is multiplied by the single-column filter. CLBlast#561 reports wrong half GEMV results on another vendor and may be related, but it is unresolved and its symptom differs. This keeps half inputs on the GEMM path and adds a random half matrix-vector test compared against f32.

Works around #3674 on the two Intel GPUs above: the ConvolveStrided cases that failed there now pass on repeat, and the blas and convolve suites pass. #3674 also reports the failure on NVIDIA and on the OpenCL CPU device, where this is not verified, so it does not close the issue.

CLBlast's f16 GEMV returns wrong values (CNugteren/CLBlast#561) while its GEMM
does not, so route half inputs through GEMM even when the right-hand side is a
single column. This is what produced NaNs in fp16 strided convolutions on
Intel GPUs. Adds a random half matrix-vector test checked against f32.

Fixes #3674
@melonakos melonakos changed the title Route half-precision GEMV through GEMM on OpenCL (fixes #3674) opencl: keep half-precision matrix-vector products on the GEMM path Sep 11, 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