Skip to content

Commit f54afb4

Browse files
committed
Remove redundant checks
1 parent 3a58a01 commit f54afb4

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,9 +3413,7 @@ static uint32_t ggml_vk_guess_split_k(ggml_backend_vk_context * ctx, int m, int
34133413
static vk_pipeline ggml_vk_guess_matmul_pipeline(ggml_backend_vk_context * ctx, vk_matmul_pipeline& mmp, int m, int n, bool aligned, ggml_type type_a) {
34143414
VK_LOG_DEBUG("ggml_vk_guess_matmul_pipeline(" << m << ", " << n << ", " << aligned << ")");
34153415

3416-
// On F32 matmuls, selecting this way increases performance significantly. On quants or fp16, it reduces performance.
3417-
// Maybe because it reduces checks and uses more vector loads, but why is fp16 worse?
3418-
if (ctx->device->coopmat2 || type_a == GGML_TYPE_F32) {
3416+
if (ctx->device->coopmat2) {
34193417
if ((ctx->device->mul_mat_l && (m % mmp->l->wg_denoms[0]) == 0 && (n & mmp->l->wg_denoms[1]) == 0) || (!ctx->device->mul_mat_m && !ctx->device->mul_mat_s)) {
34203418
return aligned ? mmp->a_l : mmp->l;
34213419
}
@@ -3468,7 +3466,7 @@ static vk_pipeline ggml_vk_guess_matmul_id_pipeline(ggml_backend_vk_context * ct
34683466
if ((ctx->device->mul_mat_id_s && (m <= 32 || n <= 32)) || (!ctx->device->mul_mat_id_m && !ctx->device->mul_mat_id_l)) {
34693467
return aligned ? mmp->a_s : mmp->s;
34703468
}
3471-
if ((ctx->device->mul_mat_id_m && (m <= 64 || n <= 64 || ctx->device->coopmat_support)) || !ctx->device->mul_mat_id_l) {
3469+
if ((ctx->device->mul_mat_id_m && (m <= 64 || n <= 64)) || !ctx->device->mul_mat_id_l) {
34723470
return aligned ? mmp->a_m : mmp->m;
34733471
}
34743472
return aligned ? mmp->a_l : mmp->l;

ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,8 @@ void main() {
580580

581581
if (is_aligned && is_in_bounds) {
582582
// Full coopMat is within bounds and stride_d is aligned with 16B
583-
#ifdef ACC_F16
584583
coopmat<D_TYPE, gl_ScopeSubgroup, TM, TN, gl_MatrixUseAccumulator> cm_dtype = coopmat<D_TYPE, gl_ScopeSubgroup, TM, TN, gl_MatrixUseAccumulator>(sums[cm_col * cms_per_row + cm_row]);
585584
coopMatStore(cm_dtype, data_d, offsets + (dc + cm_col * TN) * p.stride_d + dr + cm_row * TM, p.stride_d, gl_CooperativeMatrixLayoutColumnMajor);
586-
#else
587-
coopMatStore(sums[cm_col * cms_per_row + cm_row], data_d, offsets + (dc + cm_col * TN) * p.stride_d + dr + cm_row * TM, p.stride_d, gl_CooperativeMatrixLayoutColumnMajor);
588-
#endif
589585
} else if (is_in_bounds) {
590586
// Full coopMat is within bounds, but stride_d is not aligned
591587
coopMatStore(sums[cm_col * cms_per_row + cm_row], coopmat_stage, warp_i * TM * TN, TM, gl_CooperativeMatrixLayoutColumnMajor);

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,6 @@ void matmul_shaders(bool fp16, bool matmul_id, bool coopmat, bool coopmat2, bool
292292

293293
base_dict["ACC_TYPE"] = f16acc ? "float16_t" : "float";
294294

295-
if (f16acc) {
296-
base_dict["ACC_F16"] = "1";
297-
}
298-
299295
if (coopmat) {
300296
base_dict["COOPMAT"] = "1";
301297
}

0 commit comments

Comments
 (0)