Commit b52f9ba
authored
[SPIR-V] Don't flatten arrays during legalization (#6767)
When struct contains opaque resources, we must legalize the SPIR-V to
move those resources out of the struct (Vulkan doesn't allow composite
to store opaque resources).
Before this change, any resource array would also be flattened due to
the pass flattening everything by default.
Patched SPIRV-Tools to allow some level of selection in what we flatten.
Not perfect, as we would flatten all arrays or all composites and cannot
pick only one variable to flatten, but for now this should be enough.
Fixes #6745
Signed-off-by: Nathan Gauër <[email protected]>
---------
Signed-off-by: Nathan Gauër <[email protected]>1 parent 8652894 commit b52f9ba
5 files changed
Lines changed: 148 additions & 91 deletions
File tree
- external
- tools/clang
- lib/SPIRV
- test/CodeGenSPIRV
Submodule SPIRV-Headers updated 14 files
- include/spirv/spir-v.xml+2-1
- include/spirv/unified1/spirv.bf+63
- include/spirv/unified1/spirv.core.grammar.json+118-3
- include/spirv/unified1/spirv.cs+63
- include/spirv/unified1/spirv.h+33
- include/spirv/unified1/spirv.hpp+33
- include/spirv/unified1/spirv.hpp11+33
- include/spirv/unified1/spirv.json+15
- include/spirv/unified1/spirv.lua+62
- include/spirv/unified1/spirv.py+11
- include/spirv/unified1/spv.d+63
- tools/buildHeaders/header.cpp+11-19
- tools/buildHeaders/jsonToSpirv.cpp+5
- tools/buildHeaders/jsonToSpirv.h+2-1
Submodule SPIRV-Tools updated 72 files
- .github/workflows/autoroll.yml+1-1
- .github/workflows/bazel.yml+1-1
- .github/workflows/ios.yml+2-2
- .github/workflows/release.yml+1-1
- .github/workflows/scorecard.yml+3-3
- .github/workflows/wasm.yml+1-1
- BUILD.bazel+1
- DEPS+5-5
- MODULE.bazel+6
- include/spirv-tools/libspirv.h+3
- include/spirv-tools/optimizer.hpp+12-7
- kokoro/scripts/linux/build-docker.sh+2
- source/binary.cpp+5-1
- source/disassemble.cpp+2-1
- source/name_mapper.cpp+6
- source/opcode.cpp+21
- source/opcode.h+3
- source/operand.cpp+5
- source/opt/aggressive_dead_code_elim_pass.cpp+3-1
- source/opt/desc_sroa.cpp+5-2
- source/opt/desc_sroa.h+13-3
- source/opt/desc_sroa_util.cpp+34-17
- source/opt/desc_sroa_util.h+4
- source/opt/fix_storage_class.cpp+1
- source/opt/folding_rules.cpp+76
- source/opt/local_access_chain_convert_pass.cpp+2-2
- source/opt/local_single_block_elim_pass.cpp+3-1
- source/opt/local_single_store_elim_pass.cpp+3-1
- source/opt/mem_pass.cpp+2
- source/opt/optimizer.cpp+18-1
- source/opt/type_manager.cpp+1
- source/text_handler.cpp+2-1
- source/val/validate_adjacency.cpp+9
- source/val/validate_annotation.cpp+7-3
- source/val/validate_atomics.cpp+38-1
- source/val/validate_builtins.cpp+4
- source/val/validate_cfg.cpp+2-1
- source/val/validate_constants.cpp+1
- source/val/validate_decorations.cpp+252-127
- source/val/validate_extensions.cpp+30-4
- source/val/validate_function.cpp+10-5
- source/val/validate_id.cpp+4
- source/val/validate_image.cpp+18-12
- source/val/validate_interfaces.cpp+10-5
- source/val/validate_logicals.cpp+3-1
- source/val/validate_memory.cpp+381-133
- source/val/validate_type.cpp+31
- source/val/validation_state.cpp+59-1
- source/val/validation_state.h+4
- test/binary_parse_test.cpp+1-1
- test/immediate_int_test.cpp+20-14
- test/opcode_require_capabilities_test.cpp+27-2
- test/opt/desc_sroa_test.cpp+213-14
- test/opt/fix_storage_class_test.cpp+37
- test/opt/fold_test.cpp+112
- test/text_to_binary.extension_test.cpp+49
- test/val/val_annotation_test.cpp+27
- test/val/val_atomics_test.cpp+123-5
- test/val/val_conversion_test.cpp+58
- test/val/val_decoration_test.cpp+397
- test/val/val_ext_inst_test.cpp+21
- test/val/val_extension_spv_khr_subgroup_uniform_control_flow.cpp+110
- test/val/val_fixtures.h+6-2
- test/val/val_function_test.cpp+107
- test/val/val_id_test.cpp+172-13
- test/val/val_interfaces_test.cpp+116
- test/val/val_memory_test.cpp+1.6k-15
- test/val/val_misc_test.cpp+8-8
- test/val/val_storage_test.cpp+2-2
- test/val/val_type_unique_test.cpp+18
- tools/opt/opt.cpp+8
- utils/generate_grammar_tables.py+6-1
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14805 | 14805 | | |
14806 | 14806 | | |
14807 | 14807 | | |
14808 | | - | |
14809 | | - | |
| 14808 | + | |
14810 | 14809 | | |
14811 | 14810 | | |
14812 | 14811 | | |
14813 | 14812 | | |
14814 | | - | |
| 14813 | + | |
| 14814 | + | |
| 14815 | + | |
| 14816 | + | |
| 14817 | + | |
| 14818 | + | |
| 14819 | + | |
| 14820 | + | |
14815 | 14821 | | |
14816 | 14822 | | |
14817 | 14823 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments