Skip to content

Commit

Permalink
Refactor Vulkan backend to allow multiple contexts (#7961)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
0cc4m authored Jun 23, 2024
1 parent b5a5f34 commit 45c0e2e
Show file tree
Hide file tree
Showing 8 changed files with 20,788 additions and 20,442 deletions.
39,093 changes: 19,771 additions & 19,322 deletions ggml-vulkan-shaders.hpp

Large diffs are not rendered by default.

2,125 changes: 1,011 additions & 1,114 deletions ggml-vulkan.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec.comp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ layout (constant_id = 0) const uint BLOCK_SIZE = 32;
shared FLOAT_TYPE tmp[BLOCK_SIZE];

void main() {
const uint row = gl_WorkGroupID.x;
const uint row = gl_WorkGroupID.x + gl_NumWorkGroups.x * gl_WorkGroupID.z;
const uint tid = gl_LocalInvocationID.x;

uint a_offset, b_offset, d_offset;
Expand Down
2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec_q2_k.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
shared FLOAT_TYPE tmp[32];

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

uint a_offset, b_offset, d_offset;
get_offsets(a_offset, b_offset, d_offset);
Expand Down
2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec_q3_k.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
shared FLOAT_TYPE tmp[32];

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

uint a_offset, b_offset, d_offset;
get_offsets(a_offset, b_offset, d_offset);
Expand Down
2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec_q4_k.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
shared FLOAT_TYPE tmp[32];

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

uint a_offset, b_offset, d_offset;
get_offsets(a_offset, b_offset, d_offset);
Expand Down
2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec_q5_k.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
shared FLOAT_TYPE tmp[32];

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

uint a_offset, b_offset, d_offset;
get_offsets(a_offset, b_offset, d_offset);
Expand Down
2 changes: 1 addition & 1 deletion vulkan-shaders/mul_mat_vec_q6_k.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
shared FLOAT_TYPE tmp[32];

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

uint a_offset, b_offset, d_offset;
get_offsets(a_offset, b_offset, d_offset);
Expand Down

0 comments on commit 45c0e2e

Please sign in to comment.