fix cm2 spec constants

This commit is contained in:
Ruben Ortlam
2026-07-16 07:33:11 +02:00
parent 000651caaa
commit 4c58939adb
2 changed files with 17 additions and 20 deletions

View File

@@ -4365,9 +4365,7 @@ static void ggml_vk_load_shaders(vk_device& device, vk_pipeline requested) {
if (device->coopmat2) {
auto const &ggml_vk_mul_mm_cm2_spec = [&](std::vector<uint32_t> spec, bool aligned, bool mul_mat_id, uint32_t type = UINT32_MAX) {
spec.push_back(aligned ? 1u : 0u); // ALIGNED
if (mul_mat_id) {
spec.push_back(device->subgroup_size); // subgroup_size
}
spec.push_back(device->subgroup_size); // subgroup_size
if (type != UINT32_MAX) {
spec.push_back(type); // MmTypeA
}

View File

@@ -23,12 +23,26 @@
#include "types.glsl"
#include "utils.glsl"
#include "ggml_type_ids.glsl"
layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in;
#define IS_MUL_MM2 1
layout (constant_id = 0) const uint BLOCK_SIZE = 256;
layout (constant_id = 1) const uint BM = 64;
layout (constant_id = 2) const uint BN = 64;
layout (constant_id = 3) const uint BK = 16; // Assumed to be 32 if working with a quant
layout (constant_id = 4) const bool enable_smaller_matrices = false;
const uint BNover2 = enable_smaller_matrices ? (BN / 2) : BN;
const uint BNover4 = enable_smaller_matrices ? (BN / 4) : BN;
layout (constant_id = 5) const uint ALIGNED = 0;
layout (constant_id = 6) const uint subgroup_size = 32;
#ifdef MULMAT_QUANT
layout (constant_id = 7) const uint MmTypeA = 0;
#include "ggml_type_ids.glsl"
uint mm_quant_k() {
switch (MmTypeA) {
case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: case GGML_TYPE_Q5_0: case GGML_TYPE_Q5_1:
@@ -44,20 +58,6 @@ uint mm_quant_k() {
}
#endif
layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in;
#define IS_MUL_MM2 1
layout (constant_id = 0) const uint BLOCK_SIZE = 256;
layout (constant_id = 1) const uint BM = 64;
layout (constant_id = 2) const uint BN = 64;
layout (constant_id = 3) const uint BK = 16; // Assumed to be 32 if working with a quant
layout (constant_id = 4) const bool enable_smaller_matrices = false;
const uint BNover2 = enable_smaller_matrices ? (BN / 2) : BN;
const uint BNover4 = enable_smaller_matrices ? (BN / 4) : BN;
layout (constant_id = 5) const uint ALIGNED = 0;
layout (push_constant) uniform parameter
{
uint M;
@@ -192,7 +192,6 @@ layout(buffer_reference, std430, buffer_reference_align = 2) buffer decodeBufB {
};
uint _ne1;
layout (constant_id = 6) const uint subgroup_size = 32;
shared uvec4 ballots_sh[BLOCK_SIZE / subgroup_size];
B_TYPE decodeFuncB(const in decodeBufB bl, const in uint blockCoords[2], const in uint coordInBlock[2])