Squashed 'third_party/SPIRV-Tools/' changes from 8910ea5f1..fd773eb50
fd773eb50 Start SPIRV-Tools v2020.3
fd8e13051 Finalize SPIRV-Tools v2020.2
3ef8fe9a5 Update CHANGES
022da4d0e Fix identification of Vulkan images and buffers (#3253)
1346dd5de Disallow phis of images, samplers and sampled images (#3246)
1c8bda372 Add data structure for DebugScope, DebugDeclare in spirv-opt (#3183)
e6f372c5c Whitelist SPV_KHR_ray_tracing (#3241)
7f341ffee Make file formatting comply with POSIX standards (#3242)
60104cd97 Add opt::Operand::AsCString and AsString (#3240)
da52d0875 Add RayQueryProvisionalKHR to opt types (#3239)
18d3896a1 Whitelist SPV_EXT_demote_to_helper_invocation for opt passes (#3236)
5a97e3a39 Add support for KHR_ray_{query,tracing} extensions (#3235)
25ede1ced Roll external/spirv-headers/ 30ef660ce..a17e17e36 (1 commit) (#3230)
7a8f79762 Update dependencies (#3228)
1fe9bcc10 Instrument: Debug Printf support (#3215)
6428ad05e spirv-fuzz: Support OpPhi when adding dead break and continue (#3225)
1af1df3b2 spirv-fuzz: Fix vector width issue in 'add equation instructions' pass (#3223)
dd3d91691 Allow sampledimage types as operand of OpCopyObject (#3222)
7c3de218f spirv-fuzz: Remove duplicated functionality (#3220)
659470446 spirv-fuzz: Allow OpPhi operand to be replaced with a composite synonym (#3221)
4c027048d spirv-fuzz: Add toggle access chain instruction transformation (#3211)
533af4981 spirv-fuzz: Add fuzzer pass to permute function parameters (#3212)
da4cd2148 spirv-fuzz: Use better function name (#3207)
66a682b6a spirv-fuzz: Add swap commutable operands transformation (#3205)
044ecc0b2 spirv-fuzz: Fuzzer pass to add equation instructions (#3202)
a6d3a2dd4 Refactor FuzzerPass::ApplyTransformation code duplication. (#3206)
e1688b60c Avoid use of Python distutils.dir_util (#3203)
661e79eec Adding WebGPU specific Workgroup scope rule (#3204)
70f888131 Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
fb6e3e48d Combine extinst-name and extinst-output-base into one arg. (#3200)
git-subtree-dir: third_party/SPIRV-Tools
git-subtree-split: fd773eb50d628c1981338addc093df879757c2cf
diff --git a/source/opt/optimizer.cpp b/source/opt/optimizer.cpp
index 241aa75..0a937e8 100644
--- a/source/opt/optimizer.cpp
+++ b/source/opt/optimizer.cpp
@@ -425,6 +425,8 @@
RegisterPass(CreateConvertRelaxedToHalfPass());
} else if (pass_name == "relax-float-ops") {
RegisterPass(CreateRelaxFloatOpsPass());
+ } else if (pass_name == "inst-debug-printf") {
+ RegisterPass(CreateInstDebugPrintfPass(7, 23));
} else if (pass_name == "simplify-instructions") {
RegisterPass(CreateSimplificationPass());
} else if (pass_name == "ssa-rewrite") {
@@ -567,7 +569,12 @@
}
#ifndef NDEBUG
- if (status == opt::Pass::Status::SuccessWithoutChange) {
+ // We do not keep the result id of DebugScope in struct DebugScope.
+ // Instead, we assign random ids for them, which results in sanity
+ // check failures. We want to skip the sanity check when the module
+ // contains DebugScope instructions.
+ if (status == opt::Pass::Status::SuccessWithoutChange &&
+ !context->module()->ContainsDebugScope()) {
std::vector<uint32_t> optimized_binary_with_nop;
context->module()->ToBinary(&optimized_binary_with_nop,
/* skip_nop = */ false);
@@ -886,6 +893,12 @@
input_init_enable, version));
}
+Optimizer::PassToken CreateInstDebugPrintfPass(uint32_t desc_set,
+ uint32_t shader_id) {
+ return MakeUnique<Optimizer::PassToken::Impl>(
+ MakeUnique<opt::InstDebugPrintfPass>(desc_set, shader_id));
+}
+
Optimizer::PassToken CreateInstBuffAddrCheckPass(uint32_t desc_set,
uint32_t shader_id,
uint32_t version) {