Skip to content

LLM inference in C/C++

C++ ggml

vulkan: work around NV bug with argsort_large.comp (#28975)

Jeff Bolz4bc272fd729b
diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp b/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp
index b2df441374..f6a29be29a 100644
--- a/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp
+++ b/ggml/src/ggml-vulkan/vulkan-shaders/argsort_large.comp
@@ -27,6 +27,8 @@ layout (push_constant) uniform parameter {
uint inner_end;
} p;
+shared int s;
+
void argsort(bool needs_bounds_check, const uint row) {
// bitonic sort
int col = int(gl_GlobalInvocationID.x);
@@ -35,6 +37,12 @@ void argsort(bool needs_bounds_check, const uint row) {
const uint row_offset = row * p.ncols;
uint idx_offset = row * p.ncols_padded;
+ // workaround for NV driver/compiler bug - dummy use of shared memory
+ if (gl_LocalInvocationIndex == 0) {
+ s = 0;
+ col += s;
+ }
+
bool need_barrier = false;
// initialize indices