Skip to content

Commit bb2196b

Browse files
authored
Add SPV_EXT_image_raw10_raw12 reader support (#2113)
Add basic support for the SPV_EXT_image_raw10_raw12 extension [1] such that SPIR-V modules using the extension can be consumed. [1] https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/EXT/SPV_EXT_image_raw10_raw12.asciidoc
1 parent 3eeb3bf commit bb2196b

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

include/LLVMSPIRVExtensions.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
EXT(SPV_EXT_shader_atomic_float_add)
66
EXT(SPV_EXT_shader_atomic_float_min_max)
7+
EXT(SPV_EXT_image_raw10_raw12)
78
EXT(SPV_KHR_no_integer_wrap_decoration)
89
EXT(SPV_KHR_float_controls)
910
EXT(SPV_KHR_linkonce_odr)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
; REQUIRES: spirv-as
2+
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
3+
; RUN: spirv-val %t.spv
4+
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
5+
OpCapability Addresses
6+
OpCapability Linkage
7+
OpCapability Kernel
8+
OpCapability ImageBasic
9+
OpExtension "SPV_EXT_image_raw10_raw12"
10+
OpMemoryModel Physical32 OpenCL
11+
12+
OpDecorate %test_raw1012 LinkageAttributes "test_raw1012" Export
13+
OpDecorate %dst FuncParamAttr NoCapture
14+
OpDecorate %dst Alignment 4
15+
16+
%uint = OpTypeInt 32 0
17+
%uint_12 = OpConstant %uint 12
18+
%uint_10 = OpConstant %uint 10
19+
%uint_8 = OpConstant %uint 8
20+
%void = OpTypeVoid
21+
%_ptr_uint = OpTypePointer CrossWorkgroup %uint
22+
%5 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
23+
%6 = OpTypeFunction %void %_ptr_uint %5
24+
25+
%test_raw1012 = OpFunction %void None %6
26+
%dst = OpFunctionParameter %_ptr_uint
27+
%img = OpFunctionParameter %5
28+
%entry = OpLabel
29+
%15 = OpImageQueryFormat %uint %img
30+
OpSwitch %15 %sw_epilog 0 %sw_epilog_sink_split 19 %sw_bb1 20 %sw_bb2
31+
%sw_bb1 = OpLabel
32+
OpBranch %sw_epilog_sink_split
33+
%sw_bb2 = OpLabel
34+
OpBranch %sw_epilog_sink_split
35+
%sw_epilog_sink_split = OpLabel
36+
%_sink = OpPhi %uint %uint_12 %sw_bb2 %uint_10 %sw_bb1 %uint_8 %entry
37+
OpStore %dst %_sink Aligned 4
38+
OpBranch %sw_epilog
39+
%sw_epilog = OpLabel
40+
OpReturn
41+
OpFunctionEnd
42+
43+
; CHECK: %[[#datatype:]] = call spir_func i32 @_Z27get_image_channel_data_type14ocl_image2d_ro
44+
; CHECK-NEXT: %[[#sub:]] = sub i32 %[[#datatype]], 4304
45+
; CHECK-NEXT: switch i32 %[[#sub]]
46+
; CHECK-NEXT: i32 0, label
47+
; CHECK-NEXT: i32 19, label
48+
; CHECK-NEXT: i32 20, label

0 commit comments

Comments
 (0)