Commit Graph

3199 Commits

Author SHA1 Message Date
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
David Neto
9529d3c2c6
Avoid implicit fallthrough, by duplicating code (#4556)
The cleverness is probably not worth it.
2021-10-01 08:43:59 -04:00
Lukas Hermanns
24476c2e32
spirv-opt: Don't eliminate dead members from StructuredBuffer (#4553)
* Don't eliminate dead members from StructuredBuffer as layout(offset) qualifiers cannot be applied to structure fields.

* Traverse arrays when marking structs as fully used.

Co-authored-by: Steven Perron <stevenperron@google.com>
2021-10-01 08:31:40 -04:00
alan-baker
3234daada7
Do not assume there are execution modes (#4555)
Fixes #4550

* Do not assume that an entry point has any associated execution modes
  when checking derivative requirements
2021-09-30 19:20:28 -04:00
Alastair Donaldson
ba4b390c36
Suppress protobuf warning (#4551)
Suppresses a warning emitted by some versions of clang when compiling
protobufs.
2021-09-28 14:52:52 +00:00
Steven Perron
c3adcb034f
Adce refactor (NFC) (#4547)
* Have ADCE use cfg struct analysis (NFC)

ADCE has a lot of code and variables to keep track of
information that is easily obtains using the Struct
cfg analysis.  Most of this change is to refactor the
code to have small functions to get the information
from the struct cfg analysis.

A few other changes small refactoring changes are
done.

* Factor out work list initialization in ADCE (NFC)

We move the code that will initially populate the work list into its own
function.  We also simplify the code by making use of the struct cfg
analysis.  That way we can reduce the number of tables used to track
information as we traverse the CFG.
2021-09-24 13:21:45 -04:00
Greg Fischer
19dc86c48c
Handle NonSemantic.Shader Debug[No]Line (#4530)
Debug[No]Line are tracked and optimized using the same mechanism that tracks
and optimizes Op[No]Line.

Also:
    - Fix missing DebugScope at top of block.
    - Allow scalar replacement of access chain in DebugDeclare
2021-09-24 10:56:08 -04:00
Greg Fischer
f125452cf8
Fix inst_buff_addr_check to handle struct loads (#4489) 2021-09-23 12:59:38 -04:00
Jamie Madill
134d763f45
GN: Fix build for debuginfo codegen. (#4536)
Fixes #4535
2021-09-23 10:18:06 -04:00
alan-baker
1d48824bae
Update SPIRV-Headers (#4543)
* Remove tests that expected fast math mode operands to require a
  capability
2021-09-22 15:52:19 -04:00
alan-baker
a6c5056db2
Fix checks for offset in nested structs (#4531)
Fixes #4533
Fixes https://crbug.com/38771

* Fixes offset checks to look through arrays for nested structures
2021-09-21 11:15:16 -04:00
Alastair Donaldson
0f4508752f
Fix UBSan error in spirv-dis fuzzer (#4517)
Pending a more general solution for constructing a target environment
based on the bytes of a test input, this change avoids a UBSan error
caused by the existing approach.

Fixes https://crbug.com/38087
2021-09-21 15:07:30 +00:00
Steven Perron
59f51bb4f8
Fix extract with out-of-bounds index (#4529)
* Fix extract with out-of-bounds index

When folding a OpCompositeExtract that is fed by an
OpCompositeConstruct, we handle and out of bounds
index, but only in the case where the result of the
OpCompostiteConstruct is a struct.  This change
refactors that folding rule and then improves it to
handle an out-of-bounds access when the result of the
OpCompositeConstruct is a vector.
2021-09-20 13:02:47 -04:00
Greg Fischer
1454c95d1b
spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)
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-09-15 14:38:53 -04:00
Greg Fischer
4ac8e5e541
Add preserve_interface mode to aggressive_dead_code_elim (#4520)
This mode is needed by GPU-assisted validation instrumentation which
cannot change the shader entry point interface.
2021-09-15 14:38:34 -04:00
Alastair Donaldson
9e65f054d1
spirv-fuzz: Account for differing signedness in WrapVectorSynonym (#4414)
Makes the fuzzer pass and transformation that wraps vector synonyms
aware of the fact that integer operations can have arguments that
differ in signedness, and that the result type of such an operation
can have different sign from the argument types.

Fixes #4413.
2021-09-14 21:09:39 +00:00
Alastair Donaldson
36ff135341
spirv-opt: Avoid integer overflow during constant folding (#4511)
In SPIR-V, integers use 2s complement representation, so that signed
integer overflow and underflow is well defined. However, the constant
folder was causing overflow / underflow at the C++ level. This change
avoids such overflows by performing constant folding for IAdd, ISub and
IMul in the context of unsigned values, which works because signedness
is irrelevant according to the SPIR-V semantics for these instructions.

Fixes #4510.
2021-09-14 21:09:05 +00:00
Steven Perron
cb6c66917a
Roll external/googletest/ b7d472f12..955c7f837 (111 commits) (#4521)
b7d472f122...955c7f837e

$ git log b7d472f12..955c7f837 --date=short --no-merges --format='%ad %ae %s'
2021-08-20 absl-team Googletest export
2021-08-20 absl-team Googletest export
2021-08-19 invalid_ms_user Simplify example code with c++11
2021-08-12 absl-team Googletest export
2021-08-10 dmauro Googletest export
2021-08-09 dmauro Googletest export
2021-08-06 absl-team Internal change
2021-08-06 victordk13 Format test properties in xml printer
2021-08-05 iamberkeyavas typo fix gmock_cook_book
2021-08-03 absl-team Googletest export
2021-08-03 absl-team Googletest export
2021-08-02 absl-team Googletest export
2021-07-29 absl-team Googletest export
2021-07-29 otnaiud Typo, double "the"
2021-07-28 absl-team Internal change
2021-07-24 slowy.arfy fix: typo codespelling comment
2021-07-22 absl-team Googletest export
2021-07-21 absl-team Googletest export
2021-07-19 dmauro Googletest export
2021-07-14 761129+derekmauro Fix location of GOOGLETEST_CM0011 marker
2021-07-08 absl-team Googletest export
2021-07-08 absl-team Googletest export
2021-07-07 absl-team Googletest export
2021-07-02 absl-team Googletest export
2021-07-02 absl-team Googletest export
2021-07-07 manuel Link -lregex on QNX
2021-07-01 jeremy.nimmer Use GTEST_DONT_DEFINE_TEST_F to guard TEST_F
2021-06-29 absl-team Googletest export
2021-06-28 absl-team Googletest export
2021-06-28 absl-team Googletest export
2021-06-25 manuel Don't link pthread on QNX
2021-06-23 alex Fix EXPECT_DEATH() and ASSERT_DEATH() triggering -Wcovered-switch-default
2021-06-18 dmauro Googletest export
2021-06-03 pochkaenkov feat: make a matcher ElementsAreArray applicable for std ranges
2021-06-13 hyuk.myeong fix typos
2021-06-11 absl-team Googletest export
2021-06-10 absl-team Googletest export
2021-06-09 absl-team Googletest export
2021-06-09 dmauro Googletest export
2021-06-09 absl-team Googletest export
2021-06-09 absl-team Googletest export
2021-06-08 absl-team Googletest export
2021-06-04 absl-team Googletest export
2021-06-03 dmauro Googletest export
2021-05-28 florin.crisan #3420 Declare MarkAsIgnored as a DLL export
2021-05-28 florin.crisan #3420 Properly declare all overloads of testing::internal::PrintTo as DLL exports
2021-06-01 absl-team Googletest export
2021-06-01 absl-team Googletest export
2021-05-26 absl-team Googletest export
2021-05-25 absl-team Googletest export
(...)
2021-05-06 durandal Googletest export
2021-05-06 absl-team Googletest export
2021-05-03 absl-team Googletest export
2021-05-04 JC3 isalnum -> IsAlNum for correct handling of signed chars
2021-04-28 absl-team Googletest export
2021-04-27 absl-team Googletest export
2021-04-27 absl-team Googletest export
2021-04-27 absl-team Googletest export
2021-04-26 absl-team Googletest export
2021-04-26 absl-team Googletest export
2021-04-20 absl-team Googletest export
2021-04-19 absl-team Googletest export
2021-04-20 github Use URL instead of git-repo
2021-04-16 dmauro Googletest export
2021-04-14 absl-team Googletest export
2021-04-15 sebkraemer Apply missing suggestions from code review for GTEST_SKIP
2021-04-15 sebkraemer Apply suggestions from code review for GTEST_SKIP documentation
2020-12-15 sebkraemer Add subsection for GTEST_SKIP documentation
2021-04-15 jbampton chore: fix spelling
2021-04-14 github Mention to explicitely set the option to it's default.
2021-04-14 dmauro Googletest export
2021-04-14 github Changes like Requested.
2021-04-13 absl-team Googletest export
2021-04-09 absl-team Googletest export
2021-04-09 absl-team Googletest export
2021-04-09 absl-team Googletest export
2021-04-07 absl-team Googletest export
2021-04-07 absl-team Googletest export
2021-04-07 absl-team Googletest export
2021-04-06 absl-team Googletest export
2021-04-06 absl-team Googletest export
2021-04-05 absl-team Googletest export
2021-04-02 absl-team Googletest export
2021-03-25 absl-team Googletest export
2021-03-24 absl-team Googletest export
2021-03-24 absl-team Googletest export
2021-03-24 absl-team Googletest export
2021-03-24 absl-team Googletest export
2021-03-23 absl-team Googletest export
2021-03-22 absl-team Googletest export
2021-03-22 absl-team Googletest export
2021-03-22 absl-team Googletest export
2021-03-20 absl-team Googletest export
2021-03-17 77407429+a-sully Update nicestrictnaggy gmock cook_book links
2021-03-14 zekewarren Use @platforms instead of @bazel_tools for windows constraint
2021-03-13 github Use Fetchcontent instead of ExternalProject
2020-12-30 mattias.ellert Port to GNU/Hurd
2020-12-24 georgthegreat Use proper feature test macro to test if library supports char8_t
2020-12-05 gautham.bangalore Fix typo
2020-12-04 zed.three CMake: Add namespaced ALIAS library

Created with:
  roll-dep external/googletest

Roll external/re2/ f8e389f3a..4244cd1cb (10 commits)

f8e389f3ac...4244cd1cb4

$ git log f8e389f3a..4244cd1cb --date=short --no-merges --format='%ad %ae %s'
2021-05-21 junyer Fix a bug in `Regexp::ToString()`.
2021-05-19 junyer Pass a path to `cmake` in order to avoid a warning.
2021-05-18 junyer Let CMake pass `-pthread` for us.
2021-05-18 junyer Remove unneeded policy setting.
2021-05-12 junyer (|a)* shouldn't match more text than (|a)+ does!
2021-05-10 junyer Update the R wrapper URL.
2021-05-03 junyer Add GCC 11 to the build matrix.
2021-04-29 junyer Nullify hooks::context when using RE2::Set.
2021-04-19 junyer Add Clang 12 to the build matrix.
2021-03-26 junyer Set "compatibility version" and "current version".

Created with:
  roll-dep external/re2

Roll external/spirv-headers/ e71feddb3..0d3c45cdb (6 commits)

e71feddb3f...0d3c45cdbb

$ git log e71feddb3..0d3c45cdb --date=short --no-merges --format='%ad %ae %s'
2021-08-27 greg Add nonsemantic.shader.debuginfo to Bazel
2021-07-28 marijn spirv.core.grammar: Remove duplicate OpArbitraryFloatPowNINTEL declaration
2021-05-20 kloczek Rename spirv-headers.pc to SPIRV-Headers.pc
2021-05-19 kloczek removed excesive space in configure_file() line
2021-05-19 kloczek Fixed substituted string with paths and version
2021-05-18 kloczek Add spirv-headers pkgconfig file

Created with:
  roll-dep external/spirv-headers
2021-09-14 12:20:20 -04:00
alan-baker
846b032b53
Fix infinite loop in validation (#4523)
* Fix infinite loop in validation

Fixes https://crbug.com/38548

* Fixes an issue in structured exit checking where an invalid merge
  could result in an infinite traversal

* formatting
2021-09-13 13:19:04 -04:00
Alastair Donaldson
bf463fe37c
Fix UBSan kokoro config (#4522)
A test has been removed which depends on casting to spv_target_env from a value
outside the range of that enum. This is an undefined behaviour, thus the
test is invalid.
2021-09-13 16:55:51 +01:00
alan-baker
5efeaad309
Fix bad order of checks in atomic validation (#4524)
Fixes https://crbug.com/38625

* Check the type is an integer before checking it's bit width
2021-09-13 11:16:37 -04:00
Steven Perron
8865b20295
Handle out-of-bounds accesses in VDCE (#4518)
It is possible that other optimization will propagate
a value into an OpCompositeExtract or OpVectorShuffle
instruction that is larger than the vector size.
Vector DCE has to be able to handle it.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/4513.
2021-09-13 09:57:44 -04:00
alan-baker
4f4f76037c
Change validator boolean tests to avoid asserts (#4503)
Fixes https://crbug.com/38102

* Check for valid instructions in many boolean tests instead of
  asserting in ValidationState_t
2021-09-12 19:14:33 -04:00
alan-baker
912460e46a
Fix infinite loop in GetBlockDepth (#4519)
Fixes #4515

* Sets block depth to 0 if it encountered multiple times and leaves
  finding the real error for other code
2021-09-11 03:27:14 +00:00
David Neto
013b1f3d6d
Fix validation message for cooperative matrix column type (#4502)
* Fix validation message for cooperative matrix column type

Fixes: #4497

* Add tests for cooperative matrix type validation
2021-09-10 11:28:00 -04:00
Alastair Donaldson
2a938fcfa3
Add UBSan kokoro configuration (#4512)
Adds a kokoro configuration for UBSan, to allow this sanitizer to be
used during continuous integration.
2021-09-10 12:53:09 +00:00
alan-baker
c16224c684
Add some missing switch validation (#4507)
Fixes #4506

* Add validation of selector and default operands
2021-09-08 10:09:01 +01:00
Alastair Donaldson
92868b8f3f
spirv-val: Fix ubsan error (#4505)
Fixes an issue where an arbitrary word was cast to SpvOp, leading to
undefined behaviour if the value of the word fell outside the range of
SpvOp values.

Fixes #4504.
2021-09-07 15:37:40 -04:00
gnl21
4db6b8dcc2
Remove environment features that are never used (#4491)
The validation state contained feature bits for scalar block layout and
workgroup memory scalar block layout which were never used (the
command-line option is used in every case).
2021-09-07 13:08:15 -04:00
David Neto
7e860e3831
fix parsing of bad binary exponents in hex floats (#4501)
- The binary exponent must have some decimal digits
- A + or - after the binary exponent digits should not be interpreted as
  part of the binary exponent.

Fixes: #4500
2021-09-03 12:27:12 -04:00
Alastair Donaldson
789de0dc4b
Adjust build for fuzzer targets to support OSS-Fuzz (#4498)
With OSS-Fuzz, the build system should not directly set options such as
-fsanitize=fuzzer. Instead, these are set by OSS-Fuzz, and
linker options are provided via the LIB_FUZZER_OPTIONS environment
variable. This change allows the fuzzers to be build stand-alone,
outside of OSS-Fuzz, in the way that was already supported, as well as
inside OSS-Fuzz, when the LIB_FUZZER_OPTIONS environment variable is
set.
2021-09-02 22:55:30 +00:00
Jaebaek Seo
0c09258e07
Set threshold for reduce-load-size pass (#4499)
Allow uses to set the threshold for spirv-opt reduce-load-size pass
2021-09-02 10:45:51 -04:00