From d01e6e8b1236538ad5c9a0058fe0d718160efefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 15 Jan 2022 18:02:30 -0800 Subject: [PATCH] Updated spirv-tools. --- .../include/generated/build-version.inc | 2 +- 3rdparty/spirv-tools/source/binary.cpp | 2 +- 3rdparty/spirv-tools/source/cfa.h | 2 +- .../spirv-tools/source/opt/dead_branch_elim_pass.h | 2 +- 3rdparty/spirv-tools/source/opt/desc_sroa.h | 2 +- 3rdparty/spirv-tools/source/opt/dominator_tree.h | 2 +- 3rdparty/spirv-tools/source/opt/loop_fission.cpp | 2 +- 3rdparty/spirv-tools/source/opt/pass_manager.cpp | 14 +++++++++++--- .../spirv-tools/source/opt/register_pressure.cpp | 2 +- .../source/opt/scalar_analysis_simplification.cpp | 2 +- .../source/opt/strength_reduction_pass.h | 2 +- 3rdparty/spirv-tools/source/opt/types.cpp | 1 - 3rdparty/spirv-tools/source/val/validate.cpp | 2 +- .../spirv-tools/source/val/validate_memory.cpp | 2 +- 14 files changed, 23 insertions(+), 16 deletions(-) diff --git a/3rdparty/spirv-tools/include/generated/build-version.inc b/3rdparty/spirv-tools/include/generated/build-version.inc index 85a266711..d14a7da24 100644 --- a/3rdparty/spirv-tools/include/generated/build-version.inc +++ b/3rdparty/spirv-tools/include/generated/build-version.inc @@ -1 +1 @@ -"v2021.5-dev", "SPIRV-Tools v2021.5-dev ad6abbd669261cf3728d71e263d5d16f6c5f2b22" +"v2021.5-dev", "SPIRV-Tools v2021.5-dev 4581f14cd481bad1e0d6292f0dd0a6e298c2ee18" diff --git a/3rdparty/spirv-tools/source/binary.cpp b/3rdparty/spirv-tools/source/binary.cpp index 48a94f1ee..bbaa2c2c7 100644 --- a/3rdparty/spirv-tools/source/binary.cpp +++ b/3rdparty/spirv-tools/source/binary.cpp @@ -300,7 +300,7 @@ spv_result_t Parser::parseInstruction() { const uint32_t first_word = peek(); // If the module's endianness is different from the host native endianness, - // then converted_words contains the the endian-translated words in the + // then converted_words contains the endian-translated words in the // instruction. _.endian_converted_words.clear(); _.endian_converted_words.push_back(first_word); diff --git a/3rdparty/spirv-tools/source/cfa.h b/3rdparty/spirv-tools/source/cfa.h index 0d09014c9..7cadf55f0 100644 --- a/3rdparty/spirv-tools/source/cfa.h +++ b/3rdparty/spirv-tools/source/cfa.h @@ -42,7 +42,7 @@ class CFA { /// Returns true if a block with @p id is found in the @p work_list vector /// - /// @param[in] work_list Set of blocks visited in the the depth first + /// @param[in] work_list Set of blocks visited in the depth first /// traversal /// of the CFG /// @param[in] id The ID of the block being checked diff --git a/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h b/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h index 7841bc470..c350bb2f0 100644 --- a/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h +++ b/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h @@ -98,7 +98,7 @@ class DeadBranchElimPass : public MemPass { // Fix phis in reachable blocks so that only live (or unremovable) incoming // edges are present. If the block now only has a single live incoming edge, // remove the phi and replace its uses with its data input. If the single - // remaining incoming edge is from the phi itself, the the phi is in an + // remaining incoming edge is from the phi itself, the phi is in an // unreachable single block loop. Either the block is dead and will be // removed, or it's reachable from an unreachable continue target. In the // latter case that continue target block will be collapsed into a block that diff --git a/3rdparty/spirv-tools/source/opt/desc_sroa.h b/3rdparty/spirv-tools/source/opt/desc_sroa.h index 383d441c0..6a24fd871 100644 --- a/3rdparty/spirv-tools/source/opt/desc_sroa.h +++ b/3rdparty/spirv-tools/source/opt/desc_sroa.h @@ -132,7 +132,7 @@ class DescriptorScalarReplacement : public Pass { // A map from an OpVariable instruction to the set of variables that will be // used to replace it. The entry |replacement_variables_[var][i]| is the id of - // a variable that will be used in the place of the the ith element of the + // a variable that will be used in the place of the ith element of the // array |var|. If the entry is |0|, then the variable has not been // created yet. std::map> replacement_variables_; diff --git a/3rdparty/spirv-tools/source/opt/dominator_tree.h b/3rdparty/spirv-tools/source/opt/dominator_tree.h index 0024bc508..1674b228f 100644 --- a/3rdparty/spirv-tools/source/opt/dominator_tree.h +++ b/3rdparty/spirv-tools/source/opt/dominator_tree.h @@ -278,7 +278,7 @@ class DominatorTree { private: // Wrapper function which gets the list of pairs of each BasicBlocks to its - // immediately dominating BasicBlock and stores the result in the the edges + // immediately dominating BasicBlock and stores the result in the edges // parameter. // // The |edges| vector will contain the dominator tree as pairs of nodes. diff --git a/3rdparty/spirv-tools/source/opt/loop_fission.cpp b/3rdparty/spirv-tools/source/opt/loop_fission.cpp index 0678113c4..0a4125dff 100644 --- a/3rdparty/spirv-tools/source/opt/loop_fission.cpp +++ b/3rdparty/spirv-tools/source/opt/loop_fission.cpp @@ -453,7 +453,7 @@ Pass::Status LoopFissionPass::Process() { for (Function& f : *context()->module()) { // We collect all the inner most loops in the function and run the loop // splitting util on each. The reason we do this is to allow us to iterate - // over each, as creating new loops will invalidate the the loop iterator. + // over each, as creating new loops will invalidate the loop iterator. std::vector inner_most_loops{}; LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(&f); for (Loop& loop : loop_descriptor) { diff --git a/3rdparty/spirv-tools/source/opt/pass_manager.cpp b/3rdparty/spirv-tools/source/opt/pass_manager.cpp index be53d3440..a73ff7cf4 100644 --- a/3rdparty/spirv-tools/source/opt/pass_manager.cpp +++ b/3rdparty/spirv-tools/source/opt/pass_manager.cpp @@ -35,10 +35,18 @@ Pass::Status PassManager::Run(IRContext* context) { if (print_all_stream_) { std::vector binary; context->module()->ToBinary(&binary, false); - SpirvTools t(SPV_ENV_UNIVERSAL_1_2); + SpirvTools t(target_env_); + t.SetMessageConsumer(consumer()); std::string disassembly; - t.Disassemble(binary, &disassembly, 0); - *print_all_stream_ << preamble << (pass ? pass->name() : "") << "\n" + std::string pass_name = (pass ? pass->name() : ""); + if (!t.Disassemble(binary, &disassembly, 0)) { + std::string msg = "Disassembly failed before pass "; + msg += pass_name + "\n"; + spv_position_t null_pos{0, 0, 0}; + consumer()(SPV_MSG_WARNING, "", null_pos, msg.c_str()); + return; + } + *print_all_stream_ << preamble << pass_name << "\n" << disassembly << std::endl; } }; diff --git a/3rdparty/spirv-tools/source/opt/register_pressure.cpp b/3rdparty/spirv-tools/source/opt/register_pressure.cpp index 5750c6d40..1ad337387 100644 --- a/3rdparty/spirv-tools/source/opt/register_pressure.cpp +++ b/3rdparty/spirv-tools/source/opt/register_pressure.cpp @@ -378,7 +378,7 @@ void RegisterLiveness::SimulateFusion( // The loop fusion is injecting the l1 before the l2, the latch of l1 will be // connected to the header of l2. // To compute the register usage, we inject the loop live-in (union of l1 and - // l2 live-in header blocks) into the the live in/out of each basic block of + // l2 live-in header blocks) into the live in/out of each basic block of // l1 to get the peak register usage. We then repeat the operation to for l2 // basic blocks but in this case we inject the live-out of the latch of l1. auto live_loop = MakeFilterIteratorRange( diff --git a/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp b/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp index 52f2d6ad9..9c81dbe98 100644 --- a/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp +++ b/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp @@ -134,7 +134,7 @@ class SENodeSimplifyImpl { // offset. SENode* EliminateZeroCoefficientRecurrents(SENode* node); - // A reference the the analysis which requested the simplification. + // A reference the analysis which requested the simplification. ScalarEvolutionAnalysis& analysis_; // The node being simplified. diff --git a/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h b/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h index 8dfeb307b..1cbbbcc6d 100644 --- a/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h +++ b/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h @@ -34,7 +34,7 @@ class StrengthReductionPass : public Pass { // Returns true if something changed. bool ReplaceMultiplyByPowerOf2(BasicBlock::iterator*); - // Scan the types and constants in the module looking for the the integer + // Scan the types and constants in the module looking for the integer // types that we are // interested in. The shift operation needs a small unsigned integer. We // need to find diff --git a/3rdparty/spirv-tools/source/opt/types.cpp b/3rdparty/spirv-tools/source/opt/types.cpp index b1eb3a508..ea4baadbd 100644 --- a/3rdparty/spirv-tools/source/opt/types.cpp +++ b/3rdparty/spirv-tools/source/opt/types.cpp @@ -425,7 +425,6 @@ std::string Array::str() const { void Array::GetExtraHashWords(std::vector* words, std::unordered_set* seen) const { element_type_->GetHashWords(words, seen); - // This should mirror the logic in IsSameImpl words->insert(words->end(), length_info_.words.begin(), length_info_.words.end()); } diff --git a/3rdparty/spirv-tools/source/val/validate.cpp b/3rdparty/spirv-tools/source/val/validate.cpp index 7655c960d..64df67ca2 100644 --- a/3rdparty/spirv-tools/source/val/validate.cpp +++ b/3rdparty/spirv-tools/source/val/validate.cpp @@ -202,7 +202,7 @@ spv_result_t ValidateBinaryUsingContextAndValidationState( /* diagnostic = */ nullptr); // Parse the module and perform inline validation checks. These checks do - // not require the the knowledge of the whole module. + // not require the knowledge of the whole module. if (auto error = spvBinaryParse(&context, vstate, words, num_words, /*parsed_header =*/nullptr, ProcessInstruction, pDiagnostic)) { diff --git a/3rdparty/spirv-tools/source/val/validate_memory.cpp b/3rdparty/spirv-tools/source/val/validate_memory.cpp index a7b0f82d5..93b180004 100644 --- a/3rdparty/spirv-tools/source/val/validate_memory.cpp +++ b/3rdparty/spirv-tools/source/val/validate_memory.cpp @@ -1411,7 +1411,7 @@ spv_result_t ValidateArrayLength(ValidationState_t& state, << state.getIdName(inst->id()) << "' must be an OpTypeRuntimeArray."; } - // The array member must the the index of the last element (the run time + // The array member must the index of the last element (the run time // array). if (inst->GetOperandAs(3) != num_of_members - 1) { return state.diag(SPV_ERROR_INVALID_ID, inst)