Skip to content

Commit 45c0e2e

Browse files
authored
Refactor Vulkan backend to allow multiple contexts (#7961)
* Refactor Vulkan backend to allow multiple contexts * Fix too many shader groups called validation error in llama3 on AMD and Intel GPUs * Fix Vulkan debug build error
1 parent b5a5f34 commit 45c0e2e

File tree

8 files changed

+20788
-20442
lines changed

8 files changed

+20788
-20442
lines changed

ggml-vulkan-shaders.hpp

Lines changed: 19771 additions & 19322 deletions
Large diffs are not rendered by default.

ggml-vulkan.cpp

Lines changed: 1011 additions & 1114 deletions
Large diffs are not rendered by default.

vulkan-shaders/mul_mat_vec.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ layout (constant_id = 0) const uint BLOCK_SIZE = 32;
1313
shared FLOAT_TYPE tmp[BLOCK_SIZE];
1414

1515
void main() {
16-
const uint row = gl_WorkGroupID.x;
16+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1717
const uint tid = gl_LocalInvocationID.x;
1818

1919
uint a_offset, b_offset, d_offset;

vulkan-shaders/mul_mat_vec_q2_k.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
77
shared FLOAT_TYPE tmp[32];
88

99
void main() {
10-
const uint row = gl_WorkGroupID.x;
10+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1111

1212
uint a_offset, b_offset, d_offset;
1313
get_offsets(a_offset, b_offset, d_offset);

vulkan-shaders/mul_mat_vec_q3_k.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
77
shared FLOAT_TYPE tmp[32];
88

99
void main() {
10-
const uint row = gl_WorkGroupID.x;
10+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1111

1212
uint a_offset, b_offset, d_offset;
1313
get_offsets(a_offset, b_offset, d_offset);

vulkan-shaders/mul_mat_vec_q4_k.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
77
shared FLOAT_TYPE tmp[32];
88

99
void main() {
10-
const uint row = gl_WorkGroupID.x;
10+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1111

1212
uint a_offset, b_offset, d_offset;
1313
get_offsets(a_offset, b_offset, d_offset);

vulkan-shaders/mul_mat_vec_q5_k.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
77
shared FLOAT_TYPE tmp[32];
88

99
void main() {
10-
const uint row = gl_WorkGroupID.x;
10+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1111

1212
uint a_offset, b_offset, d_offset;
1313
get_offsets(a_offset, b_offset, d_offset);

vulkan-shaders/mul_mat_vec_q6_k.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
77
shared FLOAT_TYPE tmp[32];
88

99
void main() {
10-
const uint row = gl_WorkGroupID.x;
10+
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
1111

1212
uint a_offset, b_offset, d_offset;
1313
get_offsets(a_offset, b_offset, d_offset);

0 commit comments

Comments
 (0)