nihui / vkpeak

A tool which profiles Vulkan devices to find their peak capacities
MIT License
99 stars 3 forks source link

Fix a typo in khr cooperative matrix shader #15

Closed GinShio closed 1 week ago

GinShio commented 3 months ago

I discovered the matrix shader have some issues under KHR. According to the glsl specification, operands of matrix multiplication must be same of the corresponding type.

The dimensions of A, B, and C, must form a valid matrix multiply (e.g. the number of columns of A must match the number of rows of B). A, B, and C must have the same scope. A's type must use gl_MatrixUseA. B's type must use gl_MatrixUseB. C's type must use gl_MatrixUseAccumulator. The type of the result matches the type of C.

This is not required for extensions under Nv. But glsl_fp16_matrix_khr_8_8_16_data is correct, I believe it's a typo.

GinShio commented 3 months ago

In master branch, 16x16x16 matrix shader is invalid:

spirv-val --target-env vulkan1.3 comp.spv
error: line 143: Cooperative matrix type must be B Type: CooperativeMatrixMulAddKHR
  %81 = OpCooperativeMatrixMulAddKHR %59 %78 %79 %80

After change, can pass spirv-val.

nihui commented 1 week ago

Thanks for your contribution !