Keep decorations when replacing loads in access-chain-convert.#1829
Merged
s-perron merged 2 commits intoKhronosGroup:masterfrom Aug 15, 2018
Merged
Keep decorations when replacing loads in access-chain-convert.#1829s-perron merged 2 commits intoKhronosGroup:masterfrom
s-perron merged 2 commits intoKhronosGroup:masterfrom
Conversation
In local-access-chain-convert, we replace loads by load the entire variable, then doing the extract. The extract will have the same value as the load. However, if the load has a decoration on it, the decoration is lost because we do not copy any them to the new id. This is fixed by rewritting the load into the extract and keeping the same result id. This change has the effect that we do not call DCEInst on the loads because the load is not being deleted, but replaced. This could leave OpAccessChain instructions around that are not used. This is not a problem for -O and -Os. They run local_single_*_elim passes and then dead code elimination. The dce will remove the unused access chains, and the load elimination passes work even if there are unused access chains. I have added test to them to ensure they will not loss opportunities. Fixes KhronosGroup#1787.
Collaborator
Author
|
@greg-lunarg Can you take a look and make sure there is nothing I missed? |
alan-baker
approved these changes
Aug 13, 2018
dneto0
pushed a commit
to dneto0/SPIRV-Tools
that referenced
this pull request
Sep 14, 2024
Roll third_party/glslang/ ebf634b..40801e3 (8 commits) KhronosGroup/glslang@ebf634b...40801e3 $ git log ebf634b..40801e3 --date=short --no-merges --format='%ad %ae %s' 2020-01-06 cepheus Bump revision 2020-01-06 laddoc Add builtin constants 2019-12-26 cepheus HLSL: Fix KhronosGroup#2037: Integer dot used incorrect input for adds. 2019-12-25 laddoc atomic counter offset should align to 4 2019-11-26 laddoc Add support for ARB_uniform_buffer_object 2019-11-26 laddoc Add support for ARB_texture_multisample 2019-11-26 laddoc Add support for ARB_sample_shading 2019-12-20 cepheus Command-line: Give better error messages. From KhronosGroup#1829. Roll third_party/googletest/ 5b162a79d..306f3754a (17 commits) google/googletest@5b162a7...306f375 $ git log 5b162a79d..306f3754a --date=short --no-merges --format='%ad %ae %s' 2019-12-30 absl-team Googletest export 2019-12-30 absl-team Googletest export 2019-12-26 absl-team Googletest export 2019-12-19 absl-team Googletest export 2019-12-18 absl-team Googletest export 2019-12-18 absl-team Googletest export 2019-12-20 kontakt Make move operation noexcept. 2019-12-20 kontakt Define default destructor for test classes 2019-12-20 kontakt Deleted functions as part of public interface 2019-12-20 kontakt Review notes: Return T& from assignment operators 2019-12-17 kontakt Disable move constructor and assignment operator for test classes. 2019-12-16 krzysio Googletest export 2019-12-10 syoussefi Revert "Googletest export": disallow empty prefix 2019-12-10 syoussefi Revert "Googletest export": Remove test for empty prefix 2019-12-16 syoussefi Workaround VS bug w.r.t empty arguments to macros 2019-12-13 kravlala.1 Activate GNU extensions in case of MSYS generator 2019-11-22 krystian.kuzniarek remove stale comments about older GCC versions Roll third_party/re2/ 7470f4d02..00af5b44d (2 commits) google/re2@7470f4d...00af5b4 $ git log 7470f4d02..00af5b44d --date=short --no-merges --format='%ad %ae %s' 2020-01-05 junyer Fix a comment. 2019-12-29 junyer Make DFA use hints. Roll third_party/spirv-cross/ f912c3289..961b9014a (6 commits) KhronosGroup/SPIRV-Cross@f912c32...961b901 $ git log f912c3289..961b9014a --date=short --no-merges --format='%ad %ae %s' 2020-01-06 post Fix Clang warnings. 2020-01-06 post Roll custom versions of isalpha/isalnum. 2020-01-06 post Add test shader for OpCopyLogical with packing/unpacking. 2020-01-06 post Go through access chain path for OpCopyLogical. 2020-01-06 post Basic implementation of OpCopyLogical. 2019-12-21 dm86.jang Add debug prefix on Windows Roll third_party/spirv-tools/ 96354f5..c8bf143 (12 commits) KhronosGroup/SPIRV-Tools@96354f5...c8bf143 $ git log 96354f5..c8bf143 --date=short --no-merges --format='%ad %ae %s' 2020-01-06 dneto GetOperandConstants operand can be const (KhronosGroup#3126) 2019-12-27 dneto Avoid pessimizing std::move (KhronosGroup#3124) 2019-12-27 kburjack Fix typo in validation message (KhronosGroup#3122) 2019-12-27 greg Change default version for CreatInstBindlessCheckPass to 2 (KhronosGroup#3119) 2019-12-20 greg Fix convert-relax-to-half invalid code (KhronosGroup#3099) (KhronosGroup#3106) 2019-12-19 dneto Support OpenCL.DebugInfo.100 extended instruction set (KhronosGroup#3080) 2019-12-19 afdx spirv-fuzz: Always add new globals to entry point interfaces (KhronosGroup#3113) 2019-12-19 afdx spirv-fuzz: Transformation to add a new function to a module (KhronosGroup#3114) 2019-12-19 afdx spirv-fuzz: Avoid passing access chains as parameters (KhronosGroup#3112) 2019-12-18 dneto Add support for SPV_KHR_non_semantic_info (KhronosGroup#3110) 2019-12-16 afdx spirv-fuzz: Transformations to add types, constants and variables (KhronosGroup#3101) 2019-12-16 greg Make Instrumentation format version 2 the default (Step 1) (KhronosGroup#3096) Created with: roll-dep third_party/effcee third_party/glslang third_party/googletest third_party/re2 third_party/spirv-cross third_party/spirv-headers third_party/spirv-tools
dneto0
pushed a commit
to dneto0/SPIRV-Tools
that referenced
this pull request
Sep 14, 2024
Roll third_party/glslang/ 40801e3..d203754 (6 commits) KhronosGroup/glslang@40801e3...d203754 $ git log 40801e3..d203754 --date=short --no-merges --format='%ad %ae %s' 2020-01-07 cepheus Fix KhronosGroup#1829: Add "--" command-line options for macro def/undef. 2020-01-08 laddoc Move symbol builtin check to grammar stage 2020-01-06 lryer Add missing extension defination 2019-11-26 laddoc Add support for ARB_gpu_shader_fp64 2020-01-03 lryer Fix glslang can't link multiple AST in a single stage 2019-12-25 laddoc Modify atomic_uint binding check Roll third_party/googletest/ 306f3754a..d854bd6ac (4 commits) google/googletest@306f375...d854bd6 $ git log 306f3754a..d854bd6ac --date=short --no-merges --format='%ad %ae %s' 2020-01-09 absl-team Googletest export 2020-01-09 absl-team Googletest export 2020-01-07 absl-team Googletest export 2020-01-07 absl-team Googletest export Roll third_party/re2/ 00af5b44d..85c014206 (2 commits) google/re2@00af5b4...85c0142 $ git log 00af5b44d..85c014206 --date=short --no-merges --format='%ad %ae %s' 2020-01-12 junyer Tidy up a test. 2020-01-07 junyer Prevent ShortVisit() from crashing fuzzers. Roll third_party/spirv-cross/ 961b9014a..172e39f03 (14 commits) KhronosGroup/SPIRV-Cross@961b901...172e39f $ git log 961b9014a..172e39f03 --date=short --no-merges --format='%ad %ae %s' 2020-01-09 post HLSL: Add a resource remapping API similar to MSL. 2020-01-09 post MSL: Deal with sign on wave min/max. 2020-01-09 post HLSL: Deal with casting for WaveActiveMin/Max. 2020-01-09 post GLSL: Deal with sign in subgroup Min/Max operations. 2020-01-08 post Run format_all.sh. 2020-01-08 post HLSL: Fix bug when reading and writing structs from SSBO. 2020-01-08 post HLSL: Implement stores for complex composites in ByteAddressBuffers. 2020-01-08 post HLSL: Support loading complex composites from ByteAddressBuffer. 2020-01-08 post Run format_all.sh. 2020-01-07 post MSL: Deal with padded fragment output + Component decoration. 2020-01-07 post MSL: Explicitly don't support component packing for tessellation. 2020-01-07 post MSL: Don't set OrigID when emitting component packed vectors. 2020-01-07 post MSL: Deal with packing vectors for vertex input/fragment output. 2020-01-07 post MSL: Add trivial tests for Component decoration. Roll third_party/spirv-tools/ c8bf143..18b3b94 (6 commits) KhronosGroup/SPIRV-Tools@c8bf143...18b3b94 $ git log c8bf143..18b3b94 --date=short --no-merges --format='%ad %ae %s' 2020-01-10 33791085+aqnuep Remove names and decorations of imported symbols (KhronosGroup#3081) 2020-01-08 dneto Fix GN build for OpenCL.DebugInfo.100 update (KhronosGroup#3134) 2020-01-08 bclayton Fix bad parameter names in error message (KhronosGroup#3129) 2020-01-07 alanbaker Revert PR KhronosGroup#3093 (KhronosGroup#3131) 2020-01-07 alanbaker Disallow forward references in arrays (KhronosGroup#3093) 2020-01-07 afdx spirv-fuzz: Add fuzzer pass to perform module donation (KhronosGroup#3117) Created with: roll-dep third_party/effcee third_party/glslang third_party/googletest third_party/re2 third_party/spirv-cross third_party/spirv-headers third_party/spirv-tools
dneto0
pushed a commit
to dneto0/SPIRV-Tools
that referenced
this pull request
Sep 14, 2024
Roll third_party/glslang/ 3ee5f2f..b60e067 (8 commits) KhronosGroup/glslang@3ee5f2f...b60e067 $ git log 3ee5f2f..b60e067 --date=short --no-merges --format='%ad %ae %s' 2020-08-06 john SPV: Fix KhronosGroup#1829: don't emit OpModuleProcessed use-storage-buffer 2020-08-05 john Build/Test: Dropping 2013 allows using the latest googletests. 2020-08-04 john SPV: Standalone; sanity check the client GLSL input semantics option value. 2020-08-04 john SPV: Use more correct SPV-Tools environment, partially addressing KhronosGroup#2290 2020-08-04 john SPV: Fix KhronosGroup#2363: include trailing newline named text SPV output. 2020-07-03 ShabbyX Use GLSLANG_ANGLE to strip features to what ANGLE requires 2020-07-31 bclayton Revert changes that migrate to `thread_local`. 2020-07-27 dneto Avoid spurious warning about uninit var Created with: roll-dep third_party/glslang Roll third_party/googletest/ a781fe29b..3af06fe16 (12 commits) google/googletest@a781fe2...3af06fe $ git log a781fe29b..3af06fe16 --date=short --no-merges --format='%ad %ae %s' 2020-08-05 absl-team Googletest export 2020-08-03 absl-team Googletest export 2020-08-03 absl-team Googletest export 2020-08-05 zumix.cpp fix endif comment 2020-08-02 zumix.cpp fix tests 2020-07-29 franciscogthiesen Removing tiny-dnn from "Who is using.." 2020-07-28 absl-team Googletest export 2020-07-29 zumix.cpp fix GTEST_REMOVE_LEGACY_TEST_CASEAPI_ typo 2020-07-28 absl-team Googletest export 2020-07-26 ofats Googletest export 2020-07-19 jasjuang fix clang tidy modernize-use-equals-default warnings 2020-07-02 siliconearth Fix test failing when simple regex is used Created with: roll-dep third_party/googletest Roll third_party/spirv-cross/ 0376576d2..82d1c43e4 (7 commits) KhronosGroup/SPIRV-Cross@0376576...82d1c43 $ git log 0376576d2..82d1c43e4 --date=short --no-merges --format='%ad %ae %s' 2020-08-03 cdavis MSL: Fix handling of matrices and structs in the output control point array. 2020-07-29 post Add some test cases for complex type aliasing scenario. 2020-07-29 post Ensure that we use primary alias type when emitting flattened members. 2020-07-29 post GLSL: Be more aggressive about using type_alias. 2020-07-29 post Only rewrite type aliases for the base type. 2020-07-28 post GLSL: Add option to force flattening IO blocks. 2020-07-23 tommek Adding BuiltInSampleMask in HLSL Created with: roll-dep third_party/spirv-cross Roll third_party/spirv-headers/ 979924c..3fdabd0 (4 commits) KhronosGroup/SPIRV-Headers@979924c...3fdabd0 $ git log 979924c..3fdabd0 --date=short --no-merges --format='%ad %ae %s' 2020-08-03 44190824+mmerecki Reserve SPIR-V token range for upcoming Intel extensions. (KhronosGroup#165) 2020-07-29 alanbaker Update BUILD.bazel and BUILD.gn (KhronosGroup#166) 2020-07-29 alanbaker Publish the headers for the clspv embedded reflection non-semantic extended instruction set (KhronosGroup#164) 2020-07-29 johnkslang Update the registry in spir-v.xml to modernize and split out opcodes. (KhronosGroup#156) Created with: roll-dep third_party/spirv-headers Roll third_party/spirv-tools/ b63f0e5..2990a21 (30 commits) KhronosGroup/SPIRV-Tools@b63f0e5...2990a21 $ git log b63f0e5..2990a21 --date=short --no-merges --format='%ad %ae %s' 2020-08-10 stevenperron Avoid using /MP4 for clang on windows. (KhronosGroup#3662) 2020-08-06 antonikarp spirv-fuzz: TransformationReplaceAddSubMulWithCarryingExtended (KhronosGroup#3598) 2020-08-06 andreperezmaselco.developer spirv-fuzz: Add TransformationMakeVectorOperationDynamic (KhronosGroup#3597) 2020-08-06 andreperezmaselco.developer spirv-fuzz: iterate over blocks in replace linear algebra pass (KhronosGroup#3654) 2020-08-06 stefanomil spirv-fuzz: make outliner pass use additional transformations (KhronosGroup#3604) 2020-08-05 jaebaek OpenCL.DebugInfo.100 DebugTypeArray with variable size (KhronosGroup#3549) 2020-08-05 andreperezmaselco.developer spirv-opt: Improve the code of the Instruction class (KhronosGroup#3610) 2020-08-05 vasniktel spirv-fuzz: Handle OpPhis in livesafe functions (KhronosGroup#3642) 2020-08-05 vasniktel spirv-fuzz: Handle OpPhi during constant obfuscation (KhronosGroup#3640) 2020-08-05 vasniktel spirv-fuzz: Fix FuzzerPassCopyObjects (KhronosGroup#3638) 2020-08-04 vasniktel spirv-fuzz: Remove OpFunctionCall operands in correct order (KhronosGroup#3630) 2020-08-04 vasniktel spirv-fuzz: Handle capabilities during module donation (KhronosGroup#3651) 2020-08-04 vasniktel spirv-fuzz: Refactor boilerplate in TransformationAddParameter (KhronosGroup#3625) 2020-08-03 vasniktel spirv-fuzz: TransformationMoveInstructionDown (KhronosGroup#3477) 2020-07-31 jaebaek Remove DebugDeclare only for target variables in ssa-rewrite (KhronosGroup#3511) 2020-07-31 vasniktel Fix typo in ASAN CI build (KhronosGroup#3623) 2020-07-30 stefanomil spirv-fuzz: Transformation to add loop preheader (KhronosGroup#3599) 2020-07-30 stefanomil spirv-fuzz: Pass to replace int operands with ints of opposite signedness (KhronosGroup#3612) 2020-07-30 jaebaek Debug info preservation in loop-unroll pass (KhronosGroup#3548) 2020-07-30 alanbaker Validator support for non-semantic clspv reflection (KhronosGroup#3618) 2020-07-30 vasniktel spirv-fuzz: Fix memory bugs (KhronosGroup#3622) 2020-07-29 andreperezmaselco.developer spirv-fuzz: Implement the OpOuterProduct linear algebra case (KhronosGroup#3617) 2020-07-30 vasniktel spirv-fuzz: Compute corollary facts from OpBitcast (KhronosGroup#3538) 2020-07-29 dj2 Update some language usage. (KhronosGroup#3611) 2020-07-29 vasniktel spirv-fuzz: Relax type constraints in DataSynonym facts (KhronosGroup#3602) 2020-07-29 vasniktel spirv-fuzz: Remove non-deterministic behaviour (KhronosGroup#3608) 2020-07-29 afdx Avoid use of 'sanity' and 'sanity check' in the code base (KhronosGroup#3585) 2020-07-27 andreperezmaselco.developer spirv-fuzz: Add condition to make functions livesafe (KhronosGroup#3587) 2020-07-27 rharrison Rolling 4 dependencies (KhronosGroup#3601) 2020-07-27 andreperezmaselco.developer spirv-fuzz: Implement the OpTranspose linear algebra case (KhronosGroup#3589) Created with: roll-dep third_party/spirv-tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In local-access-chain-convert, we replace loads by load the entire
variable, then doing the extract. The extract will have the same value
as the load. However, if the load has a decoration on it, the
decoration is lost because we do not copy any them to the new id.
This is fixed by rewritting the load into the extract and keeping the
same result id.
This change has the effect that we do not call DCEInst on the loads
because the load is not being deleted, but replaced. This could leave
OpAccessChain instructions around that are not used. This is not a
problem for -O and -Os. They run local_single_*_elim passes and then
dead code elimination. The dce will remove the unused access chains,
and the load elimination passes work even if there are unused access
chains. I have added test to them to ensure they will not loss
opportunities.
Fixes #1787.