whisper.cpp/ggml/src
Salvatore Mesoraca 845f8d663e vulkan : mul_mat: fix UB with small warps (ggml/952)
When the device's warp size is less than 16,
it is possible for loadstride_a (mul_mm.comp:114)
and loadstride_b (mul_mm.comp:115) to be set to 0.
Because they are calculated as: the workgroup size,
multiplied by LOAD_VEC_* (which can be 1) and divided by 16.
And the workgroup size is set to be the same as the
warp/subgroup size.

The loadstride_* variables are used as increments in the
loops that populate the buffers used for the multiplication.

When they are 0 they cause an infinite loop.
But infinite loops without side-effects are UB and the
values of loadstride_* are known at compile time.
So, the compiler quietly optimizes all the loops away.
As a consequence, the buffers are not populated and
the multiplication result is just a matrix with all elements
set to 0.

We prevent the UB by making sure that the workgroup size
will never be less than 16, even if our device has a
smaller warp size (e.g. 8).

Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
2024-10-03 12:22:17 +03:00
..
ggml-cann cann: fix crash when llama-bench is running on multiple cann devices (llama/9627) 2024-10-03 12:22:17 +03:00
ggml-cuda CUDA: remove bad assert (ggml/972) 2024-10-03 12:22:17 +03:00
ggml-sycl Revert "[SYCL] fallback mmvq (ggml/9088)" (llama/9579) 2024-09-24 19:45:08 +03:00
kompute-shaders whisper : reorganize source code + improve CMake (#2256) 2024-06-26 19:34:09 +03:00
vulkan-shaders vulkan : argsort barriers must be under uniform control flow (ggml/951) 2024-10-03 12:22:17 +03:00
CMakeLists.txt ggml : add AVX512DQ requirement for AVX512 builds (llama/9622) 2024-09-24 19:45:08 +03:00
ggml-aarch64.c ggml : add run-time detection of neon, i8mm and sve (llama/9331) 2024-10-03 12:22:17 +03:00
ggml-aarch64.h ggml : add ggml-aarch64 (ggml/0) 2024-08-08 22:48:46 +03:00
ggml-alloc.c ggml-alloc : fix list of allocated tensors with GGML_ALLOCATOR_DEBUG (llama/9573) 2024-09-24 19:45:08 +03:00
ggml-backend-impl.h ggml/examples: add backend support for numerical optimization (ggml/949) 2024-09-24 19:45:08 +03:00
ggml-backend.c ggml : fix trailing whitespace (llama/0) 2024-09-24 19:45:08 +03:00
ggml-blas.cpp ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-cann.cpp ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-common.h ggml-quants : ternary packing for TriLMs and BitNet b1.58 (llama/8151) 2024-09-24 19:45:08 +03:00
ggml-cpu-impl.h ggml : add ggml-cpu-impl.h (skip) (#0) 2024-09-24 19:45:08 +03:00
ggml-cuda.cu mtgpu: enable VMM (llama/9597) 2024-10-03 12:22:17 +03:00
ggml-impl.h ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-kompute.cpp ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-metal.m ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-metal.metal metal : use F32 prec for K*Q in vec FA (llama/9595) 2024-09-24 19:45:08 +03:00
ggml-quants.c ggml : add run-time detection of neon, i8mm and sve (llama/9331) 2024-10-03 12:22:17 +03:00
ggml-quants.h ggml : add run-time detection of neon, i8mm and sve (llama/9331) 2024-10-03 12:22:17 +03:00
ggml-rpc.cpp ggml : refactoring (llama/#0) 2024-09-24 19:45:08 +03:00
ggml-sycl.cpp Revert "[SYCL] fallback mmvq (ggml/9088)" (llama/9579) 2024-09-24 19:45:08 +03:00
ggml-vulkan.cpp vulkan : mul_mat: fix UB with small warps (ggml/952) 2024-10-03 12:22:17 +03:00
ggml.c ggml : fix ggml_cast (ggml/973) 2024-10-03 12:22:17 +03:00
sgemm.cpp whisper : reorganize source code + improve CMake (#2256) 2024-06-26 19:34:09 +03:00
sgemm.h whisper : reorganize source code + improve CMake (#2256) 2024-06-26 19:34:09 +03:00