Commit Graph

3230 Commits

Author SHA1 Message Date
alan-baker
21e3f681e2
Update SPIRV-Headers (#4628)
* Fix compile
* Fix test
2021-11-10 16:32:09 -05:00
alan-baker
b014238e08
Allow WorkgroupSize on variables for Kernels (#4627)
* Update tests
2021-11-10 15:06:39 -05:00
Greg Fischer
352a411278
Fix handling of OpPhi in convert-relaxed-to-half (#4618)
Fixes #4452
2021-11-09 10:36:50 -07:00
Jakub Kuderski
c72c454203
Clarify how to update DEPS (#4626)
-  Mention that `depot_tools` are required and link to that repo.
-  Make `roll_deps.sh` exit on error. The script passes `shellcheck`
   with this change.
-  Reword instruction in the README.
2021-11-09 10:28:01 -05:00
Jakub Kuderski
6f9fa48012
Update DEPS (#4625)
Update DEPS ahead of the next Vulkan SDK release.

* Roll external/effcee/ 2ec8f8738..ddf5e2bb9 (1 commit)

2ec8f87381...ddf5e2bb92

$ git log 2ec8f8738..ddf5e2bb9 --date=short --no-merges --format='%ad %ae %s'
2021-08-31 dneto Remove .travis.yml

Created with:
  roll-dep external/effcee

* Roll external/googletest/ 955c7f837..bf0701daa (32 commits)

955c7f837e...bf0701daa9

$ git log 955c7f837..bf0701daa --date=short --no-merges --format='%ad %ae %s'
2021-11-03 absl-team Googletest export
2021-10-28 dmauro Googletest export
2021-10-27 dmauro Googletest export
2021-10-26 absl-team Googletest export
2021-10-26 absl-team Googletest export
2021-10-25 dmauro Googletest export
2021-10-25 dmauro Googletest export
2021-10-30 dartme18 Re #3637 Show Disabled Tests in testing output
2021-10-11 absl-team Googletest export
2021-10-11 absl-team Googletest export
2021-10-11 absl-team Googletest export
2021-10-08 yesudeep Fix linker errors on FreeBSD.
2021-09-30 absl-team Googletest export
2021-09-28 absl-team Googletest export
2021-09-24 cclauss Fix remaining typos discovered by codespell
2021-09-20 absl-team Googletest export
2021-09-20 absl-team Internal change
2021-09-17 julian.amann Remove bazelbuild/rules_cc dependency
2021-09-16 cclauss Fix typos discovered by codespell
2021-09-16 cclauss Fix typos discovered by codespell
2021-09-16 cclauss Fix typo discovered by codespell
2021-09-15 absl-team Googletest export
2021-09-15 dmauro Googletest export
2021-09-15 absl-team Googletest export
2021-09-14 dmauro Googletest export
2021-09-14 dmauro Googletest export
2021-09-14 absl-team Googletest export
2021-09-15 761129+derekmauro Revert grammatically incorrect change
2021-09-10 absl-team Googletest export
2021-08-10 akashkumarsingh11032001 add a missing 'a'
2021-08-10 akashkumarsingh11032001 Create CONTRIBUTING.md
2020-12-29 julien.jemine Using auto instead of container::const_iterator

Created with:
  roll-dep external/googletest

* Roll external/spirv-headers/ 19e835041..29817199b (3 commits)

19e8350415...29817199b7

$ git log 19e835041..29817199b --date=short --no-merges --format='%ad %ae %s'
2021-07-24 kpet Add SpecConstantSubgroupMaxSize to the clspv reflection non-semantic instruction set
2021-05-24 pmistry Implement header definitions for SPV_NV_bindless_texture
2021-10-12 ben.ashbaugh reserve SPIR-V enum block for Intel extensions

Created with:
  roll-dep external/spirv-headers
2021-11-09 09:43:45 -05:00
Jakub Kuderski
2bd46c5c55 Update CHANGES 2021-11-08 21:41:56 -05:00
alan-baker
339d4475c1
Improve decoration validation (#4490)
Fixes #4469

* Checks that decorations only usable with structure members are not
  used by OpDecorate or OpDecorateId
* Checks that decorations not allowed on structure members are not used
  with OpMemberDecorate
* Checks decoration targets for most core decorations
* Performs some Vulkan specific validation on deorations
2021-11-05 13:18:19 -04:00
Jaebaek Seo
1589720e10
spirv-opt: create OpDecorate for OpMemberDecorate in desc-sroa (#4617)
The scalar replacement of a resource array/struct variable must create
OpDecorate for elements if OpMemberDecorate instructions decorate
the elements.
2021-11-05 11:05:36 -04:00
David Neto
6b073f8992
Run the wasm build on push and pull_request (#4614) 2021-11-03 13:13:15 -04:00
David Neto
66ef7cb68e
Remove publish-to-npm step for Wasm build (#4610)
The JS-Tools/npm-publish flow requires a `token` attribute, even
in dry-run mode.
There is no token, so remove the step for now.
2021-11-03 11:04:04 -04:00
David Neto
d645ea2705
Update CHANGES, README for WebAssembly build (#4609) 2021-11-02 08:56:06 -04:00
Pelle Johnsen
0d0013002a
Add Wasm build (#3752)
* Add wasm build

* Run wasm ci on push

* Add copyright notice to wasm files

* [wasm] Update Emscripten

* [wasm] Change global lambda to regular function

* [wasm] Show detected core count during build

* [wasm] Set JS version from CHANGES, GITHUB_RUN_ID

Also remove custom docker emscripten build with brotli, as not used

* [wasm] Change github actions to use npm-publish

* [wasm] Us docker-compose up for CI

* [wasm] pass GITHUB_RUN_ID to docker

* [wasm] Change GITHUB_RUN_ID to GITHUB_RUN_NUMBER

* [wasm] Fix GITHUB_RUN_NUMBER in docker-compose.yml
2021-11-01 16:45:51 -04:00
Steven Perron
1082de6bb3
Handle overflowing id in merge return (#4606)
If the ids overflow when creating an integer constant in the ir_builder, there will be a nullptr dereference.  This is happening from inside merge return.

We need to propagate the error up, and make sure it is handled appropriately.
2021-11-01 08:45:32 -04:00
Alastair Donaldson
97d4495600
Avoid bitwise and in boolean expression (#4603)
In #3404 a logical && was replaced with a bitwise & to ensure that
both side-effecting arguments were evaluated. However, this leads to
warnings from some compilers (leading to the OSS-Fuzz build breaking,
in particular).

This change reworks the relevant code so that both arguments to the
logical && are evaluated into temporaries.
2021-10-29 15:36:51 -04:00
Ralf Habacker
e3c7098104
In generated cmake config file for SPIRV-Tools only access cmake target, if present (#4590)
Fixes #4582
2021-10-29 14:05:45 -04:00
timlyeee
e3a373f2b7
Make cxx exceptions controllable (#4591)
* Make cxx exceptions controllable 

Found a possible link error if we compile spirv-tools by using VS2019 and link with VS2017 for another project, unresolved symbols as _CxxFrameHandler4 and __GSHandlerCheck_EH4 will be thrown. As Visual Studio updated its c++ exceptions libs.

https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/

So we are making cxx exceptions controllable via a CMake option `ENABLE_EXCEPTIONS_ON_MSVC`.
2021-10-29 14:04:59 -04:00
sfricke-samsung
c194bb2a7f
spirv-val Update LocalSizeId VUID (#4602) 2021-10-29 11:58:02 -04:00
Steven Perron
6c7885dbde
Change branch handling in ADCE to fix errors (#4596)
Consider the new test case.  The conditional branch in the continue
block is never marked as live.  However, `IsDead` will say it is not
dead, so it does not get deleted.  Because it was never marked as live,
`%false` was not mark as live either, but it gets deleted.  This results
in invalid code.

To fix this properly, we had to reconsider how branches are handle.  We
make the following changes:

1) Terminator instructions that are not branch or OpUnreachable must be
kept, so they are marked as live when initializing the worklist.

2) Branches and OpUnreachable instructions are marked as live if
  a) the block does not have a merge instruction and another instruction
     in the block is marked as live, or
  b) the merge instruction in the same block is marked as live.

3) Any instruction that is not marked as live is removed.

4) If a terminator is to be removed, an OpUnreachable is added.  This
happens when the entire block is dead, and the block will be removed.
The OpUnreachable is generated to make sure the block still has a
terminator, and is valid.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/4509.
2021-10-29 10:46:43 -04:00
Steven Perron
bd5bf754b1
Fix Linker generator ID (#4601)
The generator ID is located in the upper 16 bits. The lower bits are
reserved for a version number.

Co-authored-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2021-10-29 10:32:41 -04:00
alan-baker
791f5b463a
Only validate workgroup layout for explicit workgroup memory (#4542)
Fixes #4537

* Only validate the layout of workgroup variables if the
  WorkgroupMemoryExplicitLayoutKHR capability is declared
2021-10-28 16:27:56 -04:00
David Neto
2feb7074d4
Avoid confusing short-circuiting (#3404)
When checking the OpBranchConditional for selection headers,
we intend to register both the true and false targets.
Short circuiting was getting in the way.

Co-authored-by: Steven Perron <stevenperron@google.com>
2021-10-28 15:57:36 -04:00
Steven Perron
7c5b17d379
Update passes to handle function declarations (#4599)
Spirv-opt has not had to handle module with function declarations.  This
lead many passes to assume that every function has a body.  This is not
always true.  This commit will modify a number of passes to handle
function declarations.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/4443
2021-10-28 11:54:37 -04:00
Steven Perron
b2ba019bf6
Delete decorations before replaces uses in dead branch elim (#4598)
If we do not delete the decoration before all ReplaceAllUses, the decorations will be transferred to the new id.  This can cause problems.

Fixes #4442.
2021-10-28 10:25:37 -04:00
Steven Perron
3291b6951e
Do not fold snegate feeding sdiv. (#4600)
When the variable value is INT_MIN, we cannot fold the negate into the divide, so we have to turn off that folding rule.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/4487.
2021-10-28 10:02:57 -04:00
Jaebaek Seo
d997c83b10
Add spirv-opt pass to replace descriptor accesses based on variable indices (#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-10-26 17:20:58 -04:00
Steven Perron
d78c1c4cd3
Make IsLocalVar in ADCE work at any time. (NFC) (#4595)
Having IsLocalVar work only sometimes is something that could easily
lead to an error.  This change refactors the code so that the function
can be called at any point.  The current implementation was used because
we did not want to do multiple searches to see if a function was an
entry point or if it had a call.  This was maintained by added a cache
that will store of a given function is an entry point with no calls.
2021-10-26 13:24:29 -04:00
Alastair Donaldson
8c91f14a9b
Add libFuzzer target for spirv-fuzz (#4434)
Fixes #4431.
2021-10-26 15:24:51 +00:00
alan-baker
17a5bacfa7
Handle missing execution modes for limitation check (#4594)
Fixes https://crbug.com/40216

* Handle entry points with no execution modes when checking implicit
  derivative execution model checks
2021-10-25 17:40:11 -04:00
David Neto
7326b494d0
opt: set upper bits of spec constant according to spec (#4589)
When setting default value for spec constants, for numeric bit types smaller
than 32 bits, follow the SPIR-V rules for narrow literals:
- signed integers are sign-extended
- otherwise, upper bits are zero.

Followup to #4588
2021-10-21 09:44:54 -04:00
Dave Airlie
f3fbd98ff5
opt/spec_constants: fix bit pattern width checks. (#4588)
* test: add a test to show 8/16-bit

* opt/spec_constants: fix bit pattern width checks.

The input bit patterns are always at least 32-bits, so let the test
pass for 8/16-bit values as well. This shouldn't have any effect on the
64-bit patterns I assume this was introduced for.
2021-10-20 11:53:24 -04:00
Alastair Donaldson
0f3bc1d9b2
Fix i386 build issues related to random generation (#4586)
The OSS-Fuzz i386 build has been failing due to errors about
64-to-32-bit conversions, relating to random generation code. This
changre fixes the problem by explicitly using a 64-bit random generator,
and by adding a cast to size_t to avoid an implicit conversion.
2021-10-20 10:20:07 -04:00
Greg Fischer
001604bd4a
Generate constants directly in CreateDebugInlinedAt (#4572)
Do this if Constant or DefUse managers are invalid. Using the
ConstantManager attempts to regenerate the DefUseManager
which is not valid during inlining.
2021-10-19 18:27:16 -06:00
David Neto
7a7a69037e
README: Remove appveyor build badge. (#4584)
Bot failures are unrelated.
2021-10-19 17:17:56 -04:00
David Neto
4578db3c41
README: Update tested versions of compilers (#4579)
I checked this against the Kokoro output.
2021-10-18 15:34:06 -04:00
JiaoluAMD
387cae472e
Opt passes should apply to the exported functions (#4554)
This is follow-up to the commit
bd3a271ce3
2021-10-18 13:18:16 -04:00
alan-baker
35fd0e17d0
Consider 0xffffffff offset as missing (#4564)
Fixes #4561

* When checking for offsets, don't accept 0xffffffff
2021-10-15 10:23:15 -04:00
alan-baker
06ebc4806b
Account for strided components in arrays (#4575)
* Account for strided components in arrays

Fixes #4567

* If the element type of an array takes less than a location in size,
  calculate the location usage in a strided manner

* formatting
2021-10-14 17:47:05 -04:00
David Neto
10343e53ed
Remove Appveyor CI, update README (#4578)
- Remove Appveyor CI
- Write new "Getting the source" subsection, consolidating material
  from a couple of places.  Emphasize using the utils/git-sync-deps
  script for getting a known-good combination of sources.
- Built artifacts:
   - top of tree artifacts are from Kokoro CI bots
   - mention Vulkan SDK and Android NDK as alternatives

Fixes: #4577
2021-10-14 17:46:27 -04:00
Greg Fischer
3e6a85303d
Mark DebugInfoNone as live in ADCE when DebugInfo present (#4568)
Otherwise KillInst() tries to generate it when the module is
inconsistent.
2021-10-14 13:29:54 -04:00
David Neto
e6e77dbdfa
Enable OpConstFunctionPointerINTEL outside function (#4576)
According to spec this opcode is a constant instruction - that's it
can appear outside of function bodies.

Co-authored-by: DmitryBushev <dmitry.bushev@intel.com>
2021-10-14 12:21:11 -04:00
Alastair Donaldson
5ed637caa3
Fix output of SPIR-V version in diagnostic (#4562)
Fixes #4552.
2021-10-14 14:13:47 +01:00
Ryan Harrison
d31218c560
Use max enum instead of static array of legal values (#4571) 2021-10-13 17:53:11 -04:00
alan-baker
0292d6b16a
Update SPIRV-Headers (#4573)
* Add pass-through validation for Offsets image operand
  * it is counted as an offset parameter though
* Update DEPS
2021-10-13 17:50:17 -04:00
Greg Fischer
6dd73728e9
Fix merge-block assertions with debugInfo (#4563)
Fixes DefUse assertions and invalid DebugScope instruction
between OpLoopMerge and OpBranch for included test shader.
2021-10-13 11:42:40 -06:00
Jaebaek Seo
e4349dd8f4
Fix CI failure (#4570) 2021-10-13 12:16:54 -04:00
David Neto
b46995741b
Avoid bugprone-move-forwarding-reference warning in Clang (#4560)
Use std::forward<T> instead of std::move, on an argument with
rvalue-reference of template-deduced type.

See https://clang.llvm.org/extra/clang-tidy/checks/bugprone-move-forwarding-reference.html

Bug: crbug.com/1134310
2021-10-06 16:50:16 -04:00
Alastair Donaldson
0c4deebc96
Include a maximum value for spv_target_env (#4559)
To allow querying the range of target environments (to ensure that a
target environment value is within the valid range of the associated
enum), this change adds a maximum value to the spv_target_env
enumeration.
2021-10-06 14:50:12 +00:00
Greg Fischer
63a3912326
Fix ConstantManager to not run AnalyzeInstDefUse if DefUse not valid (#4557)
This fixes inlining which has to create constant for DebugInlinedAt for
NonSemantic.Shader.DebugInfo. Also adds regression tests.
2021-10-05 14:55:06 -04:00
Ryan Harrison
2d12367ced
Stop consuming input in fuzzers to select target environment (#4544)
Instead calculate a hash based on the input and use that as a seed
into random data generation for the target env.

Also fixes issue where input data was not actually being fed into
one fuzzer.

Fixes #4450
2021-10-04 13:42:12 -04:00
Steven Perron
eeb973f502
More ADCE refactoring (#4548)
Split the code that processes the work list into multiple functions.

Move the code to remove the dead instructions in a function to its own function.
2021-10-04 08:33:10 -04:00