Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-05Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)alan-baker
Fixes #4960 * Switches to using enum classes with an underlying type to avoid undefined behaviour
2022-11-02Add passes to eliminate dead output stores (#4970)Greg Fischer
This adds two passes to accomplish this: one pass to analyze a shader to determine the input slots that are live. The second pass is run on the preceding shader to eliminate any stores to output slots that are not consumed by the following shader. These passes support vert, tesc, tese, geom, and frag shaders. These passes are currently only available through the API. These passes together with dead code elimination, and elimination of dead input and output components and variables (WIP), will allow users to do dead code elimination across shader boundaries.
2022-09-27build: Fix BUILD.gn build error (#4948)Spencer Fricke
2022-09-23spirv-val: Add initial SPV_EXT_mesh_shader validation (#4924)Spencer Fricke
* Move TaskEXT check to OpEmitMeshTasksEXT * Add MeshNV for Execution Model alias
2022-08-08spirv-val: Add SPV_KHR_ray_tracing instructions (#4871)Spencer Fricke
2022-07-20spirv-val: Add SPV_KHR_ray_query (#4848)Spencer Fricke
2022-07-12Revert "Optimize DefUseManager allocations (#4709)" (#4846)Greg Fischer
This reverts commit d18d0d92e55f44da6af0dc87fb0e3c8034e9a3ac. This is reverted because it causes a 7X slowdown when legalizing SPIR-V with NonSemantic.Shader.DebugInfo.100 instructions. This is due to the creation of very large UseLists for several heavily used operands for this extension combined with the fact that the original commit changed the performance of Uselists to O(n).
2022-05-09spirv-opt: add pass for interface variable scalar replacement (#4779)Jaebaek Seo
Replace shader's stage variables whose types are array or matrix with scalars/vectors. For example, ``` Before: %foo = OpVariable %_ptr_Output__arr_v2float_uint_4 Output After: %foo = OpVariable %_ptr_Output_v2float Output %foo_0 = OpVariable %_ptr_Output_v2float Output %foo_1 = OpVariable %_ptr_Output_v2float Output %foo_2 = OpVariable %_ptr_Output_v2float Output ```
2022-05-06spirv-opt : Add FixFuncCallArgumentsPass (#4775)JiaoluAMD
spirv validation require OpFunctionCall with memory object, usually this is non issue as all the functions are inlined. This pass deal with some case for DontInline function. accesschain input operand would be replaced new created variable
2022-04-07Fix gen_build_version on Windows (#4780)Natalie Chouinard
* Fix gen_build_version on Windows The paths used in the gen_build_version script are causing some failures in downstream builds. Switch to using the location of the CHANGES file rather than the ".." parent directory workaround. * Update other build files
2022-03-28BUILD.gn: Fix standalone GN builds (#4765)Nicolas Capens
Standalone projects that depend on both SPIRV-Tools and SwiftShader failed to have Ninja build files generated because `build_with_chromium` is false for both of them and cause the executables to be declared twice. This change causes `build_with_chromium` builds to declare the executables, but only for the copy in `//third_party`. The path for that was also corrected to include the `vulkan-deps` and `src` subdirectories. Builds from the Fuchsia tree also declare the executable targets. This change was tested with a Chromium build and a "standalone" Dawn build. Bug: b/158002593
2022-03-23BUILD.gn: Enable independent builds within the Chromium tree (#4762)Nicolas Capens
GN does not allow multiple build files to declare the same executables, so for SwiftShader to be able to use its own internal copy of SPIRV- Tools libraries it needs to exclude the executable targets. This is achieved by checking if the current path is //third-party/ SPIRV-Tools/. Bug: b/158002593
2022-03-23spirv-opt: (WIP) Eliminate Dead Input Component Pass (#4720)Greg Fischer
This adds the --eliminate-dead-input-components pass which currently removes trailing unused components from input arrays. Fixes #4532
2022-03-07Add pass to remove DontInline function control (#4747)Steven Perron
Swift shader needs a way to inline all functions, even those marked as DontInline. See https://github.com/KhronosGroup/SPIRV-Tools/pull/4471. This implements the suggestion I made in the PR. We add a pass that will remove the DontInline function control, so that the inlining passes will inline them. SwiftShader will still have to modify their code to add this pass before the other passes are run.
2022-02-16Optimize DefUseManager allocations (#4709)pd-valve
* Optimize DefUseManager allocations Saves around 30-35% of compilation time. For inst->use_ids, use a pool linked list instead of allocating vectors for every instruction. For inst->uses, use a "PooledLinkedList"' -- a linked list that has shared storage for all nodes. Neither re-use nodes, instead we do a bulk compaction operation when too much memory is being wasted (tuneable). Includes separate PooledLinkedList templated datastructure, a very special case construct, but split out to make the code a little easier to understand.
2022-02-15Optimize Type::HashValue (#4707)pd-valve
Incrementally compute the hash instead of collecting words Avoids allocating temporary space in a std::vector and std::u32string, and making three passes over all the hashed data. Switch to using std::vector to prevent processing duplicates instead of std::unordered_set: avoids an allocation/deletion every call to ComputeHashValue, and ends up faster due to much better cache behaviour and smaller constant-factor when searching the (generally very small) list. In my test case, made Type::HashValue go from 7.5% of compilation time to .5%
2022-01-25spirv-opt: add pass to Spread Volatile semantics (#4667)Jaebaek Seo
Add a pass to spread Volatile semantics to variables with SMIDNV, WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask, SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn decorations or OpLoad for them when the shader model is the ray generation, closest hit, miss, intersection, or callable shaders. This pass can be used for VUID-StandaloneSpirv-VulkanMemoryModel-04678 and VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V Validation" section of Vulkan spec "Appendix A: Vulkan Environment for SPIR-V"). Handle variables used by multiple entry points: 1. Update error check to make it working regardless of the order of entry points. 2. For a variable, if it is used by two entry points E1 and E2 and it needs the Volatile semantics for E1 while it does not for E2 - If VulkanMemoryModel capability is enabled, which means we have to set memory operation of load instructions for the variable, we update load instructions in E1, but do not update the ones in E2. - If VulkanMemoryModel capability is disabled, which means we have to add Volatile decoration for the variable, we report an error because E1 needs to add Volatile decoration for the variable while E2 does not. For the simplicity of the implementation, we assume that all functions other than entry point functions are inlined.
2021-12-15Rename strip reflect to strip nonsemantic (#4661)Steven Perron
In https://github.com/KhronosGroup/SPIRV-Tools/pull/3110, the strip reflect pass was changed to also remove all explicitly nonsemantic instructions. This makes it so that the name of the pass no longer reflects what the pass actually does. This change renames the pass so that it reflects what the pass actaully does.
2021-10-27Add spirv-opt pass to replace descriptor accesses based on variable indices ↵Jaebaek Seo
(#4574) This commit adds a spirv-opt pass to replace accesses to descriptor array based on variable indices with constant elements. Before: ``` %descriptor = OpVariable %_ptr_array_Image Uniform ... %ac = OpAccessChain %_ptr_Image %descriptor %variable_index (some image instructions using %ac) ``` After: ``` %descriptor = OpVariable %_ptr_array_Image Uniform ... OpSwitch %variable_index 0 %case0 1 %case1 ... ... %case0 = OpLabel %ac = OpAccessChain %_ptr_Image %descriptor %uint_0 ... %case1 = OpLabel %ac = OpAccessChain %_ptr_Image %descriptor %uint_1 ... (use OpPhi for value with concrete type) ```
2021-09-23GN: Fix build for debuginfo codegen. (#4536)Jamie Madill
Fixes #4535
2021-09-15spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)Greg Fischer
Includes: - Shift to use of spirv-header extinst.nonsemantic.shader grammar.json - Remove extinst.nonsemantic.vulkan.debuginfo.100.grammar.json - Enable all optimizations for Shader.DebugInfo Also fixes scalar replacement to only insert DebugValue after all OpVariables. This is not necessary for OpenCL.DebugInfo, but it is for Shader.DebugInfo. Likewise, fixes Private-to-Local to insert DebugDeclare after all OpVariables. Also fixes inlining to handle FunctionDefinition which can show up after first block if early return processing happens. Co-authored-by: baldurk <baldurk@baldurk.org>
2021-08-18GN: Suppress unreachable code warnings. (#4476)Jamie Madill
These are popping up in a Chromium test integration. Fixes #4475
2021-08-18Add spirv-opt convert-to-sampled-image pass (#4340)Jaebaek Seo
convert-to-sampled-image pass converts images and/or samplers with given pairs of descriptor set and binding to sampled image. If a pair of an image and a sampler have the same pair of descriptor set and binding that is one of the given pairs, they will be converted to a sampled image. In addition, if only an image has the descriptor set and binding that is one of the given pairs, it will be converted to a sampled image as well. For example, when we have %a = OpLoad %type_2d_image %texture %b = OpLoad %type_sampler %sampler %combined = OpSampledImage %type_sampled_image %a %b %value = OpImageSampleExplicitLod %v4float %combined ... 1. If %texture and %sampler have the same descriptor set and binding %combine_texture_and_sampler = OpVaraible %ptr_type_sampled_image_Uniform ... %combined = OpLoad %type_sampled_image %combine_texture_and_sampler %value = OpImageSampleExplicitLod %v4float %combined ... 2. If %texture and %sampler have different pairs of descriptor set and binding %a = OpLoad %type_sampled_image %texture %extracted_image = OpImage %type_2d_image %a %b = OpLoad %type_sampler %sampler %combined = OpSampledImage %type_sampled_image %extracted_image %b %value = OpImageSampleExplicitLod %v4float %combined ...
2021-08-09spirv-opt: Add dataflow analysis framework (#4402)dong-ja
This PR adds a generic dataflow analysis framework to SPIRV-opt, with the intent of being used in SPIRV-lint. This may also be useful for SPIRV-opt, as existing ad-hoc analyses can be rewritten to use a common framework, but this is not the target of this PR.
2021-07-28Add control dependence analysis to opt (#4380)dong-ja
Control dependence analysis constructs a control dependence graph, representing the conditions for a block's execution relative to the results of other blocks with conditional branches, etc. This is an analysis pass that will be useful for the linter and potentially also useful in opt. Currently it is unused except for the added unit tests.
2021-07-26Fix public deps on generated headers (#4386)krockot
Some generated headers are exposed by headers in the spvtools_opt target, but its dependency on them is private. This can result in build flake, since the headers don't need to be generated before compiling any spvtools_opt dependents. This fixes the build flake by correctly expressing these as public dependencies.
2021-07-25BUILD.gn: introduce finer grained internal targets for Tint (#4399)Corentin Wallez
Tint reaches out into SPIRV-Tools BUILD.gn file for some targets: - Adds spvtools_include_gen_dirs so that Tint can add $target_gen_dir and find autogenerated files. - Adds spvtools_language_headers that Tint can reference so it automatically picks up new language headers that are added.
2021-07-20spirv-fuzz: TransformationWrapVectorSynonym that rewrites scalar operations ↵Shiyu Liu
using vectors (#4376) Adds a new transformation that rewrites a scalar operation (like OpFAdd, opISub) as an equivalent vector operation, adding a synonym between the scalar result and an appropriate component of the vector result. Fixes #4195.
2021-07-16Add common enum for debug info instructions from either opencl or vulkan (#4377)Greg Fischer
Co-authored-by: baldurk <baldurk@baldurk.org>
2021-07-15Add missing fuzzer header dependency. (#4381)Jamie Madill
Should fix the failing GN header check where the reduce header was not visible to the fuzzer target. Also reformats the GN file using 'gn format'.
2021-07-14Fix BUILD.gn (#4378)Alastair Donaldson
This change restricts BUILD.gn so that spirv-fuzz-related targets are only built when in a Chromium checkout. This is due to their dependence on protobuf, which is available in gn-friendly form in Chromium only. Fixes https://crbug.com/tint/987
2021-07-13spirv-fuzz: support building using gn (#4365)Alastair Donaldson
Adds support for building spirv-fuzz using gn. Updates the protobuf dependency to the version used by Chromium. Fixes #4372.
2021-07-13Fix vendor table build in BUILD.gn for nonsemantic.vulkan.debuginfo.100 (#4375)Greg Fischer
Fixes #4374
2021-07-12Add non-semantic vulkan extended instruction set (#4362)Greg Fischer
This is based on a legacy commit which installs a local grammar. A followup commit will change to the grammar in SPIRV-Headers. Co-authored-by: baldurk <baldurk@baldurk.org>
2021-07-06spirv-reduce: Eliminate skeletal structured control flow construct (#4360)Alastair Donaldson
This change allows spriv-reduce to get rid of a selection, switch or loop construct if none of the instructions defined in the construct are used outside the construct.
2021-07-02Add remove_unused_interface_variable_pass.* to BUILD.gn (#4363)Steven Perron
2021-04-12Fix UWP build (#4235)Shahbaz Youssefi
UWP doesn't support system(), so skip building spirv-reduce on it similarly to iOS.
2021-03-31Add interpolate legalization pass (#4220)Greg Fischer
This pass converts an internal form of GLSLstd450 Interpolate ops to the externally valid form. The external form takes the lvalue of the interpolant. The internal form can do a load of the interpolant. The pass replaces the load with its pointer. The internal form is generated by glslang and possibly other frontends for HLSL shaders. The new pass is called as part of HLSL legalization after all propagation is complete. Also adds internal interpolate form to pre-legalization validation
2021-03-11BUILD.gn: fix typo for 'cflags' (#4169)Corentin Wallez
2021-03-10Suppress warning (#4168)Corentin Wallez
* GN: Format BUILD.gn using 'gn format' * GN: Suppress -Wformat-truncation on GCC for a Skia builder
2021-01-15Remove WebGPU support (#4108)Ryan Harrison
Leaves SPV_ENV_WEBGPU_0 enum in place, but marked deprecated, so users of the library are not broken by an API enum being removed. Fixes #4101
2020-10-31Temporarily add EmptyPass to prevent glslang from failing (#4004)Jaebaek Seo
Removing PropagateLineInfoPass and RedundantLineInfoElimPass from 56d0f5035 makes unit tests of many open source projects fail. It will happen before submitting this glslang PR https://github.com/KhronosGroup/glslang/pull/2440. This commit will be git-reverted after merging the glslang PR.
2020-10-29Propagate OpLine to all applied instructions in spirv-opt (#3951)Jaebaek Seo
Based on the OpLine spec, an OpLine instruction must be applied to the instructions physically following it up to the first occurrence of the next end of block, the next OpLine instruction, or the next OpNoLine instruction. ``` OpLine %file 0 0 OpNoLine OpLine %file 1 1 OpStore %foo %int_1 %value = OpLoad %int %foo OpLine %file 2 2 ``` For the above code, the current spirv-opt keeps three line instructions `OpLine %file 0 0`, `OpNoLine`, and `OpLine %file 1 1` in `std::vector<Instruction> dbg_line_insts_` of Instruction class for `OpStore %foo %int_1`. It does not put any line instruction to `std::vector<Instruction> dbg_line_insts_` of `%value = OpLoad %int %foo` even though `OpLine %file 1 1` must be applied to `%value = OpLoad %int %foo` based on the spec. This results in the missing line information for `%value = OpLoad %int %foo` while each spirv-opt pass optimizes the code. We have to put `OpLine %file 1 1` to `std::vector<Instruction> dbg_line_insts_` of both `%value = OpLoad %int %foo` and `OpStore %foo %int_1`. This commit conducts the line instruction propagation and skips emitting the eliminated line instructions at the end, which are the same with PropagateLineInfoPass and RedundantLineInfoElimPass. This commit removes PropagateLineInfoPass and RedundantLineInfoElimPass. KhronosGroup/glslang#2440 is a related PR that stop using PropagateLineInfoPass and RedundantLineInfoElimPass from glslang. When the code in this PR applied, the glslang tests will pass.
2020-09-12Add missing file to BUILD.gn (#3798)Alastair Donaldson
Fixes #3797.
2020-07-30Validator support for non-semantic clspv reflection (#3618)alan-baker
* Generate ext inst table for reflection * Change build to use grammar files from SPIRV-Headers instead of SPIRV-Tools * Add enum for clspv reflection extended instruction set * count it as non-semantic * validate clspv reflection extended instruction set * Remove local extended inst sets * update headers deps * Update nbuilds to use grammars from SPIRV-Headers instead of local duplicates
2020-05-19Add in a bunch of missed files to the BUILD.gn (#3360)Ryan Harrison
Fixes #3357
2020-05-19Remove stale entries from BUILD.gn (#3358)Ryan Harrison
Fixes #3357
2020-04-27Add debug information analysis (#3305)Jaebaek Seo
We need an analysis for OpenCL.DebugInfo.100 extension instructions such as a map between function id and its DebugFunction. This commit add an analysis for it.
2020-03-12Instrument: Debug Printf support (#3215)greg-lunarg
Create a pass to instrument OpDebugPrintf instructions. This pass replaces all OpDebugPrintf instructions with instructions to write a record containing the string id and the all specified values into a special printf output buffer (if space allows). This pass is designed to support the printf validation in the Vulkan validation layers. Fixes #3210
2020-02-25Combine extinst-name and extinst-output-base into one arg. (#3200)Geoff Lang
* Combine the extinst-name and extinst-output-base into one arg. Some build systems such as Android blueprints require that the inputs and outputs of generator scripts are all provided as arguments. These two arguments to generate_language_headers.py are combined to form the output path in the script. This change simply lets the user provide the whole output path as an argument. * Fix typo in build_defs.bzl and update Android.mk