Add some val options to reduce#2401
Conversation
|
Could add a test to |
b52f620 to
a999d17
Compare
|
Here is a small shader based on code generated by DXC. You can modifiy it as you see fit the validation failure is based on the offset for the members. of the |
|
I made a few more changes here than expected. @afd FYI
|
|
You can try this shader instead: |
s-perron
left a comment
There was a problem hiding this comment.
Seems fine to me. I have provided a different example where skip block layout is needed, so you can see if that would work better for the test that you have.
Another question: Is it worth keeping the old interface as well at the new? It looks like the reducer is not part of the public interface (include dir), so there is not need to keep it. However, I just want to know it has been considered.
|
Thanks! That works. Sorry for the delay. What do you mean by the old interface? |
36e4dbe to
9cd126d
Compare
|
I was referring to this change: https://github.com/KhronosGroup/SPIRV-Tools/pull/2401/files#diff-88958976449829c9895e852ac25bcef2R85. As I think about it more, all old code should still work, it just could be better. |
|
Ah I see. Thinking about it more, I prefer the original signature, so I have changed it back. I think my issue was that |
afd
left a comment
There was a problem hiding this comment.
In general looks good, but a few nits, and it would be ideal if we could avoid duplicating the validator options text. I'd almost rather say "run spirv-val --help for a description" than duplicate the text.
tools/reduce/reduce.cpp
Outdated
| Overrides any --relax-block-layout or --scalar-block-layout option. | ||
| --relax-struct-store Allow store from one struct type to a | ||
| different type with compatible layout and | ||
| members. |
There was a problem hiding this comment.
^ How painful would it be to factor out the text for these help options? Their descriptions could well change in the validator, and it would be a shame for them to get out of sync. I appreciate that with the validator being a separate project this might not be easy.
|
When I wrote "I'd almost rather say "run spirv-val --help for a description" than duplicate the text", I mean I would prefer to actually factor out the text so that it can be shown in both places in full. But if that's not possible then it might be better to do what I propose here rather than duplicate it. |
afd
left a comment
There was a problem hiding this comment.
Looking great; sorry to go back again on this shared string stuff but it feels like it's worth getting right now.
I wonder whether your clang format check failures could be fixed if you rebased (I had that problem before).
afd
left a comment
There was a problem hiding this comment.
Sorry: I had meant to click "Request changes" in my last review.
838df1c to
c04dd8a
Compare
|
I feel that the code is a hack either way and the factoring out is just the minimal approach to reduce repetition; the parsing of these args is still repeated, the strings in the parsing code are repeated, if more validator options are added, they need to be manually added to the reducer and both help texts, if appropriate. The help text is still separate from the arguments. If more sharing is needed, then there will need to be manual changes and checks either way. Having a string constant defined in a header is also pretty weird in itself; not sure if I should have done this, but using macros seemed unpleasant and adding another shared compilation unit seemed like overkill. If more sharing is needed and we care about making the code nice, we should use an argument parsing library so we can have a function that adds the shared arguments (with the help text) to an argument parser. But in summary, I made the changes :) |
afd
left a comment
There was a problem hiding this comment.
I'm fine with the current status of this PR, though curious to whether we think refactoring the validator help strings is the preferred way forward.
c04dd8a to
eb91927
Compare
|
I have reverted the help text refactoring and removed the repeated help text, pointing to user to |
* Change Reducer::Run signature; no need for r-value reference as argument is immediately copied. * Check that initial shader is valid. * Fix RemoveOpnameAndRemoveUnreferenced test; turns out the original shader is invalid, but the reduced shader is valid; fix original shader. Assert reduction status is kComplete.
…t copy initial binary in Reducer::Run.
e8efae9 to
2b5c112
Compare
Roll third_party/glslang/ 517f39e..142cb87 (35 commits) KhronosGroup/glslang@517f39e...142cb87 $ git log 517f39e..142cb87 --date=short --no-merges --format='%ad %ae %s' 2020-10-23 rex.xu HLSL: Add support for printf(). 2020-10-21 bclayton Fix GN build and presubmits 2020-10-20 john SPV: Update to the latest SPIR-V header, includes variable-rate shading 2020-07-02 laddoc Add GL_EXT_fragment_shading_rate 2020-10-20 bclayton Kokoro: Add configurations for GN presubmit 2020-10-19 bclayton Fix uninitialized use of TIntermediate::resource (KhronosGroup#2424) 2020-10-16 bclayton Add GN build instructions to README.md 2020-10-16 bclayton Add basic GN configurations 2020-10-12 hwguy.siplus SPIR-V: Remove SpvTools.h include from disassemble.cpp (KhronosGroup#2417) 2020-10-12 rverschelde Remove executable bits from code/data files (KhronosGroup#2420) 2020-10-07 dneto Add test case for read-only storage texture passed to helper function (KhronosGroup#2414) 2020-10-07 8729214+jonahryandavis Disable -Wno-conversion on MSVC compiler (KhronosGroup#2410) 2020-10-05 cepheus Revert "Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (KhronosGroup#2408)" 2020-10-05 dev Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (KhronosGroup#2408) 2020-09-27 cepheus Revert "Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output. (KhronosGroup#2406)" 2020-09-27 dev Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output. (KhronosGroup#2406) 2020-09-26 cstout [spirv-remap] Fix undefined behavior in hashing (KhronosGroup#2403) 2020-09-26 cstout [Wconversion] Suppress glslang issue (KhronosGroup#2404) 2020-09-24 greg Update spirv-tools and spirv-headers known goods (KhronosGroup#2401) 2020-09-18 rex.xu SPIRV: Add more utility functions to build some opcodes (KhronosGroup#2398) 2020-09-15 laddoc Preprocessor related issue fix (KhronosGroup#2378) 2020-09-14 rex.xu SPIRV: Add disassembly support for multiple literal strings (KhronosGroup#2397) 2020-09-14 laddoc Fix scope definition in ES 100. (KhronosGroup#2379) 2020-09-14 john Fix KhronosGroup#2385: guard against constant_id on non-const. 2020-09-12 shuizhuyuanluo Try to find python interpreter from host first 2020-09-11 ShabbyX Allow subpassLoad for ANGLE 2020-09-09 greg Add texture sample to nonuniform test 2020-09-08 greg Add buffer store to nonuniform tests 2020-09-03 bas SPV: Add NonUniform decoration for constructors. 2020-09-03 bas SPV: Add NonUniform decoration for OpImages created during lowering. 2020-08-24 bas SPV: Add NonUniform decorations for stores. 2020-09-08 tobias.hector Added missing copyright amendment 2020-09-07 rex.xu SPIRV: Fix some disassembly issues 2020-09-03 tobias.hector Error when initializing rayQuery with assignment 2020-09-02 rex.xu Parser: Fix wrong names of extension macros Created with: roll-dep third_party/glslang Roll third_party/googletest/ df6b75949..282877317 (41 commits) google/googletest@df6b759...2828773 $ git log df6b75949..282877317 --date=short --no-merges --format='%ad %ae %s' 2020-10-27 absl-team Googletest export 2020-10-26 absl-team Googletest export 2020-10-20 sonzogniarthur Fix typo "definedin in" => "defined in" 2020-10-15 absl-team Googletest export 2020-10-15 absl-team Googletest export 2020-10-15 dmauro Googletest export 2020-10-14 absl-team Googletest export 2020-10-14 dmauro Googletest export 2020-10-14 dmauro Googletest export 2020-10-14 absl-team Googletest export 2020-10-14 dmauro Googletest export 2020-10-14 absl-team Googletest export 2020-10-13 dmauro Googletest export 2020-10-13 dmauro Googletest export 2020-10-13 absl-team Googletest export 2020-10-13 absl-team Googletest export 2020-10-09 ofats Googletest export 2020-10-09 absl-team Googletest export 2020-10-08 absl-team Googletest export 2020-10-12 peternewman Fix a typo 2020-10-07 manavrion Improve FilePath::Normalize method 2020-10-07 pravin1992 Issue 2135: Change template args in NiceMock, NaggyMock and StrictMock from A1, A2, ... to TArg1, TArg2,... to avoid clash with legacy header files 2020-09-29 absl-team Googletest export 2020-10-01 63450189+ranodeepbanerjee A slight Gramatical change. 2020-09-29 dmauro Googletest export 2020-09-29 absl-team Googletest export 2020-09-25 absl-team Googletest export 2020-09-27 56075233+keshavgbpecdelhi Update cook_book.md 2020-09-23 absl-team Googletest export 2020-09-23 absl-team Googletest export 2020-09-21 absl-team Googletest export 2020-09-24 thomas.barbier Fix warning maybe-uninitialized 2020-09-18 absl-team Googletest export 2020-09-17 absl-team Googletest export 2020-09-18 63900998+JethroSama Update README.md, added missing 'a' 2020-09-08 absl-team Googletest export 2020-09-02 dmauro Googletest export 2020-09-01 absl-team Googletest export 2020-09-01 absl-team Googletest export 2020-08-25 27jf Add timestamp to in old method mock macro guide 2020-05-05 igor.n.nazarenko Detect proto messages based on presense of DebugString. Created with: roll-dep third_party/googletest Roll third_party/re2/ ca11026a0..166dbbeb3 (25 commits) google/re2@ca11026...166dbbe $ git log ca11026a0..166dbbeb3 --date=short --no-merges --format='%ad %ae %s' 2020-10-26 junyer Fix symbol visibility and add test coverage. 2020-10-13 junyer Get the conditional right this time. Sigh. 2020-10-13 junyer Don't support ParseFrom() on MSVC. It can cause ICEs. 2020-10-09 junyer Ensure that RE2::Arg works even with overloaded ParseFrom(). 2020-10-08 junyer Refactor the RE2::Arg templates for readability. 2020-10-07 junyer Rename namespace internal to namespace re2_internal. 2020-10-07 junyer Address `-Wunused-parameter' warnings. 2020-10-07 junyer Add missing #include. Mea culpa. 2020-10-07 junyer Rework RE2::Arg with templates instead of macros. 2020-10-06 junyer Write `typename' in templates rather than `class'. 2020-09-27 junyer Fix some indentation. 2020-09-27 junyer Set BAZELISK_GITHUB_TOKEN. 2020-09-25 junyer Point to the official Python wrapper. 2020-09-25 junyer Disable fail-fast in GitHub Actions. 2020-09-25 junyer Fix a template that will break with GCC 11.x. 2020-09-22 junyer Try to use the Clang packages instead. 2020-09-22 junyer Try to make the Clang containers work. 2020-09-22 junyer Configure a build matrix for Clang using containers. 2020-09-22 junyer Address `-Wclass-memaccess' warnings from GCC 10.x. 2020-09-22 junyer Configure a build matrix for GCC using containers. 2020-09-22 junyer Migrate from Kokoro to GitHub Actions for Bazel. 2020-09-22 junyer Migrate from Kokoro to GitHub Actions for CMake. 2020-09-22 junyer Remove Travis CI configuration. 2020-09-22 junyer Initial GitHub Actions CI configuration. 2020-09-22 junyer Improve the comments for RE2::FullMatch() et al. Created with: roll-dep third_party/re2 Roll third_party/spirv-headers/ 3fdabd0..7845730 (7 commits) KhronosGroup/SPIRV-Headers@3fdabd0...7845730 $ git log 3fdabd0..7845730 --date=short --no-merges --format='%ad %ae %s' 2020-10-23 john Bump revision to 4, for SPIR-V 1.5. 2020-10-19 TobyHector Add SPV_EXT_shader_image_int64 (KhronosGroup#170) 2020-10-19 TobyHector Added SPV_KHR_fragment_shading_rate (KhronosGroup#172) 2020-10-12 hwguy.siplus Register the Xenia emulator as a generator (KhronosGroup#171) 2020-09-27 atyuwen Register the Messiah SPIR-V CodeGen (KhronosGroup#169) 2020-09-10 syoussefi Register the ANGLE compiler (KhronosGroup#168) 2020-09-08 cepheus Rebuild of latest headers, which slightly moves OpTerminateInvocation Created with: roll-dep third_party/spirv-headers Roll third_party/spirv-tools/ 8a0ebd4..f7da527 (138 commits) KhronosGroup/SPIRV-Tools@8a0ebd4...f7da527 $ git log 8a0ebd4..f7da527 --date=short --no-merges --format='%ad %ae %s' 2020-10-30 jaebaek Temporarily add EmptyPass to prevent glslang from failing (KhronosGroup#4004) 2020-10-30 Junda.Liu spirv-opt: Add support to prevent functions from being inlined if they have DontInline flag (KhronosGroup#3858) 2020-10-29 jaebaek Propagate OpLine to all applied instructions in spirv-opt (KhronosGroup#3951) 2020-10-29 bclayton CMake: Add SPIRV_TOOLS_BUILD_STATIC flag (KhronosGroup#3910) 2020-10-29 dneto Avoid copying a ref in a loop (KhronosGroup#4000) 2020-10-28 justsid spirv-val: Allow the ViewportIndex and Layer built-ins on SPIR-V 1.5 (KhronosGroup#3986) 2020-10-28 dnovillo Simplify logic to decide whether CCP modified the IR (KhronosGroup#3997) 2020-10-27 jaebaek Add DebugValue for DebugDecl invisible to value assignment (KhronosGroup#3973) 2020-10-26 greg Fix bounds check instrumentation to handle 16-bit values (KhronosGroup#3983) 2020-10-23 andreperezmaselco.developer spirv-fuzz: Add expand vector reduction transformation (KhronosGroup#3869) 2020-10-23 vasniktel spirv-fuzz: Don't replace irrelevant indices in OpAccessChain (KhronosGroup#3988) 2020-10-23 vasniktel spirv-fuzz: Add FuzzerPassAddCompositeExtract (KhronosGroup#3904) 2020-10-22 afdx spirv-fuzz: Fix mismatch with shrinker step limit (KhronosGroup#3985) 2020-10-22 afdx spirv-fuzz: Fix off-by-one error in replayer (KhronosGroup#3982) 2020-10-22 afdx spirv-fuzz: Get order right for OpSelect arguments (KhronosGroup#3974) 2020-10-22 afdx spirv-fuzz: Do not add synonym-creating loops in dead blocks (KhronosGroup#3975) 2020-10-22 afdx spirv-fuzz: Skip OpTypeSampledImage when propagating up (KhronosGroup#3976) 2020-10-22 afdx spirv-fuzz: Pass OpUndef in function call if needed (KhronosGroup#3978) 2020-10-22 afdx spirv-fuzz: Fix off-by-one in TransformationCompositeConstruct (KhronosGroup#3979) 2020-10-22 afdx spirv-fuzz: Tolerate absent ids in data synonym fact management (KhronosGroup#3966) 2020-10-21 afdx spirv-fuzz: Fix to id availability (KhronosGroup#3971) 2020-10-21 afdx spirv-fuzz: Fix operand types (KhronosGroup#3962) 2020-10-21 8729214+jonahryandavis Update SPIRV-Headers revision in DEPS file (KhronosGroup#3961) 2020-10-21 afdx spirv-fuzz: Don't flatten conditional if condition is irrelevant (KhronosGroup#3944) 2020-10-21 afdx spirv-fuzz: Do not produce OpPhis of type OpTypeSampledImage (KhronosGroup#3964) 2020-10-21 afdx spirv-fuzz: Restrict fuzzer pass to reachable blocks (KhronosGroup#3970) 2020-10-21 afdx spirv-fuzz: Handle more types when extending OpPhi instructions (KhronosGroup#3969) 2020-10-21 afdx spirv-fuzz: Skip early terminator wrappers when merging returns (KhronosGroup#3968) 2020-10-21 afdx spirv-fuzz: Avoid irrelevant constants in synonym-creating loops (KhronosGroup#3967) 2020-10-21 afdx spirv-fuzz: Skip dead blocks in FuzzerPassAddOpPhiSynonyms (KhronosGroup#3965) 2020-10-21 afdx spirv-fuzz: Avoid the type manager when looking for struct types (KhronosGroup#3963) 2020-10-20 afdx spirv-fuzz: Fix to TransformationDuplicateRegionWithSelection (KhronosGroup#3941) 2020-10-20 afdx spirv-fuzz: Skip OpFunction when replacing irrelevant ids (KhronosGroup#3932) 2020-10-20 afdx spirv-fuzz: Use component-wise selectors when flattening conditional branches (KhronosGroup#3921) 2020-10-20 TobyHector Add SPV_EXT_shader_image_int64 (KhronosGroup#3852) 2020-10-20 TobyHector Support SPV_KHR_fragment_shading_rate (KhronosGroup#3943) 2020-10-19 afdx spirv-val: Fix validation of OpPhi instructions (KhronosGroup#3919) 2020-10-19 afdx spirv-fuzz: Avoid void struct member when outlining functions (KhronosGroup#3936) 2020-10-19 afdx spirv-fuzz: Do not allow Block-decorated structs when adding parameters (KhronosGroup#3931) 2020-10-19 afdx spirv-fuzz: Fix to operand id type (KhronosGroup#3937) 2020-10-19 afdx spirv-fuzz: Handle dead blocks in TransformationEquationInstruction (KhronosGroup#3933) 2020-10-19 afdx spirv-fuzz: Do not allow sampled image load when flattening conditionals (KhronosGroup#3930) 2020-10-19 afdx spirv-fuzz: Take care of OpPhi instructions when inlining (KhronosGroup#3939) 2020-10-16 afdx spirv-fuzz: Fix to TransformationInlineFunction (KhronosGroup#3913) 2020-10-16 afdx spirv-fuzz: Wrap early terminators before merging returns (KhronosGroup#3925) 2020-10-16 jaebaek Add DebugValue for function param regardless of scope (KhronosGroup#3923) 2020-10-16 afdx Temporary fix to make GoogleTest compile. (KhronosGroup#3922) 2020-10-15 afdx spirv-fuzz: Lower probability of adding bit instruction synonyms (KhronosGroup#3917) 2020-10-15 afdx spirv-fuzz: Fix handling of OpPhi in FlattenConditionalBranch (KhronosGroup#3916) 2020-10-13 afdx spirv-fuzz: Avoid creating blocks without parents (KhronosGroup#3908) (...) 2020-09-24 ehsannas Start SPIRV-Tools v2020.6 2020-09-24 ehsannas Finalize SPIRV-Tools v2020.5 2020-09-24 ehsannas Update CHANGES 2020-09-24 vasniktel spirv-fuzz: Support dead blocks in TransformationAddSynonym (KhronosGroup#3832) 2020-09-24 vasniktel spirv-fuzz: Move IRContext parameter into constructor (KhronosGroup#3837) 2020-09-24 Simran-B Add missing backticks around <result-id> (KhronosGroup#3840) 2020-09-23 rharrison Validate SPIRV Version number when parsing binary header (KhronosGroup#3834) 2020-09-23 stefanomil spirv-fuzz: Create synonym of int constant using a loop (KhronosGroup#3790) 2020-09-22 58573781+richard-lunarg Fix compiler error on macOS with XCode12 (KhronosGroup#3836) 2020-09-22 vasniktel spirv-fuzz: Handle OpPhis in TransformationInlineFunction (KhronosGroup#3833) 2020-09-22 stevenperron Update CHANGES 2020-09-22 afdx spirv-fuzz: Refactor fuzzer, replayer and shrinker (KhronosGroup#3818) 2020-09-18 afdx spirv-fuzz: Add pass recommendations (KhronosGroup#3757) 2020-09-18 stefanomil spirv-fuzz: Consider all ids from dead blocks irrelevant (KhronosGroup#3795) 2020-09-18 afdx Fix header guard macros (KhronosGroup#3811) 2020-09-18 antonikarp spirv-fuzz: Fix TransformationDuplicateRegionWithSelection (KhronosGroup#3815) 2020-09-17 46493288+sfricke-samsung spirv-val: Add DeviceIndex (KhronosGroup#3812) 2020-09-16 rharrison Fix missed modification flagging (KhronosGroup#3814) 2020-09-16 andreperezmaselco.developer spirv-fuzz: Use an irrelevant id for the unused components (KhronosGroup#3810) 2020-09-16 stefanomil spirv-fuzz: Improvements to random number generation (KhronosGroup#3809) 2020-09-16 greg Add buffer oob check to bindless instrumentation (KhronosGroup#3800) 2020-09-16 vasniktel spirv-fuzz: Remove CanFindOrCreateZeroConstant (KhronosGroup#3807) 2020-09-15 andreperezmaselco.developer spirv-fuzz: Add bit instruction synonym transformation (KhronosGroup#3775) 2020-09-16 vasniktel spirv-fuzz: Skip unreachable blocks (KhronosGroup#3729) 2020-09-15 afdx Fix build errors (KhronosGroup#3804) 2020-09-15 vasniktel spirv-fuzz: Handle invalid ids in fact manager (KhronosGroup#3742) 2020-09-15 vasniktel spirv-fuzz: Support memory instructions MoveInstructionDown (KhronosGroup#3700) 2020-09-15 stefanomil spirv-fuzz: Pass submanagers to other submanagers when necessary (KhronosGroup#3796) 2020-09-15 stefanomil spirv-fuzz: Transformation to flatten conditional branch (KhronosGroup#3667) 2020-09-14 46493288+sfricke-samsung spirv-val: Add BaseInstance, BaseVertex, DrawIndex, and ViewIndex (KhronosGroup#3782) 2020-09-14 dnovillo Properly mark IR changed if instruction folder creates more than one constant. (KhronosGroup#3799) 2020-09-11 afdx Add missing file to BUILD.gn (KhronosGroup#3798) 2020-09-11 antonikarp spirv-fuzz: Add TransformationDuplicateRegionWithSelection (KhronosGroup#3773) 2020-09-11 afdx spirv-reduce: Support reducing a specific function (KhronosGroup#3774) 2020-09-10 afdx spirv-reduce: Refactoring (KhronosGroup#3793) 2020-09-10 afdx Favour 'integrity' over 'coherence' as a replacement for 'sanity'. (KhronosGroup#3619) 2020-09-10 antonikarp spirv-fuzz: Fix header guards in transformations/fuzzer passes (KhronosGroup#3784) 2020-09-10 paulthomson spirv-fuzz: Add SPIRV_FUZZ_PROTOC_COMMAND (KhronosGroup#3789) 2020-09-10 paulthomson Add missing include (KhronosGroup#3788) 2020-09-09 paulthomson Improve spirv-fuzz CMake code (KhronosGroup#3781) 2020-09-08 stevenperron Allow SPV_KHR_8bit_storage extension. (KhronosGroup#3780) 2020-09-08 stefanomil spirv-opt: Add function to compute nesting depth of a block (KhronosGroup#3771) 2020-09-03 stefanomil spirv-fuzz: Transformation to convert OpSelect to conditional branch (KhronosGroup#3681) 2020-09-02 46493288+sfricke-samsung spirv-val: Add Vulkan VUID labels to BuiltIn (KhronosGroup#3756) 2020-09-02 vasniktel spirv-fuzz: Add support for BuiltIn decoration (KhronosGroup#3736) 2020-09-02 stefanomil spirv-fuzz: Fix GetIdEquivalenceClasses (KhronosGroup#3767) 2020-09-02 stefanomil spirv-fuzz: Replace id in OpPhi coming from a dead predecessor (KhronosGroup#3744) 2020-09-01 stefanomil spirv-fuzz: Transformation to replace the use of an irrelevant id (KhronosGroup#3697) 2020-09-01 vasniktel spirv-fuzz: TransformationMutatePointer (KhronosGroup#3737) 2020-09-01 stefanomil spirv-fuzz: Compute interprocedural loop nesting depth of blocks (KhronosGroup#3753) Created with: roll-dep third_party/spirv-tools
Fix #2396
Reducer::Run.