Commit Graph

3394 Commits

Author SHA1 Message Date
Daniele Vettorel
671f6e633f
Revert "Add folding rule to generate Fma instructions (#4783)" (#4785)
This reverts commit 2b2b0282af.
2022-04-20 10:55:20 -04:00
Steven Perron
2b2b0282af
Add folding rule to generate Fma instructions (#4783)
Adding Fma instruction can speed up the code.  This was requested by
swiftshader, so they do not have to do this analysis themselves.  It can
also help reduce the code size, and the work the ICD compilers have to
do.
2022-04-19 11:25:07 -04:00
Chad Versace
cb96abbf7a
Fix CMake for librt (#4773)
In the installed file
/usr/lib64/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake, occurences of
librt in the INTERFACE_LINK_LIBRARIES property are incorrect.  The
property contains the absolute path to librt. In most situations, this
produces no problem. But when building in a sysroot, which is commonly
done when cross-compiling, the absolute path breaks dependent projects.

For example, when building spirv-tools using the Chrome OS SDK, and
targeting the board 'volteer', where the build sysroot is
'/build/volteer', the file includes this line
    INTERFACE_LINK_LIBRARIES "/build/volteer/usr/lib64/librt.so"
when it should instead say
    INTERFACE_LINK_LIBRARIES "rt"

The CMake documentation agrees [1]:
    Note that it is not advisable to populate the
    INTERFACE_LINK_LIBRARIES of a target with absolute paths to
    dependencies. That would hard-code into installed packages the
    library file paths for dependencies as found on the machine the
    package was made on.

[1] https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES.html
2022-04-14 09:04:12 -04:00
Steven Perron
898ba64d24
Use cmake 3.23 on Windows. (#4782) 2022-04-13 13:56:19 -04:00
Steven Perron
92c17edde7
Don't try to unroll loop with step count 0. (#4769)
These loop are infinite loop, so there is no reason to unroll the loop.
Fixes #4711.
2022-04-11 10:21:15 -04:00
Natalie Chouinard
c1bb0b9415 Start SPIRV-Tools v2022.3-dev 2022-04-07 19:24:58 +00:00
Natalie Chouinard
7826e1941e Finalize SPIRV-Tools v2022.2 2022-04-07 19:21:52 +00:00
Natalie Chouinard
67fdf94097 Update CHANGES 2022-04-07 14:48:13 +00:00
Natalie Chouinard
78a0f075ac
Fix gen_build_version on Windows (#4780)
* 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-04-07 13:19:05 +00:00
Natalie Chouinard
eed5c76a57 Update CHANGES 2022-04-04 19:34:27 +00:00
Natalie Chouinard
c445b146bc Roll external/spirv-headers/ 6a55fade6..4995a2f27 (8 commits)
6a55fade62...4995a2f272

$ git log 6a55fade6..4995a2f27 --date=short --no-merges --format='%ad %ae %s'
2022-03-03 nikita.kornev Remove extensions tag from instructions
2022-02-18 nikita.kornev Implement SPV_KHR_uniform_group_instructions extension
2022-02-12 ben.ashbaugh update SPIR-V headers for SPV_INTEL_split_barrier
2022-02-08 prokop regenerate headers
2022-01-31 gleese Add EXT tag to capability to DemoteToHelperInvocationEXT
2022-01-28 tdb Reserve enum range for MSP extensions
2022-01-05 prokop regenerate the headers
2022-01-04 prokop Include bool type for C

Created with:
  roll-dep external/spirv-headers
2022-04-04 18:56:31 +00:00
Natalie Chouinard
f59db5cfe8 Roll external/re2/ 611baecbc..0c5616df9 (14 commits)
611baecbce...0c5616df9c

$ git log 611baecbc..0c5616df9 --date=short --no-merges --format='%ad %ae %s'
2022-03-30 junyer Replace `StdIntMap` with `std::vector<int>`.
2022-03-24 junyer Use `std::unordered_map<int, int>` for `StdIntMap`.
2022-03-22 junyer Remove `xkcd.png`, which is disused.
2022-03-18 junyer Prog::Fanout() is no longer experimental.
2022-03-15 junyer Fall back to std::shared_mutex, not std::mutex.
2022-03-15 junyer Set CMAKE_CXX_STANDARD if we seem to need to set it. :/
2022-03-15 junyer Don't specify CMAKE_CXX_STANDARD anymore either.
2022-03-11 slyich Don't overwrite testinstall.cc in testinstall.
2022-03-03 junyer Add Clang 14 to the build matrix.
2022-02-24 junyer Simplify OS selection in Bazel by using @platforms.
2022-02-17 junyer Check __cpp_lib_string_view, not __cplusplus.
2022-01-27 junyer Oops, I think I needed pull_request_target instead.
2022-01-27 junyer Close all GitHub pull requests automatically.
2022-01-27 junyer Handle older macOS SDKs not defining TARGET_OS_OSX.

Created with:
  roll-dep external/re2
2022-04-04 18:56:29 +00:00
Natalie Chouinard
047db9731e Roll external/googletest/ f45d5865e..25dcdc7e8 (26 commits)
f45d5865ed...25dcdc7e8b

$ git log f45d5865e..25dcdc7e8 --date=short --no-merges --format='%ad %ae %s'
2022-04-04 dmauro Use the Abseil flags library when Abseil is present
2022-03-23 absl-team Address deprecation warning surfaced by Github presubmit tests
2022-03-23 mattias.ellert Split gmock-matchers_test into 4 smaller test #3653
2022-03-22 absl-team Only print disabled test banner if the test matches gtest_filter
2022-03-21 absl-team Clarify public access on gmock examples.
2022-03-18 bmesser Remove sanity as it is offensive to neurodiverse individuals.
2022-03-15 absl-team Running clang-format over all of GoogleTest
2022-03-14 dinor Remove references to deleted script gen_gtest_pred_impl.py
2022-03-08 absl-team Mark ACTION_Pn()-generated functions as must-use-result, adding non-compilation tests.
2022-03-08 sobik.szymon Add myself to contributors
2022-03-08 sobik.szymon Adjust documentation regarding xml and json source file location otput.
2022-03-08 sobik.szymon Adjust xml and json unit tests to test for source file and line location.
2022-03-08 sobik.szymon Add support for testing of xml and json output of source file and line location
2022-03-08 sobik.szymon Output source file path and line number in xml and json files.
2022-02-17 dmauro Update GCC/Clang Linux tests to use Bazel 5.0.0
2022-02-14 absl-team Address conversion warning by explicitly casting to size_t
2022-02-09 absl-team Add a 3-arg overload for ResultOf() matcher that takes a description string for better error messages.
2022-02-05 hgsilverman Apply requested changes by using std::inserter with move.
2022-02-05 noiseless-ak Fix gtest-help-test failure on OpenBSD
2022-02-01 absl-team GetCurrentOsStackTraceExceptTop (both the method of UnitTestImpl and the wrapper function in gtest.cc) rely on the fact that the inner call is not getting optimized. This CL annotates them with the appropriate attributes.
2022-01-29 hgsilverman Do constant time matching for exact match filters.
2022-01-28 dmauro Finish some missed pieces of the TestCase to TestSuite Migration
2022-01-26 dinor Change `ReturnArg` to use perfect forwarding of arguments (#3733)
2022-01-25 melroy Let me give a change to try it again - updating to latest version
2022-01-05 73706994+jjfvanderpol Set CMake Policy CMP0077 to NEW
2021-10-19 deniz CMake: Fix values of INTERFACE_INCLUDE_DIRECTORIES property

Created with:
  roll-dep external/googletest
2022-04-04 18:56:27 +00:00
Nico Weber
b0ce31fd2d
Suppress -Wunused-but-set-variable on variable (#4777)
sentinel_count is not used in non-assert builds.

Recent clang improvements to -Wunused-but-set-variable trigger a warning on this.

Fixes #4772.
2022-04-01 17:07:05 +01:00
Shahbaz Youssefi
5760114d77
spirv-diff: Fix OpTypeFunction matching w.r.t operand count (#4771)
The code accidentally expected OpTypeFunction operand count to match.
This is fixed so that OpTypeFunction instructions with different operand
counts are considered not matching.
2022-04-01 09:04:26 -04:00
Shahbaz Youssefi
bd325d2984
spirv-diff: Basic support for OpTypeForwardPointer (#4761)
Currently, the diff tool matches types bottom up, so on every
instruction it expects to know if its operands are already matched or
not.  With cyclical references, it cannot know that.  Type matching
would need significant rework to be able to support such a use case; for
example, it may need to maintain a set of plausable matches between type
pointers that are forward-referenced, and potentially back track when
later the types turn out to be incompatible.

In this change, OpTypeForwardPointer is supported in the more common and
trivial case.  Firstly, forwarded type pointers are only matched if they
have they have the same storage class and point to the same type opcode:

- In the presence of debug info, matching is done only if the names are
  unique in both src and dst.
- In the absence of debug info, matching is done only if there is only
  one possible matching.

Fixes: #4754
2022-03-28 17:01:07 +00:00
sfricke-samsung
0c670ef1d9
spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
Shahbaz Youssefi
40cd21839c
spirv-diff: Use GetSingleWord*Operand (#4768) 2022-03-28 14:42:47 +00:00
Nicolas Capens
7841afd98e
BUILD.gn: Fix standalone GN builds (#4765)
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-28 14:22:33 +00:00
Jaebaek Seo
05745cc9d4
Handle shaders without execution model in spread-volatile-semantics (#4766)
spread-volatile-semantics pass spreads Volatile semantics for builtin
variables used by certain execution models based on
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"). Therefore, shaders without execution model (e.g., used only
for linkage) are not the target of the pass. This commit lets the pass
just return SuccessWithoutChange in that case.
2022-03-25 17:54:46 +00:00
sfricke-samsung
fa5d424830
spirv-val: Add more Vulkan VUID labels (#4764) 2022-03-25 09:29:19 -04:00
Nikita
a3fbc9331b
Support SPV_KHR_uniform_group_instructions (#4734) 2022-03-25 08:32:50 -04:00
Shahbaz Youssefi
48c8363f0a
spirv-diff: Refactor instruction grouping and matching (#4760)
In preparation for supporting OpTypeForwardPointer, which adds more
usages like this.  This change refactors common code used to group
instructions and match the groups.
2022-03-24 18:04:48 +00:00
sfricke-samsung
90728d2dff
spirv-val: Clean up VariablePointers logic (#4755) 2022-03-24 12:02:29 -04:00
Roy.li
cab0b7715a
Use types have same widths in loop condition. (#4763) 2022-03-24 14:07:22 +00:00
sfricke-samsung
b3c1790632
spirv-val: Add Vulkan 32-bit bit op Base (#4758) 2022-03-23 13:55:42 -04:00
sfricke-samsung
9668d2e4e4
spirv-val: Label and add test for PSB Aligned (#4756) 2022-03-23 11:08:21 -04:00
Nicolas Capens
c6d5474f45
BUILD.gn: Enable independent builds within the Chromium tree (#4762)
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-23 09:19:12 -04:00
Greg Fischer
9d1b572884
spirv-opt: (WIP) Eliminate Dead Input Component Pass (#4720)
This adds the --eliminate-dead-input-components pass which currently
removes trailing unused components from input arrays.

Fixes #4532
2022-03-22 20:50:52 -06:00
sfricke-samsung
f8cd51431e
spirv-val: Add better error code for invalid operand (#4753) 2022-03-22 15:37:38 -04:00
Daniel Thornburgh
3820c4f6e2
Qualify std::move. (#4741)
Clang added -Wunqualified-std-cast-call in
https://reviews.llvm.org/D119670, which warns on unqualified std::move
and std::forward calls. This change qualifies these calls to allow the
project to build on HEAD Clang -Werror.
2022-03-22 11:20:11 -04:00
sfricke-samsung
0ab57c2c42
spirv-val: Small Cleanup of validate image (#4752) 2022-03-14 11:08:47 -04:00
sfricke-samsung
7963fa13c7
spirv-val: Add Vulkan Dref not allowed 3D dim VUID (#4751) 2022-03-10 13:08:26 -05:00
sfricke-samsung
5c9d55a59a
spirv-val: Add Vulkan Image VUID 06214 (#4750) 2022-03-10 13:06:48 -05:00
sfricke-samsung
9700708570
spirv-val: Label Vulkan RuntimeArray VUID (#4749) 2022-03-10 13:05:26 -05:00
sfricke-samsung
ca59914c7a
spirv-val: Disallow array of push constants (#4742) 2022-03-10 12:57:20 -05:00
Steven Perron
0741f42738
Reset the id bound on the module in compact ids (#4744)
If the body of the module does not have any ids change, compact ids will
not change the id bound.  This can cause problems because the id bound
could be much higher than the largest id in that is used.  It should be
reset any time it is not the larger id used + 1.

Fixes #4604
2022-03-07 20:33:01 +00:00
Steven Perron
48a36c72e4
Better handling of 0xFFFFFFFF when folding vector shuffle (#4743)
When folding a vector shuffle feeding a vector shuffle, we do not
propagate an 0xFFFFFFFF, which has a special meaning, correctly.  We
adjust the value making it lose it meaning as an undefined value.

Fixes #4581
2022-03-07 19:35:57 +00:00
Steven Perron
4fa1a6f9b4
Generalize assert in ccp (#4735)
CCP does not want to fold an instruction unless it folds to a constant.
There is an asser to check for this.  The question if a spec constant
counts as a constant.  The constant folder considers a spec constant a
constand, but CCP does not.  I've fixed the assert in CCP to match what
the folder does.  It should not require any new changes to CCP.
2022-03-07 19:33:10 +00:00
Steven Perron
196f638d73
Update bazel output directory in gitignore. (#4746) 2022-03-07 18:30:03 +00:00
IcyTv
98dce6ca18
Fixed Bazel Windows build (#4736)
* Fixed Bazel Windows build

Before this commit, the bazel build setup would not work on windows.
This is due to the fact, that genrule tries to use bash, which fails.
One fix would be to use bazel-skylib's run_binary.
This however does not work (easily) since genrules is more complex.

To (temporarily) fix the windows build, I added the `cmd_bat` property to every genrule.
This seems more like a hack, because it basically repeat commands,
 but for now it at least builds on windows.

* Removed BAZEL_SH from bazel presubmit build script

Thanks to @s-perron for pointing out, that the presubmit script uses the msys64 bash shell for the bazel build.
Since adding the `cmd_bat` argument removes the dependency on bash, this is no longer needed.
2022-03-07 12:50:19 -05:00
Steven Perron
920156cf18
Add pass to remove DontInline function control (#4747)
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-03-07 12:45:17 -05:00
sfricke-samsung
273d2a45ad
spirv-val: Label VUID 06491 (#4745) 2022-03-07 12:30:05 -05:00
Steven Perron
0b8426346d
Don't rebuilt valid analyses. (#4733)
The function `BuildInvalideAnalyses` will be rebuilt for every analysis that
has been requested, but it is not necessary.  It also can cause problems
because if the CFG needs to be rebuilt, so do the dominator trees.

This change will make the functionality match the description of the
function.
2022-03-04 20:16:42 +00:00
sfricke-samsung
d1addc44b2
spirv-val: Label Vulkan VUID 04734 (#4739) 2022-03-04 10:07:24 -05:00
Jeremy Hayes
598bc6744a
spirv-val: Validate DebugTypeMatrix (#4732) 2022-03-04 08:54:05 -05:00
Steven Perron
f56726a323
Use bazel 5 for bazel builds. (#4738)
* Use bazel 5 for Linux bazel builds.
* Download bazel 5.0.0 for macos and windows bazel builds.
* Modify the readme to mention bazel 5.0.0 as the version to use.
2022-03-03 15:35:25 +00:00
pd-valve
d18d0d92e5
Optimize DefUseManager allocations (#4709)
* 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-15 19:17:30 -05:00
pd-valve
a123632ed9
Optimize Type::HashValue (#4707)
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-02-15 18:57:39 +00:00
sfricke-samsung
471428a04f
spirv-opt: Add OpExecutionModeId support (#4719)
Needed for Vulkan1.3 adding LocalSizeId support
2022-02-14 14:33:29 +00:00