Skip to content

Commit b654968

Browse files
committed
Remove redundant checks
1 parent adad03c commit b654968

File tree

3 files changed

+1
-22
lines changed

3 files changed

+1
-22
lines changed

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,18 +3047,6 @@ static uint32_t ggml_vk_guess_split_k(ggml_backend_vk_context * ctx, int m, int
30473047
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) {
30483048
VK_LOG_DEBUG("ggml_vk_guess_matmul_pipeline(" << m << ", " << n << ", " << aligned << ")");
30493049

3050-
// On F32 matmuls, selecting this way increases performance significantly. On quants or fp16, it reduces performance.
3051-
// Maybe because it reduces checks and uses more vector loads, but why is fp16 worse?
3052-
if (type_a == GGML_TYPE_F32) {
3053-
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)) {
3054-
return aligned ? mmp->a_l : mmp->l;
3055-
}
3056-
if ((ctx->device->mul_mat_m && (m % mmp->m->wg_denoms[0]) == 0 && (n % mmp->m->wg_denoms[1]) == 0) || !ctx->device->mul_mat_s) {
3057-
return aligned ? mmp->a_m : mmp->m;
3058-
}
3059-
return aligned ? mmp->a_s : mmp->s;
3060-
}
3061-
30623050
if ((ctx->device->mul_mat_s && (m <= 32 || n <= 32)) || (!ctx->device->mul_mat_m && !ctx->device->mul_mat_l)) {
30633051
return aligned ? mmp->a_s : mmp->s;
30643052
}
@@ -3102,7 +3090,7 @@ static vk_pipeline ggml_vk_guess_matmul_id_pipeline(ggml_backend_vk_context * ct
31023090
if ((ctx->device->mul_mat_id_s && (m <= 32 || n <= 32)) || (!ctx->device->mul_mat_id_m && !ctx->device->mul_mat_id_l)) {
31033091
return aligned ? mmp->a_s : mmp->s;
31043092
}
3105-
if ((ctx->device->mul_mat_id_m && (m <= 64 || n <= 64 || ctx->device->coopmat_support)) || !ctx->device->mul_mat_id_l) {
3093+
if ((ctx->device->mul_mat_id_m && (m <= 64 || n <= 64)) || !ctx->device->mul_mat_id_l) {
31063094
return aligned ? mmp->a_m : mmp->m;
31073095
}
31083096
return aligned ? mmp->a_l : mmp->l;

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,7 @@ 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
584-
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]);
585-
coopMatStore(cm_dtype, data_d, offsets + (dc + cm_col * TN) * p.stride_d + dr + cm_row * TM, p.stride_d, gl_CooperativeMatrixLayoutColumnMajor);
586-
#else
587583
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
589584
} else if (is_in_bounds) {
590585
// Full coopMat is within bounds, but stride_d is not aligned
591586
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 f16acc) {
292292
base_dict["ACC_TYPE"] = f16acc ? "float16_t" : "float";
293293
suffix += f16acc ? "_f16acc" : "";
294294

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

0 commit comments

Comments
 (0)