Commit Graph

3875 Commits

Author SHA1 Message Date
Nathan Gauër
0f17d05c48
opt: add bitmask support for capability trimming (#5372)
Some operands are not simple values, but bitmasks.
The lookup in the table for required decomposing the mask into
single values.
This commit adds support for such operands, like MinLod|Offset.
2023-08-15 09:50:57 -04:00
github-actions[bot]
fddcc8cedc
Roll external/re2/ 9dc7ae7b5..6148386f0 (3 commits) (#5379)
9dc7ae7b52...6148386f0c

$ git log 9dc7ae7b5..6148386f0 --date=short --no-merges --format='%ad %ae %s'
2023-08-11 junyer Add support for `(?<name>expr)`.
2023-08-11 junyer Add a `WORKSPACE.bzlmod` file.
2023-08-11 junyer Migrate to Bzlmod.

Created with:
  roll-dep external/re2

Co-authored-by: GitHub Actions[bot] <>
2023-08-14 10:12:05 -04:00
Viktoria Maximova
7ddc65c722
Support 2 Intel extensions (#5357)
* SPV_INTEL_global_variable_fpga_decorations
Spec:
https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_fpga_decorations.asciidoc

* SPV_INTEL_global_variable_host_access
Spec:
https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc

This change follows headers change:
https://github.com/KhronosGroup/SPIRV-Headers/pull/356
2023-08-11 11:53:24 -04:00
github-actions[bot]
43b8886490
roll deps (#5374)
* Roll external/googletest/ 89b25572d..7e33b6a1c (1 commit)

89b25572db...7e33b6a1c4

$ git log 89b25572d..7e33b6a1c --date=short --no-merges --format='%ad %ae %s'
2023-08-10 absl-team Specify SetUpTestSuite is required to be public.

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ 124a9665e..45fc02a6c (2 commits)

124a9665e4...45fc02a6c6

$ git log 124a9665e..45fc02a6c --date=short --no-merges --format='%ad %ae %s'
2023-08-10 dneto Revert "Merge pull request #367 from dneto0/coop-matrix-enums-deps"
2023-07-29 konstantin.seurer Add SPV_AMDX_shader_enqueue

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-08-11 15:05:25 +00:00
Ryan Harrison
d6300ee92b
Fix -Wunreachable-code-loop-increment warning (#5373) 2023-08-10 19:41:20 +00:00
Nathan Gauër
8714d7fad2
enable StorageUniform16 (#5371)
Adds support for the StorageUniform16 capability.
2023-08-10 13:54:31 -04:00
David Neto
8e3da01b45
Move token version/cap/ext checks from parsing to validation (#5370)
A token is allowed to parse even when it's from the wrong
version, or is not enabled by a capability or extension.
This allows more modules to parse.

Version/capability/extension checking is fully moved to
validation instead.

Fixes: #5364
2023-08-10 12:19:12 -04:00
Nathan Gauër
4788ff1578
opt: add StorageUniformBufferBlock16 to trim pass (#5367)
Add StorageUniformBufferBlock16 to the list of enabled capabilities.
2023-08-10 14:21:35 +00:00
Nathan Gauër
ebda56e352
opt: add StoragePushConstant16 to trim pass (#5366)
* opt: add StoragePushConstant16 to trim pass

* fix comment
2023-08-10 12:34:46 +00:00
github-actions[bot]
3af4244ae1
Roll external/googletest/ 46db91ef6..89b25572d (1 commit) (#5365)
46db91ef6f...89b25572db

$ git log 46db91ef6..89b25572d --date=short --no-merges --format='%ad %ae %s'
2023-08-03 elliotgoodrich Remove public includes of `<iomanip>`

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-08-09 14:30:42 +00:00
Nathan Gauër
60e684fe71
opt: fix StorageInputOutput16 trimming. (#5359)
* opt: fix StorageInputOutput16 trimming.

While integrating this pass into DXC, I found a lot of missing
cases. This PR fixes a few issues centered around this capability
while laying out fondations for more fixes.

1. The grammar can define extensions in operand & opcode tables.
   - opcode can rely on common capabilities, but require a new
     extension.
   - opcode can also rely on a capability which requires an extension.
   Sometimes, the extension is listed twice, in the opcode, and
   capability. But this redundancy is not guaranteed.

2. minVersion check. The condition was flipped: we added the extension
   when the minVersion was less than current.
   Didn't noticed the issue as I only tests on the default env.

3. Capability/Extension instructions were not ignored.
   - `OpCapability Foo` will require the `Foo` capability.
   - it doesn't mean the module requires the `Foo` capability.
   Same for extensions.

This commit adds disabled tests, for fixes which are too large to
be brought into this already large PR.
2023-08-09 06:30:23 -04:00
github-actions[bot]
13892fe867
Roll external/googletest/ 6f6ab4212..e7fd109b5 (2 commits) (#5356)
* Roll external/googletest/ 6f6ab4212..46db91ef6 (9 commits)

6f6ab4212a...46db91ef6f

$ git log 6f6ab4212..46db91ef6 --date=short --no-merges --format='%ad %ae %s'
2023-08-07 dinor Make references to `#include`s consistent across docs
2023-08-02 robert.shade Avoid unreachable code warning
2023-08-02 dmauro Update documentation to refer to v1.14
2023-08-02 dmauro Bump version to v1.14 in preparation for release
2023-08-02 dmauro Remove the GTEST_HAS_DOWNCAST_ customization point.
2023-08-02 dmauro Add googletest-message-test to the Bazel tests It appears to have been unintentionally left out
2023-08-01 phoebeliang Make testing::Message support streamed AbslStringify values
2023-08-01 dmauro Update GoogleTest dependencies
2023-07-27 patryk gtest: Supress warning about set unused variable

Created with:
  roll-dep external/googletest

* Roll external/re2/ 960c86176..9dc7ae7b5 (1 commit)

960c861764...9dc7ae7b52

$ git log 960c86176..9dc7ae7b5 --date=short --no-merges --format='%ad %ae %s'
2023-08-04 junyer Minor Bazel cleanups.

Created with:
  roll-dep external/re2

---------

Co-authored-by: GitHub Actions[bot] <>
2023-08-08 16:26:59 +00:00
Sven van Haastregt
727f4346db
docs: update references to main branch (#5363)
The default branch was renamed from `master` to `main`.  Update some
stale references.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-08-08 11:53:33 -04:00
Nathan Gauër
e553b884c7
Prepare release for v2023.4.rc2 (#5362) 2023-08-08 15:41:26 +02:00
Natalie Chouinard
4a9881fe9b
Use absolute path to depot_tools (#5360)
The autoroll workflow is currently failing due to being unable to find
some depot_tools executables. This is due to a limitation in Go os/exec
which effectively rejects all relative paths in PATH, and is exposed by
a recent update to depot_tools
(https://crrev.com/43083529de5802a83f53f1d53d7f5f9615999996).
2023-08-04 18:01:50 -04:00
David Neto
09b76c23ea
Update SPIRV-Headers; test some coop matrix enums (#5361)
Test:
  MatrixASignedComponentsKHR
  MatrixBSignedComponentsKHR
  MatrixCSignedComponentsKHR
  ResultSignedComponentsKHR
2023-08-04 14:50:54 -04:00
Nathan Gauër
1d14d84f29
opt: fix missing CreateTrimCapabilitiesPass definition (#5353) 2023-08-02 11:52:53 +02:00
Jeremy Gebben
47fff21d52
instrument: Reduce number of inst_bindless_stream_write_6 calls (#5327)
Multiple calls to this function were causing vkCreateGraphicsPipelines
to be 3x slower on some driver. I suspect this was because each
call had to be inlined separately which bloated the code and caused
more work in the driver's SPIRV -> native instruction compilation.
2023-08-01 13:49:12 -06:00
github-actions[bot]
02cd71d41c
roll deps (#5352)
* Roll external/googletest/ 40412d851..6f6ab4212 (2 commits)

40412d8512...6f6ab4212a

$ git log 40412d851..6f6ab4212 --date=short --no-merges --format='%ad %ae %s'
2023-07-27 julien.combattelli Use #if and not #ifdef to check filesystem support
2023-07-28 absl-team Adjust includes to use <> instead of "", consistent with quickstart pages.

Created with:
  roll-dep external/googletest

* Roll external/re2/ e66463312..960c86176 (10 commits)

e66463312e...960c861764

$ git log e66463312..960c86176 --date=short --no-merges --format='%ad %ae %s'
2023-07-28 junyer Don't try to support ARM64 on Windows yet.
2023-07-28 junyer Try again to make cross-compiling on Windows work.
2023-07-28 junyer `bazelbuild/setup-bazelisk` doesn't work for some reason.
2023-07-28 junyer Bazelisk isn't installed with Chocolatey, apparently.
2023-07-28 junyer Avoid the Chocolatey install of Bazel(isk) getting in the way.
2023-07-28 junyer Try using `bazelbuild/setup-bazelisk` everywhere.
2023-07-28 junyer Tell the Python build where Bazelisk is.
2023-07-28 junyer Explicitly invoke Bazelisk rather than Bazel.
2023-07-28 junyer Avoid `Conflicts: python3-lldb-x.y` between packages.
2023-07-28 junyer Prepare to release `google-re2` 1.1.

Created with:
  roll-dep external/re2

* Roll external/spirv-headers/ 51b106461..ae89923fa (1 commit)

51b1064617...ae89923fa7

$ git log 51b106461..ae89923fa --date=short --no-merges --format='%ad %ae %s'
2023-07-26 kevin.petit Add KHR suffix to Cooperative Matrix Operands

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-08-01 17:00:00 +00:00
Steven Perron
e68fe9be4e
Add SPV_EXT_shader_atomic_float_add to allow lists (#5348)
Fixes #5346
2023-07-27 16:04:50 -07:00
Nathan Gauër
c6d0b04802
build: fix missing files in BUILD.gn (#5351)
PR #5278 added 2 new files, but they were not added to the BUILD.gn file.
Same fix for Android.mk.

Fixes #5350
2023-07-27 11:21:23 -04:00
github-actions[bot]
b5f600c08c
Roll external/googletest/ 01e18376e..40412d851 (1 commit) (#5347)
01e18376ef...40412d8512

$ git log 01e18376e..40412d851 --date=short --no-merges --format='%ad %ae %s'
2023-07-19 antsosnin Fix typo in gmock_cook_book.md

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-07-26 11:07:23 -04:00
ncesario-lunarg
a0f1c87272
opt: Fix incorrect half float conversion (#5349)
Fixes image operands not decorated as relaxed from
getting marked relaxed and converted to half precision.

Fixes #5044.
2023-07-26 10:03:24 -04:00
Nathan Gauër
35d8b05de4
opt: add capability trimming pass (not default). (#5278)
This commit adds a new optimization which tries to remove unnecessary
capabilities from a SPIR-V module.

When compiling a SPIR-V module, you may have some dead-code using
features gated by a capability.
DCE will remove this code, but the capability will remain. This means
your module would still require some capability, even if it doesn't
require it. Calling this pass on your module would remove obsolete
capabilities.

This pass wouldn't be enabled by default, and would only be usable
from the API (at least for now).

NOTE: this commit only adds the basic skeleton/structure, and
doesn't mark as supported many capabilities it could support.
I'll add them as supported as I write tests.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-25 16:52:41 +02:00
github-actions[bot]
ec90d2872a
roll deps (#5345)
* Roll external/googletest/ 1ed6a8c67..01e18376e (1 commit)

1ed6a8c67a...01e18376ef

$ git log 1ed6a8c67..01e18376e --date=short --no-merges --format='%ad %ae %s'
2023-07-21 absl-team Make `AbslStringify` usage public in GoogleTest

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ 14914db17..51b106461 (1 commit)

14914db17a...51b1064617

$ git log 14914db17..51b106461 --date=short --no-merges --format='%ad %ae %s'
2023-07-21 arvind.sudarsanam Recommit PR #348 - Add fp-max-error support (#363)

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-07-24 10:15:44 -04:00
Steven Perron
d52c39c37d
Do not crash when folding 16-bit OpFDiv (#5338)
The code currently tries to get the value of the floating point constant
to see if it is -0.0. However, we are not able to get the value for
16-bit floating point value, and we hit an assert.

To avoid this, we add an early check for the width to make sure it is
either 32 or 64.

Fixes https://github.com/microsoft/DirectXShaderCompiler/issues/5413.
2023-07-21 10:17:12 -04:00
Nathan Gauër
17d9669d51
enumset: add iterator based constructor/insert (#5344)
Expanding a bit the EnumSet API to have iterator-based
insert and constructors (like the STL).
This is also a pre-requisite from the capability-trimming pass as
it allows to build a const set from a constexpr std::array easily.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-20 17:54:50 +00:00
github-actions[bot]
daad2295c9
Roll external/googletest/ cc366710b..d66ce5851 (2 commits) (#5337)
* Roll external/googletest/ cc366710b..1ed6a8c67 (3 commits)

cc366710bb...1ed6a8c67a

$ git log cc366710b..1ed6a8c67 --date=short --no-merges --format='%ad %ae %s'
2023-07-19 dmauro Remove unused cast implementation
2023-07-11 kim.valen Fixed variables that could be declared 'const'
2023-05-11 chrisjohnsonmail add support for nrf52

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ f1ba373ef..14914db17 (6 commits)

f1ba373ef0...14914db17a

$ git log f1ba373ef..14914db17 --date=short --no-merges --format='%ad %ae %s'
2023-07-19 kevin.petit Report failures in makeHeaders
2023-07-19 alanbaker Revert "Add support for fp_max_error extension"
2023-06-21 arvind.sudarsanam Change kind of FPMaxErrorDecorationINTEL to LiteralFloat
2023-06-09 arvind.sudarsanam Interchange capability and decoration
2023-03-09 arvind.sudarsanam Add parameters
2023-02-02 arvind.sudarsanam Header files changes to support SPV_INTEL_fp_max_error spec extension

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-07-20 17:18:52 +00:00
dependabot[bot]
45f7e55af4
Bump word-wrap from 1.2.3 to 1.2.4 in /tools/sva (#5343)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 13:07:28 -04:00
Nathan Gauër
bf03d40922
opt: change Get* functions to return const& (#5331)
GetCapabilities returned a const*, and GetExtensions did not exist.
This commit adds GetExtensions, and changes the return value to
be a const&.

This commit also removes the overload to GetCapabilities which returns
a mutable set, as it is unused.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-20 10:18:19 -04:00
David Neto
876ccc6cd5
Add /bigobj to test_opt for VS 2017 (#5336)
This apparently is required for debug builds.

Fixes: #5335
2023-07-20 10:14:35 -04:00
David Neto
c50bc49f58
Fix link flags for Clang-based MinGW cross compile (#5342)
See https://github.com/android/ndk/issues/1464

The old code tested for Windows and GCC as the compiler.
Instead of checking for GCC, check the compiler is not MSVC.
2023-07-20 10:09:23 -04:00
Nathan Gauër
2813da2681
kokoro: rename glslang (#5339)
* kokoro: rename glslang

glslangValidator was renamed to glslang
(https://github.com/KhronosGroup/glslang/pull/3257).
Fixing build.

* rename glslang to glslang-standalone
2023-07-20 09:05:12 -04:00
David Neto
883417544b
Set cmake_policy CMP0128 (#5341)
Work around a problem in CMake 3.22.1 in setting -std=c++17.
Instead -std=c++11 is in effect for targets in test/*, but
those targets require C++17.

Fixes: #5340
2023-07-19 17:47:24 -04:00
Nathan Gauër
6c7e1acc5f
NFC: fix missing algorithm include in enumset file (#5334)
Caused issues with vs2017, required for std::min.
2023-07-18 18:42:42 +00:00
Mateusz Przybylski
61221e7d62
Add python3 requirement for the script (#5326)
as python2 may not recgonize utf encoding, per https://bugs.python.org/issue11033
2023-07-18 10:40:43 -04:00
Diego Novillo
4b6bd5a665
Prepare release v2023.4 (#5330) 2023-07-17 21:01:08 +00:00
Joyce
9e0b780ff8
Create SECURITY.md (#5325)
Signed-off-by: Joyce <joycebrum@google.com>
2023-07-17 20:34:04 +00:00
ncesario-lunarg
7dd5f95d25
[spirv-opt] Handle OpFunction in GetPtr (#5316)
When using PhysicalStorageBuffer it is possible for a function to
return a pointer type. This was not being handled correctly in
`GetLoadedVariablesFromFunctionCall` in the DCE pass because
`IsPtr` returns the wrong result.

Fixes #5270.
2023-07-17 19:16:25 +00:00
asudarsa
6add9ccf07
Add support for LiteralFloat type (#5323)
Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>
2023-07-17 11:16:01 -04:00
Nathan Gauër
85a4482131
NFC: makes the FeatureManager immutable for users (#5329)
* NFC: makes the FeatureManager immutable for users

The FeatureManager contains some internal state, like
a set of capabilities and extensions. Those are derived
from the module.

Before this commit, the FeatureManager exposed Remove* functions
which could unsync the reported extensions/capabilities from
the truth: the module.

The only valid usecase to remove items directly from the FeatureManager
is by the context itself, when an instruction is killed:
instead of running the whole an analysis, we remove the single outdated
item.

The was 2 users who mutated its state:
 - one to invalidate the manager. Moved to call a reset function.
 - one who removed an extension from the feature manager after removing
   it from the module. This logic has been moved to the context, who
   now handles the extension removal itself.

Signed-off-by: Nathan Gauër <brioche@google.com>

* clang-format

* add RemoveCapability since the fuzztests are using it

* add tests

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-17 11:15:08 -04:00
Nathan Gauër
29431859f5
NFC: replace EnumSet::ForEach with range-based-for (#5322)
EnumSet now supports iterators, meaning we can remove the custom
ForEach.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-13 14:40:47 -04:00
github-actions[bot]
d6b9389f6d
Roll external/spirv-headers/ d0006a393..f1ba373ef (2 commits) (#5320)
d0006a3938...f1ba373ef0

$ git log d0006a393..f1ba373ef --date=short --no-merges --format='%ad %ae %s'
2023-07-06 alanbaker Add WGSL source language
2023-06-16 joycebrum Create SECURITY.md

Created with:
  roll-dep external/spirv-headers

Co-authored-by: GitHub Actions[bot] <>
2023-07-13 15:14:12 +00:00
Nathan Gauër
5b4fb072eb
enumset: fix bug in the new iterator class (#5321)
The iterator class was initialized by setting the offset
and bucket to 0. Big oversight: what if the first enum is
not valid? Then `*iterator->begin()` would return the wrong
value.

Because the first capacity is Matrix, this bug was not visible by
any SPIRV test.
And this specific case wasn't tested correctly in the new enumset tests.

Signed-off-by: Nathan Gauër <brioche@google.com>

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-13 09:55:24 -04:00
Nathan Gauër
9ab811a125
NFC: fix missing comments on functions (#5318)
Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-13 11:16:54 +02:00
Jeremy Gebben
9266197c37
instrument: Cast gl_VertexIndex and InstanceIndex to uint (#5319)
This avoids errors like this from instrumenting vertex shaders:

error: 165: Expected Constituents to be scalars or vectors of the
  same type as Result Type components
  %195 = OpCompositeConstruct %v4uint %uint_0 %191 %194 %uint_0
2023-07-12 15:12:26 -06:00
github-actions[bot]
ee50fa7d85
Roll external/googletest/ 4a1a299b2..cc366710b (1 commit) (#5317)
4a1a299b20...cc366710bb

$ git log 4a1a299b2..cc366710b --date=short --no-merges --format='%ad %ae %s'
2023-07-03 steve Use template type FloatType in the cast.

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-07-12 16:02:00 +00:00
Nathan Gauër
3424b16c10
enumset: STL-ize container (#5311)
This commit adds forward iterator, and renames functions to
it matches the std::unordered_set/std::set better.
This goes against the SPIR-V coding style, but might be better in
the long run, especially when this set is used along real STL
sets.
(Right now, they are not compatible, and requires 2 syntaxes).

This container could in theory handle bidirectional
iterator, but for now, only forward seemed required for
our use-cases.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-12 11:34:44 -04:00
Spencer Fricke
7ff331af66
source: Give better message if using new Source Language (#5314) 2023-07-11 11:50:41 -04:00
David Neto
abcd228d92
Update README to say Android NDK r25c is required (#5312) 2023-07-11 09:58:57 -04:00