Skip to content

Commit

Permalink
Update tint to use new single entry point path for SPIR-V
Browse files Browse the repository at this point in the history
Move the SPIR-V emission over to the new single entry point path.

Bug: 380043961
Change-Id: I7c441300453ee926dbc68ab2c8a0a54e3be9bec6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/217999
Reviewed-by: James Price <[email protected]>
  • Loading branch information
dj2 committed Dec 6, 2024
1 parent 892af22 commit d319ae7
Show file tree
Hide file tree
Showing 5,259 changed files with 584,265 additions and 196,896 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 3 additions & 10 deletions src/tint/cmd/tint/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ bool GenerateSpirv([[maybe_unused]] Options& options,
[[maybe_unused]] tint::inspector::Inspector& inspector,
[[maybe_unused]] tint::Program& src_program) {
#if TINT_BUILD_SPV_WRITER
auto res = ProcessASTTransformsOld(options, inspector, src_program);
auto res = ProcessASTTransforms(options, inspector, src_program);
if (res != tint::Success || !res->IsValid()) {
tint::cmd::PrintWGSL(std::cerr, res.Get());
std::cerr << res->Diagnostics() << "\n";
Expand Down Expand Up @@ -1341,7 +1341,8 @@ int main(int argc, const char** argv) {

if (options.format == Format::kNone || options.format == Format::kGlsl ||
options.format == Format::kHlsl || options.format == Format::kHlslFxc ||
options.format == Format::kMsl) {
options.format == Format::kMsl || options.format == Format::kSpirv ||
options.format == Format::kSpvAsm) {
auto generate = [&]() {
bool success = false;
switch (options.format) {
Expand Down Expand Up @@ -1422,12 +1423,9 @@ int main(int argc, const char** argv) {
return success ? 0 : 1;

} else {
bool success = false;
switch (options.format) {
case Format::kSpirv:
case Format::kSpvAsm:
success = GenerateSpirv(options, inspector, info.program);
break;
case Format::kMsl:
case Format::kHlsl:
case Format::kHlslFxc:
Expand All @@ -1439,10 +1437,5 @@ int main(int argc, const char** argv) {
std::cerr << "Unknown output format specified\n";
return 1;
}
if (!success) {
return 1;
}
}

return 0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 32
; Bound: 21
; Schema: 0
OpCapability Shader
OpCapability Float16
Expand All @@ -13,8 +13,6 @@
OpMemberName %m_block_std140 0 "inner_col0"
OpMemberName %m_block_std140 1 "inner_col1"
OpName %m_block_std140 "m_block_std140"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %l_m "l_m"
OpName %l_m_1 "l_m_1"
Expand All @@ -29,34 +27,20 @@
%m_block_std140 = OpTypeStruct %v2half %v2half
%_ptr_Uniform_m_block_std140 = OpTypePointer Uniform %m_block_std140
%1 = OpVariable %_ptr_Uniform_m_block_std140 Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%11 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%19 = OpTypeFunction %void
%8 = OpTypeFunction %void
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%mat2v2half = OpTypeMatrix %v2half 2
%i = OpFunction %int None %11
%12 = OpLabel
%13 = OpLoad %int %counter None
%14 = OpIAdd %int %13 %int_1
OpStore %counter %14 None
%16 = OpLoad %int %counter None
OpReturnValue %16
OpFunctionEnd
%f = OpFunction %void None %19
%20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0
%25 = OpLoad %v2half %21 None
%26 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_1
%28 = OpLoad %v2half %26 None
%l_m = OpCompositeConstruct %mat2v2half %25 %28
%f = OpFunction %void None %8
%9 = OpLabel
%10 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0
%14 = OpLoad %v2half %10 None
%15 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_1
%17 = OpLoad %v2half %15 None
%l_m = OpCompositeConstruct %mat2v2half %14 %17
%l_m_1 = OpCompositeExtract %v2half %l_m 1
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 32
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
Expand All @@ -10,8 +10,6 @@
OpMemberName %m_block_std140 0 "inner_col0"
OpMemberName %m_block_std140 1 "inner_col1"
OpName %m_block_std140 "m_block_std140"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %l_m "l_m"
OpName %l_m_1 "l_m_1"
Expand All @@ -26,34 +24,20 @@
%m_block_std140 = OpTypeStruct %v2float %v2float
%_ptr_Uniform_m_block_std140 = OpTypePointer Uniform %m_block_std140
%1 = OpVariable %_ptr_Uniform_m_block_std140 Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%11 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%19 = OpTypeFunction %void
%8 = OpTypeFunction %void
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%mat2v2float = OpTypeMatrix %v2float 2
%i = OpFunction %int None %11
%12 = OpLabel
%13 = OpLoad %int %counter None
%14 = OpIAdd %int %13 %int_1
OpStore %counter %14 None
%16 = OpLoad %int %counter None
OpReturnValue %16
OpFunctionEnd
%f = OpFunction %void None %19
%20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0
%25 = OpLoad %v2float %21 None
%26 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_1
%28 = OpLoad %v2float %26 None
%l_m = OpCompositeConstruct %mat2v2float %25 %28
%f = OpFunction %void None %8
%9 = OpLabel
%10 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0
%14 = OpLoad %v2float %10 None
%15 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_1
%17 = OpLoad %v2float %15 None
%l_m = OpCompositeConstruct %mat2v2float %14 %17
%l_m_1 = OpCompositeExtract %v2float %l_m 1
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 32
; Bound: 21
; Schema: 0
OpCapability Shader
OpCapability Float16
Expand All @@ -13,8 +13,6 @@
OpMemberName %m_block_std140 0 "inner_col0"
OpMemberName %m_block_std140 1 "inner_col1"
OpName %m_block_std140 "m_block_std140"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %l_m "l_m"
OpName %l_m_1 "l_m_1"
Expand All @@ -29,34 +27,20 @@
%m_block_std140 = OpTypeStruct %v3half %v3half
%_ptr_Uniform_m_block_std140 = OpTypePointer Uniform %m_block_std140
%1 = OpVariable %_ptr_Uniform_m_block_std140 Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%11 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%19 = OpTypeFunction %void
%8 = OpTypeFunction %void
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%mat2v3half = OpTypeMatrix %v3half 2
%i = OpFunction %int None %11
%12 = OpLabel
%13 = OpLoad %int %counter None
%14 = OpIAdd %int %13 %int_1
OpStore %counter %14 None
%16 = OpLoad %int %counter None
OpReturnValue %16
OpFunctionEnd
%f = OpFunction %void None %19
%20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0
%25 = OpLoad %v3half %21 None
%26 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_1
%28 = OpLoad %v3half %26 None
%l_m = OpCompositeConstruct %mat2v3half %25 %28
%f = OpFunction %void None %8
%9 = OpLabel
%10 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0
%14 = OpLoad %v3half %10 None
%15 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_1
%17 = OpLoad %v3half %15 None
%l_m = OpCompositeConstruct %mat2v3half %14 %17
%l_m_1 = OpCompositeExtract %v3half %l_m 1
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 32
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
Expand All @@ -10,8 +10,6 @@
OpMemberName %m_block_std140 0 "inner_col0"
OpMemberName %m_block_std140 1 "inner_col1"
OpName %m_block_std140 "m_block_std140"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %l_m "l_m"
OpName %l_m_1 "l_m_1"
Expand All @@ -26,34 +24,20 @@
%m_block_std140 = OpTypeStruct %v3float %v3float
%_ptr_Uniform_m_block_std140 = OpTypePointer Uniform %m_block_std140
%1 = OpVariable %_ptr_Uniform_m_block_std140 Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%11 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%19 = OpTypeFunction %void
%8 = OpTypeFunction %void
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%mat2v3float = OpTypeMatrix %v3float 2
%i = OpFunction %int None %11
%12 = OpLabel
%13 = OpLoad %int %counter None
%14 = OpIAdd %int %13 %int_1
OpStore %counter %14 None
%16 = OpLoad %int %counter None
OpReturnValue %16
OpFunctionEnd
%f = OpFunction %void None %19
%20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0
%25 = OpLoad %v3float %21 None
%26 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_1
%28 = OpLoad %v3float %26 None
%l_m = OpCompositeConstruct %mat2v3float %25 %28
%f = OpFunction %void None %8
%9 = OpLabel
%10 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0
%14 = OpLoad %v3float %10 None
%15 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_1
%17 = OpLoad %v3float %15 None
%l_m = OpCompositeConstruct %mat2v3float %14 %17
%l_m_1 = OpCompositeExtract %v3float %l_m 1
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 32
; Bound: 21
; Schema: 0
OpCapability Shader
OpCapability Float16
Expand All @@ -13,8 +13,6 @@
OpMemberName %m_block_std140 0 "inner_col0"
OpMemberName %m_block_std140 1 "inner_col1"
OpName %m_block_std140 "m_block_std140"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %l_m "l_m"
OpName %l_m_1 "l_m_1"
Expand All @@ -29,34 +27,20 @@
%m_block_std140 = OpTypeStruct %v4half %v4half
%_ptr_Uniform_m_block_std140 = OpTypePointer Uniform %m_block_std140
%1 = OpVariable %_ptr_Uniform_m_block_std140 Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%11 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%19 = OpTypeFunction %void
%8 = OpTypeFunction %void
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%mat2v4half = OpTypeMatrix %v4half 2
%i = OpFunction %int None %11
%12 = OpLabel
%13 = OpLoad %int %counter None
%14 = OpIAdd %int %13 %int_1
OpStore %counter %14 None
%16 = OpLoad %int %counter None
OpReturnValue %16
OpFunctionEnd
%f = OpFunction %void None %19
%20 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0
%25 = OpLoad %v4half %21 None
%26 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_1
%28 = OpLoad %v4half %26 None
%l_m = OpCompositeConstruct %mat2v4half %25 %28
%f = OpFunction %void None %8
%9 = OpLabel
%10 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0
%14 = OpLoad %v4half %10 None
%15 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_1
%17 = OpLoad %v4half %15 None
%l_m = OpCompositeConstruct %mat2v4half %14 %17
%l_m_1 = OpCompositeExtract %v4half %l_m 1
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 31
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpMemberName %m_block 0 "inner"
OpName %m_block "m_block"
OpName %counter "counter"
OpName %i "i"
OpName %f "f"
OpName %p_m "p_m"
OpName %p_m_1 "p_m_1"
Expand All @@ -29,29 +27,15 @@
%m_block = OpTypeStruct %mat2v4float
%_ptr_Uniform_m_block = OpTypePointer Uniform %m_block
%1 = OpVariable %_ptr_Uniform_m_block Uniform
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%int_0 = OpConstant %int 0
%counter = OpVariable %_ptr_Private_int Private %int_0
%12 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%20 = OpTypeFunction %void
%9 = OpTypeFunction %void
%_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%uint_1 = OpConstant %uint 1
%i = OpFunction %int None %12
%13 = OpLabel
%14 = OpLoad %int %counter None
%15 = OpIAdd %int %14 %int_1
OpStore %counter %15 None
%17 = OpLoad %int %counter None
OpReturnValue %17
OpFunctionEnd
%f = OpFunction %void None %20
%21 = OpLabel
%f = OpFunction %void None %9
%10 = OpLabel
%p_m = OpAccessChain %_ptr_Uniform_mat2v4float %1 %uint_0
%p_m_1 = OpAccessChain %_ptr_Uniform_v4float %p_m %uint_1
%l_m = OpLoad %mat2v4float %p_m None
Expand Down
Loading

0 comments on commit d319ae7

Please sign in to comment.