xref: /aosp_15_r20/external/skia/tests/sksl/compute/Workgroup.asm.comp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1               OpCapability Shader
2          %1 = OpExtInstImport "GLSL.std.450"
3               OpMemoryModel Logical GLSL450
4               OpEntryPoint GLCompute %main "main" %sk_GlobalInvocationID
5               OpExecutionMode %main LocalSize 256 1 1
6               OpName %inputs "inputs"
7               OpMemberName %inputs 0 "in_data"
8               OpName %outputs "outputs"
9               OpMemberName %outputs 0 "out_data"
10               OpName %sk_GlobalInvocationID "sk_GlobalInvocationID"
11               OpName %shared_data "shared_data"
12               OpName %store_vIf "store_vIf"
13               OpName %main "main"
14               OpName %id "id"
15               OpName %rd_id "rd_id"
16               OpName %wr_id "wr_id"
17               OpName %mask "mask"
18               OpName %step "step"
19               OpDecorate %_runtimearr_float ArrayStride 4
20               OpMemberDecorate %inputs 0 Offset 0
21               OpDecorate %inputs BufferBlock
22               OpDecorate %4 Binding 0
23               OpDecorate %4 DescriptorSet 0
24               OpMemberDecorate %outputs 0 Offset 0
25               OpDecorate %outputs BufferBlock
26               OpDecorate %9 Binding 1
27               OpDecorate %9 DescriptorSet 0
28               OpDecorate %sk_GlobalInvocationID BuiltIn GlobalInvocationId
29               OpDecorate %_arr_float_int_512 ArrayStride 16
30      %float = OpTypeFloat 32
31%_runtimearr_float = OpTypeRuntimeArray %float
32     %inputs = OpTypeStruct %_runtimearr_float
33%_ptr_Uniform_inputs = OpTypePointer Uniform %inputs
34          %4 = OpVariable %_ptr_Uniform_inputs Uniform
35    %outputs = OpTypeStruct %_runtimearr_float
36%_ptr_Uniform_outputs = OpTypePointer Uniform %outputs
37          %9 = OpVariable %_ptr_Uniform_outputs Uniform
38       %uint = OpTypeInt 32 0
39     %v3uint = OpTypeVector %uint 3
40%_ptr_Input_v3uint = OpTypePointer Input %v3uint
41%sk_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
42        %int = OpTypeInt 32 1
43    %int_512 = OpConstant %int 512
44%_arr_float_int_512 = OpTypeArray %float %int_512
45%_ptr_Workgroup__arr_float_int_512 = OpTypePointer Workgroup %_arr_float_int_512
46%shared_data = OpVariable %_ptr_Workgroup__arr_float_int_512 Workgroup
47       %void = OpTypeVoid
48%_ptr_Function_uint = OpTypePointer Function %uint
49%_ptr_Function_float = OpTypePointer Function %float
50         %24 = OpTypeFunction %void %_ptr_Function_uint %_ptr_Function_float
51%_ptr_Workgroup_float = OpTypePointer Workgroup %float
52         %32 = OpTypeFunction %void
53      %int_0 = OpConstant %int 0
54     %uint_2 = OpConstant %uint 2
55%_ptr_Uniform_float = OpTypePointer Uniform %float
56     %uint_1 = OpConstant %uint 1
57   %uint_264 = OpConstant %uint 264
58     %uint_0 = OpConstant %uint 0
59     %uint_9 = OpConstant %uint 9
60       %bool = OpTypeBool
61  %store_vIf = OpFunction %void None %24
62         %25 = OpFunctionParameter %_ptr_Function_uint
63         %26 = OpFunctionParameter %_ptr_Function_float
64         %27 = OpLabel
65         %28 = OpLoad %float %26
66         %29 = OpLoad %uint %25
67         %30 = OpAccessChain %_ptr_Workgroup_float %shared_data %29
68               OpStore %30 %28
69               OpReturn
70               OpFunctionEnd
71       %main = OpFunction %void None %32
72         %33 = OpLabel
73         %id = OpVariable %_ptr_Function_uint Function
74      %rd_id = OpVariable %_ptr_Function_uint Function
75      %wr_id = OpVariable %_ptr_Function_uint Function
76       %mask = OpVariable %_ptr_Function_uint Function
77       %step = OpVariable %_ptr_Function_uint Function
78         %85 = OpVariable %_ptr_Function_uint Function
79         %91 = OpVariable %_ptr_Function_float Function
80         %35 = OpLoad %v3uint %sk_GlobalInvocationID
81         %36 = OpCompositeExtract %uint %35 0
82               OpStore %id %36
83         %42 = OpIMul %uint %36 %uint_2
84         %43 = OpAccessChain %_ptr_Uniform_float %4 %int_0 %42
85         %45 = OpLoad %float %43
86         %46 = OpIMul %uint %36 %uint_2
87         %47 = OpAccessChain %_ptr_Workgroup_float %shared_data %46
88               OpStore %47 %45
89         %48 = OpLoad %uint %id
90         %49 = OpIMul %uint %48 %uint_2
91         %51 = OpIAdd %uint %49 %uint_1
92         %52 = OpAccessChain %_ptr_Uniform_float %4 %int_0 %51
93         %53 = OpLoad %float %52
94         %54 = OpLoad %uint %id
95         %55 = OpIMul %uint %54 %uint_2
96         %56 = OpIAdd %uint %55 %uint_1
97         %57 = OpAccessChain %_ptr_Workgroup_float %shared_data %56
98               OpStore %57 %53
99               OpControlBarrier %uint_2 %uint_2 %uint_264
100               OpStore %step %uint_0
101               OpBranch %62
102         %62 = OpLabel
103               OpLoopMerge %66 %65 None
104               OpBranch %63
105         %63 = OpLabel
106         %67 = OpLoad %uint %step
107         %69 = OpULessThan %bool %67 %uint_9
108               OpBranchConditional %69 %64 %66
109         %64 = OpLabel
110         %71 = OpLoad %uint %step
111         %72 = OpShiftLeftLogical %uint %uint_1 %71
112         %73 = OpISub %uint %72 %uint_1
113               OpStore %mask %73
114         %74 = OpLoad %uint %id
115         %75 = OpLoad %uint %step
116         %76 = OpShiftRightLogical %uint %74 %75
117         %77 = OpLoad %uint %step
118         %78 = OpIAdd %uint %77 %uint_1
119         %79 = OpShiftLeftLogical %uint %76 %78
120         %80 = OpIAdd %uint %79 %73
121               OpStore %rd_id %80
122         %81 = OpIAdd %uint %80 %uint_1
123         %82 = OpLoad %uint %id
124         %83 = OpBitwiseAnd %uint %82 %73
125         %84 = OpIAdd %uint %81 %83
126               OpStore %wr_id %84
127               OpStore %85 %84
128         %86 = OpAccessChain %_ptr_Workgroup_float %shared_data %84
129         %87 = OpLoad %float %86
130         %88 = OpAccessChain %_ptr_Workgroup_float %shared_data %80
131         %89 = OpLoad %float %88
132         %90 = OpFAdd %float %87 %89
133               OpStore %91 %90
134         %92 = OpFunctionCall %void %store_vIf %85 %91
135               OpControlBarrier %uint_2 %uint_2 %uint_264
136               OpBranch %65
137         %65 = OpLabel
138         %94 = OpLoad %uint %step
139         %95 = OpIAdd %uint %94 %uint_1
140               OpStore %step %95
141               OpBranch %62
142         %66 = OpLabel
143         %96 = OpLoad %uint %id
144         %97 = OpIMul %uint %96 %uint_2
145         %98 = OpAccessChain %_ptr_Workgroup_float %shared_data %97
146         %99 = OpLoad %float %98
147        %100 = OpLoad %uint %id
148        %101 = OpIMul %uint %100 %uint_2
149        %102 = OpAccessChain %_ptr_Uniform_float %9 %int_0 %101
150               OpStore %102 %99
151        %103 = OpLoad %uint %id
152        %104 = OpIMul %uint %103 %uint_2
153        %105 = OpIAdd %uint %104 %uint_1
154        %106 = OpAccessChain %_ptr_Workgroup_float %shared_data %105
155        %107 = OpLoad %float %106
156        %108 = OpLoad %uint %id
157        %109 = OpIMul %uint %108 %uint_2
158        %110 = OpIAdd %uint %109 %uint_1
159        %111 = OpAccessChain %_ptr_Uniform_float %9 %int_0 %110
160               OpStore %111 %107
161               OpReturn
162               OpFunctionEnd
163