Commit Graph

3741 Commits

Author SHA1 Message Date
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
alan-baker
0530a532fc
Validate GroupNonUniform instructions (#5296)
Fixes #5283

* Validate group non-uniform instructions
2023-07-11 08:40:40 -04:00
github-actions[bot]
4594ffce92
Roll external/re2/ a57a1d646..e66463312 (1 commit) (#5313)
a57a1d6462...e66463312e

$ git log a57a1d646..e66463312 --date=short --no-merges --format='%ad %ae %s'
2023-07-10 junyer Avoid expanding counted repetitions of empty-width ops.

Created with:
  roll-dep external/re2

Co-authored-by: GitHub Actions[bot] <>
2023-07-11 11:54:04 +00:00
Steven Perron
4be7d0e3ca
Use android ndk r25 (#5309)
* Use android ndk r25

We currently use R21 of the Android NDK for our tests. There have been
to LTS release since that one, and we do not expect people to use it
anymore. Also, it contains Python 2.7, not Python3. The python scripts
in SPIR-V Tools expect Python 3, so we have to update.

We chose the latest LTS release.

* Roll external/googletest/ be03d00f5..4a1a299b2 (1 commit)

be03d00f5f...4a1a299b20

$ git log be03d00f5..4a1a299b2 --date=short --no-merges --format='%ad %ae %s'
2023-07-07 absl-team Update docstring of PrintWithFallback(..) to reflect the recently changed ordering.

Created with:
  roll-dep external/googletest

* Roll external/re2/ 1c1ffbe3c..a57a1d646 (2 commits)

1c1ffbe3c6...a57a1d6462

$ git log 1c1ffbe3c..a57a1d646 --date=short --no-merges --format='%ad %ae %s'
2023-07-06 junyer Stop using `std::map<std::string, Prefilter*>`.
2023-07-06 junyer Bump the CMake baseline to 3.13.

Created with:
  roll-dep external/re2

* Roll external/spirv-headers/ 3469b164e..d0006a393 (3 commits)

3469b164e2...d0006a3938

$ git log 3469b164e..d0006a393 --date=short --no-merges --format='%ad %ae %s'
2023-07-05 lynix680 Regenerate headers
2023-06-30 lynix680 Add NZSL as a source language
2023-06-30 lynix680 Add NZSLc as a generator

Created with:
  roll-dep external/spirv-headers
2023-07-10 11:21:45 -04:00
David Neto
e751c7e7db
Treat spir-v.xml as utf-8 (#5306)
* Treat spir-v.xml as utf-8

Treat the input file as utf-8, and configure the XML parser to use
the utf-8 encoding.

The Chromium build was breaking when trying to parse the XML
file as ASCII.

* Use Python io.open

Try to fix the android-ndk-build flow.  It seems to be using
an old Python. For example, Python 2.6 builtin function open()
did not support the 'encoding' keyword argument.  But its io.open
method did support it.
2023-07-07 12:25:26 -04:00
Nathan Gauër
0f3bea06ef
NFC: rewrite EnumSet to handle larger enums. (#5289)
The current EnumSet implementation is only efficient for enums with
values < than 64. The reason is the first 63 values are stored as a
bitmask in a 64 bit unsigned integer, and the other values are stored
in a std::set.
For small enums, this is fine (most SPIR-V enums have IDs < than 64),
but performance starts to drop with larger enums (Capabilities,
opcodes).

Design considerations:
----------------------

This PR changes the internal behavior of the EnumSet to handle enums
with arbitrary values while staying performant.
The idea is to extend the 64-bits buckets sparsely:
 - each bucket can store 64 value, starting from a multiplier of 64.
This could be considered as a hashset with linear probing.

- For small enums, there is a slight memory overhead due to the bucket
storage, but lookup is still constant.
- For linearly distributed values, lookup is constant.
- Worse case for storage are for enums with values which are multiples of 64.
But lookup is constant.
- Worse case for lookup are enums with a lot of small ranges scattered in
the space (requires linear probing).

For enums like capabilities/opcodes, this bucketing is useful as values
are usually scatters in distinct, but almost contiguous blocks.
(vendors usually have allocated ranges, like [5000;5500], while [1000;5000]
is mostly unused).

Benchmarking:
-------------

Benchmarking was done in 2 ways:
 - a benchmark built for the occasion, which only measure the EnumSet
   performance.
 - SPIRV-Tools tests, to measure a more realist scenario.

Running SPIR-V tests with both implementations shows the same
performance (delta < noise). So seems like we have no regressions.
This method is noisy by nature (I/O, etc), but the most representative
of a real-life scenario.

Protocol:
 - run spirv-tests with no stdout using perf, multiple times.
Result:
 - measure noise is larger than the observed difference.

The custom benchmark was testing EnumSet interfaces using SPIRV enums.
Doing thousand of insertion/deletion/lookup, with 2 kind of scenarios:
 - add once, lookup many times.
 - add/delete/loopkup many time.

For small enums, results are similar (delta < noise). Seems relevant
with the previously observed results as most SPIRV enums are small, and
SPIRV-Tools is not doing that many intensive operations on EnumSets.

Performance on large enums (opcode/capabilities) shows an improvement:

+-----------------------------+---------+---------+---------+
| Metric                      |  Old    |   New   | Delta % |
+-----------------------------+---------+---------+---------+
| Execution time              |   27s   |   7s    |  -72%   |
| Instruction count           |  174b   |  129b   |  -25%   |
| Branch count                |   28b   |   33b   |  +17%   |
| Branch miss                 |  490m   |   26m   |  -94%   |
| Cache-misses                |  149k   |   26k   |  -82%   |
+-----------------------------+---------+---------+---------+

Future work
-----------

This was by-design an NFC change to compare apples-to-apples.
The next PR aims to add STL-like iterators to the EnumSet to allow
using it with STL algorithms, and range-based for loops.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-07-07 10:41:52 -04:00
Spencer Fricke
870fd1e17a
spirv-val: Label SPV_KHR_cooperative_matrix VUID (#5301) 2023-07-04 09:01:04 -04:00
github-actions[bot]
a1e8fff144
Roll external/re2/ 2d39b703d..1c1ffbe3c (1 commit) (#5304)
2d39b703d0...1c1ffbe3c6

$ git log 2d39b703d..1c1ffbe3c --date=short --no-merges --format='%ad %ae %s'
2023-07-03 junyer Make the fuzzer exercise `ToString()`.

Created with:
  roll-dep external/re2

Co-authored-by: GitHub Actions[bot] <>
2023-07-04 12:44:01 +00:00
github-actions[bot]
58459c2b1a
roll deps (#5300)
* Roll external/googletest/ 251e72039..be03d00f5 (2 commits)

251e720391...be03d00f5f

$ git log 251e72039..be03d00f5 --date=short --no-merges --format='%ad %ae %s'
2023-06-30 mkruskal Fix C++20 compatibility bug.
2023-06-30 absl-team Make GoogleTest handle SEH exceptions before stack unwinding rather than afterward

Created with:
  roll-dep external/googletest

* Roll external/re2/ 231c11764..2d39b703d (3 commits)

231c117648...2d39b703d0

$ git log 231c11764..2d39b703d --date=short --no-merges --format='%ad %ae %s'
2023-06-30 junyer Clean up some StringPiece-related cruft.
2023-06-30 junyer Tidy up the Python build a little.
2023-06-30 junyer Simplify the app build a little.

Created with:
  roll-dep external/re2

---------

Co-authored-by: GitHub Actions[bot] <>
2023-06-30 23:23:06 -04:00
github-actions[bot]
d3b0a522ce
Roll external/googletest/ 687c58994..251e72039 (1 commit) (#5299)
687c589949...251e720391

$ git log 687c58994..251e72039 --date=short --no-merges --format='%ad %ae %s'
2023-06-29 absl-team Change `::testing` to `testing` in Testing Reference doc

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-30 14:36:52 +00:00
github-actions[bot]
ea5af2fb5f
roll deps (#5297)
* Roll external/googletest/ f269e15c5..687c58994 (2 commits)

f269e15c5c...687c589949

$ git log f269e15c5..687c58994 --date=short --no-merges --format='%ad %ae %s'
2023-06-28 absl-team Print stack traces on SEH exceptions on Windows
2023-06-27 dmauro On platforms without a file system, don't log an error when no alternative output format is requested.

Created with:
  roll-dep external/googletest

* Roll external/re2/ 9ea3effad..231c11764 (1 commit)

9ea3effadf...231c117648

$ git log 9ea3effad..231c11764 --date=short --no-merges --format='%ad %ae %s'
2023-06-28 junyer Print command lines for build commands.

Created with:
  roll-dep external/re2

---------

Co-authored-by: GitHub Actions[bot] <>
2023-06-29 12:50:09 +00:00
github-actions[bot]
f83f50d23a
Roll external/googletest/ ec4fed932..8e32de89c (2 commits) (#5294)
* Roll external/googletest/ ec4fed932..f269e15c5 (3 commits)

ec4fed9321...f269e15c5c

$ git log ec4fed932..f269e15c5 --date=short --no-merges --format='%ad %ae %s'
2023-06-27 absl-team Resolve an issue where the resolution of `operator<<` overloads would attempt to instantiate the incomplete `testing::internal::Secret` type.
2023-06-22 chrisjohnsonmail add support for nxp qn9090 mcu
2023-06-23 eltociear Fix typo in googletest-catch-exceptions-test.py

Created with:
  roll-dep external/googletest

* Roll external/re2/ 7c5e396af..9ea3effad (1 commit)

7c5e396af8...9ea3effadf

$ git log 7c5e396af..9ea3effad --date=short --no-merges --format='%ad %ae %s'
2023-06-27 junyer Move linker flags out of `$(MAKE_SHARED_LIBRARY)`.

Created with:
  roll-dep external/re2

---------

Co-authored-by: GitHub Actions[bot] <>
2023-06-28 15:17:55 +00:00
Nathan Gauër
7520bfa6b1
build: remove last references of c++11 (#5295)
Figured I forgot some references. Naive sed this time, so we should be
done.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-06-28 05:37:55 -07:00
Volodymyr B
e090ce9c40
Update CMakeLists.txt (#5293) 2023-06-26 14:54:31 -04:00
Nathan Gauër
bfb40a2405
fix ndk build standard to c++17 (#5290)
Signed-off-by: Nathan Gauër <brioche@google.com>
2023-06-26 08:11:29 -04:00
alan-baker
310a67020a
Validate layouts for PhysicalStorageBuffer pointers (#5291)
* Validate layouts for PhysicalStorageBuffer pointers

Fixes #5282

* These pointers may not orginate from a variable so standard layout
  validation misses them
* Now checks every instructions that results in a physical storage
  buffer pointer
  * May not start from a Block-decorated struct so that part is fudged
    with a valid layout

* formatting
2023-06-23 19:17:55 +00:00
Volodymyr B
c640b1934b
Update CMakeLists.txt (#5288)
add xrOS
2023-06-23 10:31:10 -04:00
github-actions[bot]
cfb99efd7d
Roll external/googletest/ af39146b4..ec4fed932 (1 commit) (#5287)
af39146b45...ec4fed9321

$ git log af39146b4..ec4fed932 --date=short --no-merges --format='%ad %ae %s'
2023-06-22 absl-team Update code examples in the gMock Cookbook following C++ best practices.

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-23 10:13:38 -04:00
archimedus
04cdb2d344
SPV_KHR_cooperative_matrix (#5286)
* SPV_KHR_cooperative_matrix

* Update DEPS with headers

* Update according to review recommendations

* Bugfix and formatting

* Formatting missed or damaged by VS2022
2023-06-22 18:33:36 -04:00
Steven Perron
16098b3c10
Have effcee add abseil subdirectory (#5281)
We currently add the abseil in the external/CMakeLists.txt. However, it
is not needed by spirv-tools directly. Instead we set effcee's variable
with the abseil source directory, and let effcee add it.

This will mean that abseil will be checked out only if effcee is
used. We currently get a few reports from people that use to only checkout
spirv-headers, and now get errors because abseil is missing.
2023-06-22 18:15:53 -04:00
Jeremy Gebben
daee1e7d34
instrument: Combine descriptor length and init state checking (#5274)
Simplify what we add to user code by moving most of it into a function
that checks both that the descriptor index is in bounds and the
initialization state. Move error logging into this function as
well.

Remove many options to turn off parts of the instrumentation,
because there were far too many permutations to keep working and
test properly.

Combine Buffer and TexBuffer error checking. This requires that VVL
set the length of TexBuffers in the descriptor input state, rather
than relying on the instrumentation code to call OpImageQuerySize.
Since the error log includes the descriptor set and binding numbers
we can use a single OOB error code rather than having 4 per-type
error codes.

Since the error codes are getting renumbered, make them start at 1
rather than 0 so it is easier to determine if the error code was
actually set by the instrumentation.
2023-06-22 09:39:49 -06:00
Juan Ramos
a68ef7b2c5
cmake: Remove unused SPIRV-Headers variables (#5284)
These were removed from SPIRV-Headers a while ago.
2023-06-22 09:08:47 -04:00
github-actions[bot]
b12c0fe6f4
Roll external/googletest/ fb11778f4..af39146b4 (1 commit) (#5285)
fb11778f43...af39146b45

$ git log fb11778f4..af39146b4 --date=short --no-merges --format='%ad %ae %s'
2023-06-20 juan cmake: Remove remaining checks for CMAKE_VERSION

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-22 05:52:44 -07:00
John Cater
54691dcd73
Migrate exec_tools back to tools. (#5280)
The host transition migration is done so these can now be moved back and
`exec_tools` can be removed.
2023-06-21 15:32:27 -04:00
github-actions[bot]
a6b57f2f0e
Roll external/googletest/ 9b12f749f..fb11778f4 (4 commits) (#5279)
* Roll external/effcee/ 6d3b974a7..19b4aa87a (1 commit)

6d3b974a77...19b4aa87af

$ git log 6d3b974a7..19b4aa87a --date=short --no-merges --format='%ad %ae %s'
2023-06-21 stevenperron Add binary dir for abseil

Created with:
  roll-dep external/effcee

* Roll external/googletest/ 9b12f749f..fb11778f4 (4 commits)

9b12f749fa...fb11778f43

$ git log 9b12f749f..fb11778f4 --date=short --no-merges --format='%ad %ae %s'
2023-06-20 juan cmake: Clean up policy code
2023-06-19 juan cmake: Raise min to 3.6
2023-06-19 git Change C++11 requirement to C++14
2023-06-16 73937934+zencatalyst Update README.md

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ 6e09e44cd..10db9d4e1 (1 commit)

6e09e44cd8...10db9d4e19

$ git log 6e09e44cd..10db9d4e1 --date=short --no-merges --format='%ad %ae %s'
2023-06-21 kevin.petit Add definitions for SVP_EXT_image_raw10_raw12

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-06-21 12:58:32 -04:00
Juan Ramos
a63ac9f73d
cmake: Use modern Python3 CMake support (#5277)
From the 3.27 release notes:
The FindPythonInterp and FindPythonLibs modules, which have been
deprecated since CMake 3.12, have been removed by policy CMP0148.
Port projects to FindPython3, FindPython2, or FindPython.

closes #4145
2023-06-19 15:02:41 -04:00
Laura Hermanns
951980e5ac
Enable vector constant folding (#4913) (#5272)
- Add test case 6 to UIntVectorInstructionFoldingTest
- Add test case 3 to IntVectorInstructionFoldingTest
2023-06-19 15:01:51 -04:00
github-actions[bot]
a720a6926e
Roll external/googletest/ 18fa6a4db..9b12f749f (1 commit) (#5276)
18fa6a4db3...9b12f749fa

$ git log 18fa6a4db..9b12f749f --date=short --no-merges --format='%ad %ae %s'
2023-06-01 niranjan.nilakantan Ignore the .cache directory create by VSCode.

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-17 17:17:35 -07:00
Steven Perron
6b9fc79330
Fold negation of integer vectors (#5269) 2023-06-16 10:37:21 -04:00
github-actions[bot]
285f6cefa6
roll deps (#5273)
* Roll external/googletest/ e9078161e..18fa6a4db (2 commits)

e9078161e6...18fa6a4db3

$ git log e9078161e..18fa6a4db --date=short --no-merges --format='%ad %ae %s'
2023-06-15 absl-team Allow clients to un-suppress output from gUnit EXPECT_EXIT tests.
2023-06-14 dinor Skip entire test suite with `GTEST_SKIP()` in `SetUpTestSuite`

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ 8e2ad2748..6e09e44cd (1 commit)

8e2ad27488...6e09e44cd8

$ git log 8e2ad2748..6e09e44cd --date=short --no-merges --format='%ad %ae %s'
2023-06-12 dunfanlu Reserve SPIR-V enums for Meta

Created with:
  roll-dep external/spirv-headers

---------

Co-authored-by: GitHub Actions[bot] <>
2023-06-16 10:15:46 -04:00
Jeremy Gebben
d33bea5847
instrument: Fix buffer address length calculations (#5257)
The length of a uvec3 was assumed to be 16 bytes, but it is 12.
Sometimes the stride might be 16 bytes though, which is probably the
source of the confusion.

Redo structure length to be the offset + length of the last member.

Add tests to cover arrays of uvec3s and uvec3 struct members.

Fixes https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5691
2023-06-14 16:14:46 -06:00
Eugene Kozlov
b4f352e54f
Expose preserve_interface in Optimizer::Register*Passes. (#5268)
Fixes #5266
2023-06-14 10:00:26 -04:00
github-actions[bot]
40dde04ca2
Roll external/googletest/ 65cfeca1a..e9078161e (1 commit) (#5267)
65cfeca1a1...e9078161e6

$ git log 65cfeca1a..e9078161e --date=short --no-merges --format='%ad %ae %s'
2023-03-14 macieksroczynski Add COMPONENT to install

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-13 09:48:33 -04:00
github-actions[bot]
6d0e3cf6af
Roll external/googletest/ 334704df2..65cfeca1a (1 commit) (#5265)
334704df26...65cfeca1a1

$ git log 334704df2..65cfeca1a --date=short --no-merges --format='%ad %ae %s'
2023-06-09 absl-team internal g3doc documentation change.

Created with:
  roll-dep external/googletest

Co-authored-by: GitHub Actions[bot] <>
2023-06-12 10:12:23 -04:00
Shahbaz Youssefi
9c66587d14
spirv-diff: Update test expectations (#5264)
Seems to have been left out due to submission race condition
2023-06-09 16:28:30 -04:00