File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -5097,15 +5097,22 @@ static vk_matmul_pipeline ggml_vk_get_mul_mat_mat_id_pipeline(ggml_backend_vk_co
50975097
50985098 // XXX TODO 'prec' is not actually allowed in mul_mat_id.
50995099 bool prefer_fp16acc = ctx->device->fp16 /*&& prec == GGML_PREC_DEFAULT*/;
5100- bool support_fp16acc = ctx->device->pipeline_dequant_mul_mat_mat_id[src0_type].f16acc != nullptr;
5101- bool support_fp32acc = ctx->device->pipeline_dequant_mul_mat_mat_id[src0_type].f32acc != nullptr;
5102-
5103- if (support_fp16acc && (prefer_fp16acc || !support_fp32acc)) {
5104- return ctx->device->pipeline_dequant_mul_mat_mat_id[src0_type].f16acc;
5105- } else {
5106- GGML_ASSERT(support_fp32acc);
5107- return ctx->device->pipeline_dequant_mul_mat_mat_id[src0_type].f32acc;
5100+ auto& mmp = ctx->device->pipeline_dequant_mul_mat_mat_id[src0_type];
5101+ if (ctx->device->coopmat_support) {
5102+ // coopmat may or may not have f16acc and f32acc. It may also lack some child pipelines
5103+ if (ctx->device->coopmat_acc_f16_support && prefer_fp16acc) {
5104+ return mmp.f16acc;
5105+ } else if (ctx->device->coopmat_acc_f32_support) {
5106+ return mmp.f32acc;
5107+ } else {
5108+ // No supported pipeline
5109+ return nullptr;
5110+ }
51085111 }
5112+ // coopmat2 or no coopmat.
5113+ // coopmat2 should support both f16acc and f32acc by default with all child pipelines.
5114+ // No coopmat should support both f16acc and f32acc when FP16 is preferred, but only f32acc when not preferred.
5115+ return prefer_fp16acc ? mmp.f16acc : mmp.f32acc;
51095116}
51105117
51115118static vk_pipeline ggml_vk_get_dequantize_mul_mat_vec_id(ggml_backend_vk_context * ctx, ggml_type a_type, ggml_type b_type) {
You can’t perform that action at this time.
0 commit comments