-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport to 19] SPIRVReader: handle direct types with CooperativeMat…
…rixLengthKHR (#2695) (#2707) Translation of the attached test would currently fail due to the SPIRVReader attempting to process the `%matTy` operand as a regular value instead of a type. `OpCooperativeMatrixLengthKHR` seems to be pretty unique in taking an additional type operand beyond the result type, so special-case it in the reader. The translator currently accepts a non-type operand for `OpCooperativeMatrixLengthKHR` too, even though that's not within the specification; see various TODOs in the existing SPV_KHR_cooperative_matrix tests. Leave that relaxation in place, by only translating the operand as a type when it is an `OpTypeCooperativeMatrixKHR`. (cherry picked from commit 2b5f15d)
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/extensions/KHR/SPV_KHR_cooperative_matrix/length.spvasm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s | ||
; RUN: spirv-val %t.spv | ||
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s | ||
|
||
OpCapability Addresses | ||
OpCapability Kernel | ||
OpCapability CooperativeMatrixKHR | ||
OpExtension "SPV_KHR_cooperative_matrix" | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %1 "testCoopMat" | ||
%void = OpTypeVoid | ||
%float = OpTypeFloat 32 | ||
%fnTy = OpTypeFunction %void | ||
%uint = OpTypeInt 32 0 | ||
%uint_3 = OpConstant %uint 3 | ||
%uint_0 = OpConstant %uint 0 | ||
%uint_8 = OpConstant %uint 8 | ||
%matTy = OpTypeCooperativeMatrixKHR %float %uint_3 %uint_8 %uint_8 %uint_0 | ||
%1 = OpFunction %void None %fnTy | ||
%2 = OpLabel | ||
%3 = OpCooperativeMatrixLengthKHR %uint %matTy | ||
OpReturn | ||
OpFunctionEnd | ||
|
||
; CHECK: call spir_func i32 @_Z34__spirv_CooperativeMatrixLengthKHRPU3AS143__spirv_CooperativeMatrixKHR__float_3_8_8_0(target("spirv.CooperativeMatrixKHR", float, 3, 8, 8, 0) zeroinitializer) |