Skip to content

cooperative matrix shader failed on 8 elite gen5 #47

Description

@nihui

samsung galaxy s26
oneui 8.5
android 16
system vulkan driver 512.842.19

revert changes introduced in Tencent/ncnn#6719

./vkpeak fp16-matrix
[0 Adreno (TM) 840]  queueC=1[1]  queueT=0[4]  rebar=1  r-score=21
[0 Adreno (TM) 840]  fp16-p/s/u/a=1/1/0/1  int8-p/s/u/a=1/1/0/1  bf16-p/s=1/0
[0 Adreno (TM) 840]  subgroup=64(64~64)  ops=1/1/1/1/1/1/1/1/1/1
[0 Adreno (TM) 840]  fp16-cm=64x64x16/64x32x16/64x16x16  int8-cm=64x64x32/64x32x32/64x16x32  bf16-cm=0  fp8-cm=0
device       = Adreno (TM) 840
driver       = Qualcomm Technologies Inc. Adreno Vulkan Driver / Driver Build: bacff47b1e, I498f01ff61, 1763652273
Date: 11/20/25
Compiler Version: E031.50.19.13
Driver Branch: 

Layout[] Node:   %144 = call reassoc nnan ninf nsz arcp contract <64 x half> @llvm.qgpu.coopmat.layout.annotate.v64f16(i64 8, i32 64, i32 16, i32 undef, <64 x half> %77) nounwind: 
    adjacent Node: 
         %.03 = phi <64 x half> [ %77, %.lr.ph ], [ %149, %146 ]
         %145 = call reassoc nnan ninf nsz arcp contract <64 x half> @llvm.qgpu.coopmat.layout.annotate.v64f16(i64 9, i32 16, i32 64, i32 undef, <64 x half> %143) nounwind


vkCreateComputePipelines failed -13
new_pipeline failed
Layout[] Node:   %144 = call reassoc nnan ninf nsz arcp contract <64 x half> @llvm.qgpu.coopmat.layout.annotate.v64f16(i64 8, i32 64, i32 16, i32 undef, <64 x half> %77) nounwind: 
    adjacent Node: 
         %.05 = phi <64 x half> [ %77, %.lr.ph ], [ %191, %146 ]
         %.014 = phi <64 x half> [ %143, %.lr.ph ], [ %194, %146 ]
         %145 = call reassoc nnan ninf nsz arcp contract <64 x half> @llvm.qgpu.coopmat.layout.annotate.v64f16(i64 9, i32 16, i32 64, i32 undef, <64 x half> %143) nounwind


vkCreateComputePipelines failed -13
new_pipeline failed

can be reproduced with a more simple shader

#version 450

#extension GL_EXT_shader_explicit_arithmetic_types_float16: require
#extension GL_KHR_memory_scope_semantics: require
#extension GL_EXT_shader_explicit_arithmetic_types: require
#extension GL_KHR_cooperative_matrix: require

layout (constant_id = 0) const int loop = 1;
layout (constant_id = 1) const int M = 1;
layout (constant_id = 2) const int N = 1;
layout (constant_id = 3) const int K = 1;
layout (constant_id = 4) const int SCOPE = 3;

layout (binding = 0) writeonly buffer c_blob { float c_blob_data[]; };

void main()
{
    const uint gx = gl_GlobalInvocationID.x;
    const uint lx = gl_LocalInvocationID.x;

    coopmat<float16_t, SCOPE, M, K, gl_MatrixUseA> a = coopmat<float16_t, SCOPE, M, K, gl_MatrixUseA>(float(gx));
    coopmat<float16_t, SCOPE, K, N, gl_MatrixUseB> b = coopmat<float16_t, SCOPE, K, N, gl_MatrixUseB>(float(lx));

    coopmat<float16_t, SCOPE, M, N, gl_MatrixUseAccumulator> c = coopmat<float16_t, SCOPE, M, N, gl_MatrixUseAccumulator>(float(gx));

    for (int i = 0; i < loop; i++)
    {
        c = coopMatMulAdd(a, b, c);
    }

    coopMatStore(c, c_blob_data, 0, 0, gl_CooperativeMatrixLayoutRowMajor);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions