Skip to content

Updated desc_sroa to support flattening structures#3448

Merged
s-perron merged 3 commits intoKhronosGroup:masterfrom
ehsannas:flatten_global_resource_struct_2
Jun 19, 2020
Merged

Updated desc_sroa to support flattening structures#3448
s-perron merged 3 commits intoKhronosGroup:masterfrom
ehsannas:flatten_global_resource_struct_2

Conversation

@ehsannas
Copy link
Copy Markdown
Contributor

This doesn't cover cases where we have the following pattern:

         %31 = OpAccessChain %_ptr_UniformConstant_S %globalS %int_0 %int_0
         %32 = OpLoad %S %31
         %33 = OpCompositeExtract %_arr_type_2d_image_uint_2 %32 0
         %34 = OpCompositeExtract %type_2d_image %33 0
         %35 = OpCompositeExtract %type_2d_image %33 1
         %36 = OpCompositeExtract %_arr_T_uint_2 %32 1
         %37 = OpCompositeExtract %T %36 0
         %38 = OpCompositeExtract %_arr_type_sampler_uint_3 %37 0
         %39 = OpCompositeExtract %type_sampler %38 1
         %40 = OpCompositeExtract %T %36 1
         %41 = OpCompositeExtract %_arr_type_sampler_uint_3 %40 0
         %42 = OpCompositeExtract %type_sampler %41 2
         %43 = OpSampledImage %type_sampled_image %34 %39
         %44 = OpImageSampleImplicitLod %v4float %43 %14 None

This pattern could be seen if a global structure of resources is passed to a function.

@ehsannas ehsannas self-assigned this Jun 18, 2020
@ehsannas ehsannas requested a review from s-perron June 18, 2020 16:54
id_to_name_->insert({d->result_id(), d.get()});
// OpName and OpMemberName do not have result-ids. The target of the
// instruction is at InOperand index 0.
id_to_name_->insert({d->GetSingleWordInOperand(0), d.get()});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed an existing bug

Instruction* new_name_inst = new_name.get();
context()->AddDebug2Inst(std::move(new_name));
get_def_use_mgr()->AnalyzeInstDefUse(new_name_inst);
names_to_add.push_back(std::move(new_name));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed an existing bug

Copy link
Copy Markdown
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes in the comments. Otherwise it looks good.

@ehsannas
Copy link
Copy Markdown
Contributor Author

I realized that the check I had added missed cbuffers (cbuffers would have been expanded). I've updated the code to check for Offset decoration on the variable type to determine if a struct is a buffer.

@ehsannas
Copy link
Copy Markdown
Contributor Author

the CI-check-format failure is not relevant to my change. Looks like test/opt/loop_optimizations/loop_fission.cpp has bad formatting.

@ehsannas ehsannas requested a review from s-perron June 19, 2020 16:02
@s-perron s-perron merged commit 2a1b8c0 into KhronosGroup:master Jun 19, 2020
dneto0 pushed a commit to dneto0/SPIRV-Tools that referenced this pull request Sep 14, 2024
Roll third_party/glslang/ ebf55a0..8397044 (17 commits)

KhronosGroup/glslang@ebf55a0...8397044

$ git log ebf55a0..8397044 --date=short --no-merges --format='%ad %ae %s'
2020-06-22 gleese Update test expected files with new magic number
2020-06-22 gleese Update SPIR-V generator version
2020-06-05 gleese Update test results to expect OpFUnordNotEqual
2020-06-05 gleese Use OpFUnordNotEqual for floating-point !=
2020-06-22 johnkslang Update README.md
2020-06-19 bclayton Add kokoro configs for android-ndk and cmake
2020-06-19 bclayton Switch ndk_test from gnustl_static to c++_static
2020-06-17 ShabbyX Add -g0 command line argument
2020-06-16 cepheus Build: use better MSVC subfolder names for the previous build changes.
2020-06-16 cepheus Bump version numbers.
2020-06-16 bclayton Move hlsl/ source to glslang/HLSL/
2020-06-16 cepheus Bump version.
2020-06-15 bclayton CMake: Fold HLSL source into glslang
2020-06-15 dj2 Remove unused variable. (KhronosGroup#2273)
2020-06-15 rharrison Remove unused function, BaseTypeName (KhronosGroup#2272)
2020-06-15 cepheus HLSL: Remove support for having GLSL versions of HLSL intrinsics.
2020-06-10 bclayton C Interface: Split SPIR-V C interface to own file

Roll third_party/googletest/ 8567b0929..c6e309b26 (2 commits)

google/googletest@8567b09...c6e309b

$ git log 8567b0929..c6e309b26 --date=short --no-merges --format='%ad %ae %s'
2020-06-17 absl-team Googletest export
2020-06-15 absl-team Googletest export

Roll third_party/re2/ e9d517989..14d319322 (5 commits)

google/re2@e9d5179...14d3193

$ git log e9d517989..14d319322 --date=short --no-merges --format='%ad %ae %s'
2020-06-18 junyer Write tests for the move semantics.
2020-06-18 junyer Improve RE2::Set and FilteredRE2 move semantics.
2020-06-16 junyer Distinguish between missing ')' and unexpected ')'.
2020-06-16 junyer Make RE2::Set and FilteredRE2 movable.
2020-06-15 junyer Herp derp. It's actually constant-time append.

Roll third_party/spirv-cross/ 9e3df69d4..f9ae06512 (12 commits)

KhronosGroup/SPIRV-Cross@9e3df69...f9ae065

$ git log 9e3df69d4..f9ae06512 --date=short --no-merges --format='%ad %ae %s'
2020-06-22 dsinclair Roll deps and update tests.
2020-06-22 post MSL: Remove the old VertexAttr API.
2020-06-19 cwallez Fix placement of SPIRV_CROSS_DEPRECATED.
2020-06-19 post Fix duplicated initialization for loop variables with initializers.
2020-06-18 post MSL: Add test case for constructing struct with non-value-type array.
2020-06-18 post MSL: Deal with loading non-value-type arrays.
2020-06-18 post MSL: Add tests for array copies in and out of buffers.
2020-06-18 post MSL: Improve handling of array types in buffer objects.
2020-06-18 post Clean up some deprecation warnings when building with Makefile.
2020-06-18 post Remove unused member in MSLShaderInput.
2020-06-13 cdavis MSL: Fix up input variables' vector lengths in all stages.
2020-06-16 post HLSL: Fix texProj in legacy HLSL.

Roll third_party/spirv-tools/ 30bf46d..d4b9f57 (12 commits)

KhronosGroup/SPIRV-Tools@30bf46d...d4b9f57

$ git log 30bf46d..d4b9f57 --date=short --no-merges --format='%ad %ae %s'
2020-06-19 jaebaek [spirv-opt] debug info preservation in ssa-rewrite (KhronosGroup#3356)
2020-06-19 ehsannas Updated desc_sroa to support flattening structures (KhronosGroup#3448)
2020-06-19 vasniktel spirv-fuzz: Refactor variable creation (KhronosGroup#3414)
2020-06-19 vasniktel spirv-fuzz: Swap operands in OpBranchConditional (KhronosGroup#3423)
2020-06-18 stevenperron Use structured order to unroll loops. (KhronosGroup#3443)
2020-06-18 jaebaek Debug info preservation in dead branch elimination (KhronosGroup#3425)
2020-06-17 vasniktel Add RemoveParameter method (KhronosGroup#3437)
2020-06-17 vasniktel Fix return type (KhronosGroup#3435)
2020-06-16 ehsannas Eliminate branches with condition of OpConstantNull (KhronosGroup#3438)
2020-06-16 andreperezmaselco.developer spirv-fuzz: Implement vector shuffle fuzzer pass (KhronosGroup#3412)
2020-06-16 andreperezmaselco.developer spirv-fuzz: Add replace linear algebra instruction transformation (KhronosGroup#3402)
2020-06-15 dj2 Update access control lists. (KhronosGroup#3433)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants