mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
tint: Add support for atomic ops to spirv reader
The following operations are supported: OpAtomicLoad OpAtomicStore OpAtomicExchange OpAtomicCompareExchange OpAtomicCompareExchangeWeak OpAtomicIIncrement OpAtomicIDecrement OpAtomicIAdd OpAtomicISub OpAtomicSMin OpAtomicUMin OpAtomicSMax OpAtomicUMax OpAtomicAnd OpAtomicOr OpAtomicXor These are not, but may be supported in the future: OpAtomicFlagTestAndSet OpAtomicFlagClear OpAtomicFMinEXT OpAtomicFMaxEXT OpAtomicFAddEXT Bug: tint:1441 Change-Id: Ifd53643b38d43664905a0dddfca609add4914670 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94121 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
57810d81d5
commit
268d7b8357
@@ -0,0 +1,140 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 90
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1_param_1
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %local_invocation_index_1_param_1 "local_invocation_index_1_param_1"
|
||||
OpName %local_invocation_index_1 "local_invocation_index_1"
|
||||
OpName %wg "wg"
|
||||
OpName %compute_main_inner "compute_main_inner"
|
||||
OpName %local_invocation_index "local_invocation_index"
|
||||
OpName %idx "idx"
|
||||
OpName %compute_main_1 "compute_main_1"
|
||||
OpName %compute_main_inner_1 "compute_main_inner_1"
|
||||
OpName %local_invocation_index_1_param "local_invocation_index_1_param"
|
||||
OpName %idx_1 "idx_1"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %local_invocation_index_1_param_1 BuiltIn LocalInvocationIndex
|
||||
OpDecorate %_arr_uint_uint_1 ArrayStride 4
|
||||
OpDecorate %_arr__arr_uint_uint_1_uint_2 ArrayStride 4
|
||||
OpDecorate %_arr__arr__arr_uint_uint_1_uint_2_uint_3 ArrayStride 8
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%local_invocation_index_1_param_1 = OpVariable %_ptr_Input_uint Input
|
||||
%_ptr_Private_uint = OpTypePointer Private %uint
|
||||
%6 = OpConstantNull %uint
|
||||
%local_invocation_index_1 = OpVariable %_ptr_Private_uint Private %6
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr__arr_uint_uint_1_uint_2 = OpTypeArray %_arr_uint_uint_1 %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypeArray %_arr__arr_uint_uint_1_uint_2 %uint_3
|
||||
%_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 = OpTypePointer Workgroup %_arr__arr__arr_uint_uint_1_uint_2_uint_3
|
||||
%wg = OpVariable %_ptr_Workgroup__arr__arr__arr_uint_uint_1_uint_2_uint_3 Workgroup
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void %uint
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%int = OpTypeInt 32 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_1 = OpConstant %int 1
|
||||
%53 = OpConstantNull %int
|
||||
%55 = OpTypeFunction %void
|
||||
%compute_main_inner = OpFunction %void None %15
|
||||
%local_invocation_index = OpFunctionParameter %uint
|
||||
%19 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_uint Function %6
|
||||
OpStore %idx %6
|
||||
OpStore %idx %local_invocation_index
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
OpLoopMerge %23 %24 None
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
%26 = OpLoad %uint %idx
|
||||
%29 = OpULessThan %bool %26 %uint_6
|
||||
%27 = OpLogicalNot %bool %29
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %27 %32 %31
|
||||
%32 = OpLabel
|
||||
OpBranch %23
|
||||
%31 = OpLabel
|
||||
%33 = OpLoad %uint %idx
|
||||
%34 = OpLoad %uint %idx
|
||||
%35 = OpLoad %uint %idx
|
||||
%39 = OpUDiv %uint %33 %uint_2
|
||||
%40 = OpUMod %uint %34 %uint_2
|
||||
%41 = OpUMod %uint %35 %uint_1
|
||||
%43 = OpAccessChain %_ptr_Workgroup_uint %wg %39 %40 %41
|
||||
OpAtomicStore %43 %uint_2 %uint_0 %6
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%44 = OpLoad %uint %idx
|
||||
%45 = OpIAdd %uint %44 %uint_1
|
||||
OpStore %idx %45
|
||||
OpBranch %22
|
||||
%23 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%54 = OpAccessChain %_ptr_Workgroup_uint %wg %int_2 %int_1 %53
|
||||
OpAtomicStore %54 %uint_2 %uint_0 %uint_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_1 = OpFunction %void None %55
|
||||
%57 = OpLabel
|
||||
%58 = OpLoad %uint %local_invocation_index_1
|
||||
%59 = OpFunctionCall %void %compute_main_inner %58
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_inner_1 = OpFunction %void None %15
|
||||
%local_invocation_index_1_param = OpFunctionParameter %uint
|
||||
%62 = OpLabel
|
||||
%idx_1 = OpVariable %_ptr_Function_uint Function %6
|
||||
OpStore %idx_1 %local_invocation_index_1_param
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
OpLoopMerge %65 %66 None
|
||||
OpBranch %67
|
||||
%67 = OpLabel
|
||||
%69 = OpLoad %uint %idx_1
|
||||
%70 = OpULessThan %bool %69 %uint_6
|
||||
%68 = OpLogicalNot %bool %70
|
||||
OpSelectionMerge %71 None
|
||||
OpBranchConditional %68 %72 %71
|
||||
%72 = OpLabel
|
||||
OpBranch %65
|
||||
%71 = OpLabel
|
||||
%73 = OpLoad %uint %idx_1
|
||||
%74 = OpUDiv %uint %73 %uint_2
|
||||
%75 = OpLoad %uint %idx_1
|
||||
%76 = OpUMod %uint %75 %uint_2
|
||||
%77 = OpLoad %uint %idx_1
|
||||
%78 = OpUMod %uint %77 %uint_1
|
||||
%81 = OpAccessChain %_ptr_Workgroup_uint %wg %74 %76 %78
|
||||
OpAtomicStore %81 %uint_2 %uint_0 %6
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
%82 = OpLoad %uint %idx_1
|
||||
%83 = OpIAdd %uint %82 %uint_1
|
||||
OpStore %idx_1 %83
|
||||
OpBranch %64
|
||||
%65 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
OpStore %local_invocation_index_1 %local_invocation_index_1_param
|
||||
%85 = OpFunctionCall %void %compute_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %55
|
||||
%87 = OpLabel
|
||||
%89 = OpLoad %uint %local_invocation_index_1_param_1
|
||||
%88 = OpFunctionCall %void %compute_main_inner_1 %89
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user