mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +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,142 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 83
|
||||
; 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 %S_atomic "S_atomic"
|
||||
OpMemberName %S_atomic 0 "x"
|
||||
OpMemberName %S_atomic 1 "a"
|
||||
OpMemberName %S_atomic 2 "y"
|
||||
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
|
||||
OpMemberDecorate %S_atomic 0 Offset 0
|
||||
OpMemberDecorate %S_atomic 1 Offset 4
|
||||
OpMemberDecorate %S_atomic 2 Offset 8
|
||||
OpDecorate %_arr_S_atomic_uint_10 ArrayStride 12
|
||||
%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
|
||||
%int = OpTypeInt 32 1
|
||||
%S_atomic = OpTypeStruct %int %uint %uint
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_S_atomic_uint_10 = OpTypeArray %S_atomic %uint_10
|
||||
%_ptr_Workgroup__arr_S_atomic_uint_10 = OpTypePointer Workgroup %_arr_S_atomic_uint_10
|
||||
%wg = OpVariable %_ptr_Workgroup__arr_S_atomic_uint_10 Workgroup
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void %uint
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Workgroup_int = OpTypePointer Workgroup %int
|
||||
%34 = OpConstantNull %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%int_4 = OpConstant %int 4
|
||||
%51 = OpTypeFunction %void
|
||||
%compute_main_inner = OpFunction %void None %13
|
||||
%local_invocation_index = OpFunctionParameter %uint
|
||||
%17 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_uint Function %6
|
||||
OpStore %idx %6
|
||||
OpStore %idx %local_invocation_index
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
OpLoopMerge %21 %22 None
|
||||
OpBranch %23
|
||||
%23 = OpLabel
|
||||
%24 = OpLoad %uint %idx
|
||||
%26 = OpULessThan %bool %24 %uint_10
|
||||
%25 = OpLogicalNot %bool %26
|
||||
OpSelectionMerge %28 None
|
||||
OpBranchConditional %25 %29 %28
|
||||
%29 = OpLabel
|
||||
OpBranch %21
|
||||
%28 = OpLabel
|
||||
%30 = OpLoad %uint %idx
|
||||
%33 = OpAccessChain %_ptr_Workgroup_int %wg %30 %uint_0
|
||||
OpStore %33 %34
|
||||
%40 = OpAccessChain %_ptr_Workgroup_uint %wg %30 %uint_1
|
||||
OpAtomicStore %40 %uint_2 %uint_0 %6
|
||||
%42 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %30 %uint_2
|
||||
OpStore %42 %6
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%43 = OpLoad %uint %idx
|
||||
%44 = OpIAdd %uint %43 %uint_1
|
||||
OpStore %idx %44
|
||||
OpBranch %20
|
||||
%21 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%50 = OpAccessChain %_ptr_Workgroup_uint %wg %int_4 %uint_1
|
||||
OpAtomicStore %50 %uint_2 %uint_0 %uint_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_1 = OpFunction %void None %51
|
||||
%53 = OpLabel
|
||||
%54 = OpLoad %uint %local_invocation_index_1
|
||||
%55 = OpFunctionCall %void %compute_main_inner %54
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_inner_1 = OpFunction %void None %13
|
||||
%local_invocation_index_1_param = OpFunctionParameter %uint
|
||||
%58 = OpLabel
|
||||
%idx_1 = OpVariable %_ptr_Function_uint Function %6
|
||||
OpStore %idx_1 %local_invocation_index_1_param
|
||||
OpBranch %60
|
||||
%60 = OpLabel
|
||||
OpLoopMerge %61 %62 None
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%65 = OpLoad %uint %idx_1
|
||||
%66 = OpULessThan %bool %65 %uint_10
|
||||
%64 = OpLogicalNot %bool %66
|
||||
OpSelectionMerge %67 None
|
||||
OpBranchConditional %64 %68 %67
|
||||
%68 = OpLabel
|
||||
OpBranch %61
|
||||
%67 = OpLabel
|
||||
%69 = OpLoad %uint %idx_1
|
||||
%70 = OpAccessChain %_ptr_Workgroup_int %wg %69 %uint_0
|
||||
OpStore %70 %34
|
||||
%73 = OpAccessChain %_ptr_Workgroup_uint %wg %69 %uint_1
|
||||
OpAtomicStore %73 %uint_2 %uint_0 %6
|
||||
%74 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %69 %uint_2
|
||||
OpStore %74 %6
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
%75 = OpLoad %uint %idx_1
|
||||
%76 = OpIAdd %uint %75 %uint_1
|
||||
OpStore %idx_1 %76
|
||||
OpBranch %60
|
||||
%61 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
OpStore %local_invocation_index_1 %local_invocation_index_1_param
|
||||
%78 = OpFunctionCall %void %compute_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %51
|
||||
%80 = OpLabel
|
||||
%82 = OpLoad %uint %local_invocation_index_1_param_1
|
||||
%81 = OpFunctionCall %void %compute_main_inner_1 %82
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user