Commit Graph

2477 Commits

Author SHA1 Message Date
Ehsan
e6f372c5c2
Whitelist SPV_KHR_ray_tracing (#3241) 2020-03-23 09:31:05 -05:00
Aaron Franke
7f341ffee6
Make file formatting comply with POSIX standards (#3242)
Add newlines to two files
2020-03-23 10:20:00 -04:00
David Neto
60104cd974
Add opt::Operand::AsCString and AsString (#3240)
It only works when the operand is a literal string.
2020-03-19 12:44:28 -04:00
JiaoluAMD
da52d0875c
Add RayQueryProvisionalKHR to opt types (#3239)
Add missing RayQueryProvisionalKHR types
2020-03-19 12:41:30 -04:00
Ehsan
18d3896a15
Whitelist SPV_EXT_demote_to_helper_invocation for opt passes (#3236) 2020-03-17 22:36:02 -05:00
Daniel Koch
5a97e3a391
Add support for KHR_ray_{query,tracing} extensions (#3235)
Update validator for SPV_KHR_ray_tracing.

* Added handling for new enum types
* Add SpvScopeShaderCallKHR as a valid scope
* update spirv-headers

Co-authored-by: alelenv <alele@nvidia.com>
Co-authored-by: Torosdagli <ntorosda@amd.com>
Co-authored-by: Tobias Hector <tobias.hector@amd.com>
Co-authored-by: Steven Perron <stevenperron@google.com>
2020-03-17 15:30:19 -04:00
Jamie Madill
25ede1ced6
Roll external/spirv-headers/ 30ef660ce..a17e17e36 (1 commit) (#3230)
30ef660ce2...a17e17e36d

$ git log 30ef660ce..a17e17e36 --date=short --no-merges --format='%ad %ae %s'
2020-03-13 jmadill Add missing header to BUILD.gn.

Created with:
  roll-dep external/spirv-headers
2020-03-16 11:42:05 -04:00
Vasyl Teliman
7a8f79762c
Update dependencies (#3228) 2020-03-13 16:23:01 -04:00
greg-lunarg
1fe9bcc108
Instrument: Debug Printf support (#3215)
Create a pass to instrument OpDebugPrintf instructions.  This pass replaces all OpDebugPrintf instructions with instructions to write a record containing the string id and the all specified values into a special printf output buffer (if space allows). This pass is designed to support the printf validation in the Vulkan validation layers.

Fixes #3210
2020-03-12 09:19:52 -04:00
Vasyl Teliman
6428ad05e7
spirv-fuzz: Support OpPhi when adding dead break and continue (#3225)
Fixes #2856.
2020-03-12 12:40:38 +00:00
Alastair Donaldson
1af1df3b23
spirv-fuzz: Fix vector width issue in 'add equation instructions' pass (#3223)
Fixes #3213.
2020-03-12 10:56:11 +00:00
Jeff Bolz
dd3d91691f
Allow sampledimage types as operand of OpCopyObject (#3222) 2020-03-09 15:03:39 -04:00
Vasyl Teliman
7c3de218f4
spirv-fuzz: Remove duplicated functionality (#3220)
Fixes #3218.
2020-03-09 16:17:43 +00:00
André Perez Maselco
659470446c
spirv-fuzz: Allow OpPhi operand to be replaced with a composite synonym (#3221)
In this PR, the class FuzzerPassApplyIdSynonyms was updated to allow OpPhi operand to be replaced with a composite synonym.

Fixes #3209.
2020-03-09 16:16:18 +00:00
André Perez Maselco
4c027048d8
spirv-fuzz: Add toggle access chain instruction transformation (#3211)
In this PR, the classes that represent the toggle access chain
instruction transformation and fuzzer pass were implemented. This
transformation toggles the instructions OpAccessChain and
OpInBoundsAccessChain between them.

Fixes #3193.
2020-03-08 22:33:24 +00:00
Vasyl Teliman
533af49812
spirv-fuzz: Add fuzzer pass to permute function parameters (#3212)
Fixes #3194.
2020-03-08 14:27:05 +00:00
Alastair Donaldson
da4cd21485
spirv-fuzz: Use better function name (#3207)
Changes FuzzerPass::MaybeAddTransformationBeforeEachInstruction to
FuzzerPass::ForEachInstructionWithInstructionDescriptor.

Fixes #3184.
2020-03-06 12:25:57 +00:00
Alastair Donaldson
66a682b6a8
spirv-fuzz: Add swap commutable operands transformation (#3205)
In this PR, the classes that represent the swap commutable operands
transformation and the fuzzer pass were implemented.

Fixes #3205.
2020-03-05 08:18:39 +00:00
Alastair Donaldson
044ecc0b2c
spirv-fuzz: Fuzzer pass to add equation instructions (#3202)
This introduces a new fuzzer pass to add instructions to the module
that define equations, and support in the fact manager for recording
equation facts and deducing synonym facts from equation facts.

Initially the only equations that are supported involve OpIAdd,
OpISub, OpSNegate and OpLogicalNot, but there is scope for adding
support for equations over various other operators.
2020-03-04 14:54:08 +00:00
André Perez Maselco
a6d3a2dd41
Refactor FuzzerPass::ApplyTransformation code duplication. (#3206) 2020-03-04 06:56:38 +00:00
David Neto
e1688b60ca
Avoid use of Python distutils.dir_util (#3203)
Required for compatibility with (some?) Python3 installations.
2020-02-28 16:50:06 -05:00
Ryan Harrison
661e79eec8
Adding WebGPU specific Workgroup scope rule (#3204)
Fixes #3075
2020-02-28 16:42:49 -05:00
Jaebaek Seo
70f888131e
Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
Add validation rules for DebugCompilationUnit, DebugSource,
DebugTypeBasic, DebugTypeVector, DebugTypeArray, DebugTypedef,
DebugTypeFunction, DebugTypeEnum, DebugTypeComposite,
DebugTypeMember, DebugTypeInheritance, DebugFunction,
DebugFunctionDeclaration, DebugLexicalBlock, DebugScope,
DebugLocalVariable, DebugDeclare, DebugExpression.
2020-02-25 16:47:03 -05:00
Geoff Lang
fb6e3e48d5
Combine extinst-name and extinst-output-base into one arg. (#3200)
* Combine the extinst-name and extinst-output-base into one arg.

Some build systems such as Android blueprints require that the inputs
and outputs of generator scripts are all provided as arguments.  These
two arguments to generate_language_headers.py are combined to form the
output path in the script.  This change simply lets the user provide the
whole output path as an argument.

* Fix typo in build_defs.bzl and update Android.mk
2020-02-25 00:46:52 -05:00
Nico Weber
8910ea5f1c
Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201) 2020-02-23 18:50:59 -05:00
Geoff Lang
c316fb15fb
Add missing dependencies when generating spvtools_core_tables (#3199) 2020-02-21 17:23:42 -05:00
Alastair Donaldson
03c9effb58
Brief guide to writing a spirv-fuzz fuzzer pass (#3190)
* Start on walkthrough doc.

* Finished draft of doc.
2020-02-21 17:23:07 -05:00
Ricardo Garcia
dea1040fa4
Fix ignored const qualifier warning in static_cast (#3197) 2020-02-21 15:06:46 -05:00
Steven Perron
4a80497a88
Make spvOpcodeString part of the public API (#3174)
Fixes #3138
2020-02-20 14:07:57 -05:00
Danilo Spinella
03794b8f5e
Fix static libraries linking order (#3189)
Fix #1569
2020-02-20 10:54:54 -05:00
Ben Clayton
79f8caf915
vscode: Add missing fields to schema.Opcode (#3169)
These were declared in the `Opcode` struct type, but were never assigned.
They're not actually used by the language server, but I reused this go schema package for a local experiment and found they were missing.
2020-02-18 06:01:56 -08:00
Samuel Iglesias Gonsálvez
4d912f4e60
spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
According to SPV_AMD_shader_image_load_store_lod spec, Lod operand is
valid with OpImageRead, OpImageWrite, or OpImageSparseRead if the
extension is enabled.
2020-02-18 08:23:41 -05:00
Alastair Donaldson
77fefe765c
spirvfuzz: Fix type-related bug, change undef to zero, and add assert (#3188)
This fixes a bug where the type id of a type instruction, rather than
its result id, was being used.  It also favours using zero as the
return value when replacing an OpKill or OpUnreachable with a return
instruction, and adds a check that the donor module is valid when
doing module donation.

Fixes #3187.
2020-02-14 10:04:03 +00:00
Alastair Donaldson
6c218ec60b
spirv-fuzz: Fuzzer pass that adds access chains (#3182)
This change adds a fuzzer pass that sprinkles access chain
instructions into a module at random. This allows other passes to
have a richer set of pointers available to them, in particular the
passes that add loads and stores.
2020-02-11 23:10:57 +00:00
Alastair Donaldson
77fb303e58
spirv-fuzz: Fuzzer pass to add function calls (#3178)
Adds a fuzzer pass that inserts function calls into the module at
random. Calls from dead blocks can be arbitrary (so long as they do
not introduce recursion), while calls from other blocks can only be to
livesafe functions.

The change fixes some oversights in transformations to replace
constants with uniforms and to obfuscate constants which testing of
this fuzzer pass identified.
2020-02-10 23:22:34 +00:00
Alastair Donaldson
3d4a0dd48f
spirv-fuzz: Ensure that donated variables are always initialized (#3181)
This change ensures that global and local variables donated from other
modules are always initialized at their declaration in the module
being transformed.  This is to help limit issues related to undefined
behaviour that might arise due to accessing uninitialized memory.

The change also introduces some helper functions in fuzzer_util to
make it easier to find the pointee types of pointer types.
2020-02-10 20:10:41 +00:00
Alastair Donaldson
fe10239f92
spirv-fuzz: Add fuzzer passes to add loads/stores (#3176)
This change adds fuzzer passes that sprinkle loads and stores into a
module at random, with stores restricted to occur in either dead
blocks, or to use pointers for which it is known that the pointee
value does not influence the module's overall behaviour.

The change also generalises the VariableValueIsArbitrary fact to
PointeeValueIsIrrelevant, to allow stores through access chains or
object copies of variables whose values are known to be irrelevant.

The change includes some other minor refactorings.
2020-02-06 16:54:34 +00:00
Alastair Donaldson
1f03ac1027
spirv-fuzz: Fuzzer passes to add local and global variables (#3175)
Adds two new fuzzer passes to add variables to a module: one that adds
Private storage class global variables, another that adds Function
storage class local variables.
2020-02-05 21:07:44 +00:00
Ben Clayton
9e52bc0d0c
utils/vscode: LSP - Support OpExtInst (#3140)
This adds language server support for the `GLSL.std.450`, `OpenCL.std` and `OpenCL.DebugInfo.100` extension instructions.
2020-02-04 11:21:10 -05:00
Jakub Kuderski
a3b5ad909e
Fix typos in opt's help. Update environment version. (#3170) 2020-02-04 11:13:24 -05:00
Steven Perron
da5457f6b7 Start SPIRV-Tools v2020.2 2020-02-04 09:36:21 -05:00
Steven Perron
8dd174809f Finalize SPIRV-Tools v2020.1 2020-02-04 09:35:13 -05:00
Steven Perron
76616bab66 Update CHANGES 2020-02-04 09:33:50 -05:00
Alastair Donaldson
bb56e892f5
spirv-fuzz: Fuzzer pass to add composite types (#3171)
Adds a fuzzer pass that randomly adds vector and matrix types not
already present in the module, and randomly adds structs with random
field types and arrays with random base types and sizes. Other passes
will be able to create variables and ids using these types.
2020-02-04 14:00:19 +00:00
Alastair Donaldson
fdd0c87765
Update script that checks copyright years. (#3173) 2020-02-04 08:57:47 -05:00
Alastair Donaldson
b7e0998e3d
spirv-fuzz: Disallow copying of null and undefined pointers (#3172)
If the fuzzer object-copies a pointer we would like to be able to
perform loads from the copy (and stores to it, if its value is known
not to matter).  Undefined and null pointers present a problem here,
so this change disallows copying them.
2020-02-04 11:15:07 +00:00
Diego Novillo
a9624b4d5d
Handle TimeAMD in AmdExtensionToKhrPass. (#3168)
This adds support for replacing TimeAMD with OpReadClockKHR.  The scope
for OpReadClockKHR is fixed to be a subgroup because TimeAMD operates
only on subgroup.
2020-02-03 12:13:32 -05:00
Steven Perron
ddcc11763a Update CHANGES 2020-02-03 09:47:28 -05:00
Arseny Kapoulkine
0265a9d4de
Implement constant folding for many transcendentals (#3166)
* Implement constant folding for many transcendentals

This change adds support for folding of sin/cos/tan/asin/acos/atan,
exp/log/exp2/log2, sqrt, atan2 and pow.

The mechanism allows to use any C function to implement folding in the
future; for now I limited the actual additions to the most commonly used
intrinsics in the shaders.

Unary folder had to be tweaked to work with extended instructions - for
extended instructions, constants.size() == 2 and constants[0] ==
nullptr. This adjustment is similar to the one binary folder already
performs.

Fixes #1390.

* Fix Android build

On old versions of Android NDK, we don't get std::exp2/std::log2
because of partial C++11 support.

We do get ::exp2, but not ::log2 so we need to emulate that.
2020-02-03 09:20:47 -05:00
Alastair Donaldson
7a2d408dea
Fix typo in comment. (#3163) 2020-01-30 15:01:05 -05:00