Commit Graph

2172 Commits

Author SHA1 Message Date
sfricke-samsung
f37547c73a
spirv-val: Add Vulkan EXT builtins (#4115) 2021-01-20 10:40:31 -05:00
David Neto
1bd539b9bf
Support pending Intel extensions (#4116)
This patch supports new Intel extensions added via
https://github.com/KhronosGroup/SPIRV-Headers/pull/176

SPV_INTEL_fooat_controls2 requires extra support to add
two new operand types:
   SPV_OPERAND_TYPE_FPDENORM_MODE
   SPV_OPERAND_TYPE_FPOPERATION_MODE
2021-01-20 09:39:51 -05:00
David Neto
56f8ed48ef
Validate Sampled=1 for Vulkan ImageQuerySizeLod, ImageQueryLevels, ImageQueryLod (#4103)
Also require image type parameter to OpTypeSampledImage to have
Sampled=0 or Sampled=1

Fixes #4102
2021-01-19 17:44:45 -05:00
sfricke-samsung
e25db023c4
spirv-val: Add Vulkan Memory Scope VUs (#4106)
* Fix test using Fragment execution
2021-01-19 08:37:42 -05:00
Ben Clayton
8383bd5d6f
Migrate all Kokoro build scripts over to use the docker VM image (#4114)
* Work around GCC-9 warning treated as error

```
../source/opt/instruction.h:101:23: error: '*((void*)& operand +32)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  101 |     uint64_t result = uint64_t(words[0]);
```

* Migrate all Kokoro build scripts over to use the docker VM image

Required updating the NDK SDK and build scripts, as well as the check_copyright for handling 2021.
2021-01-18 13:36:26 -05:00
sfricke-samsung
ee39b5db5f
spirv-val: Add Vulkan Addressing Model check (#4107) 2021-01-15 09:35:17 -05:00
Ryan Harrison
9150cd441f
Remove WebGPU support (#4108)
Leaves SPV_ENV_WEBGPU_0 enum in place, but marked deprecated, so users
of the library are not broken by an API enum being removed.

Fixes #4101
2021-01-14 16:45:18 -05:00
sfricke-samsung
b2cfc5d1ce
spirv-val: Vulkan atomic storage class (#4079)
* spirv-val: Vulkan atomic storage class

* Add PhysicalStorageBuffer
2021-01-14 09:41:18 -05:00
Jaebaek Seo
cec658c116
Avoid integrity check failures caused by propagating line instructions (#4096)
Propagating the OpLine/OpNoLine to preserve the debug information
through transformations results in integrity check failures because of
the extra line instructions. This commit lets spirv-opt skip the
integrity check when the code contains OpLine or OpNoLine.
2021-01-13 09:08:28 -05:00
Pierre Moreau
b1507d0d2b
Linker usability improvements (#4084)
* tools/linker: Error out on unrecognized options

Fixes #4083.

* tools/linker: Use early returns when parsing options

This was already the case for some linker options, and other tools were
doing so for all of their options.

* tools/linker: Rework the usage output

* The new formatting for long options taking a value makes it explicit
  that there is no equal sign between the option name and the value.
* The options are sorted by lexicographical order.
* Change the option formatting from 90 columns to 80, to match the other
  tools.

* tools/linker: Change the default environment to spv1.5

* tools/linker: Change the default output to spv.out

Instead of writing to the standard output when the "-o" option is not
specified, the resulting linked SPIR-V binary will be written to
"spv.out".
One can still have the output sent to the standard output by specifying
"-o -".

* tools/linker: Update the reported target for --version

Running `spirv-link --version` will now report the currently selected
environment.

* tools/linker: Sort header includes

* linker: Improve module-related error messages

* Use 1-based indexing of modules;
* Say which module could not be built;
* Use the correct total number of input modules in the error message
  when one fails to build.
2021-01-13 09:05:40 -05:00
dan sinclair
7bbe1a3164
Revert "Generate differentiated error codes for buffer oob checking (#4097)" (#4100)
This reverts commit c32277c0ba.
2021-01-12 11:36:31 -05:00
greg-lunarg
c32277c0ba
Generate differentiated error codes for buffer oob checking (#4097)
This allows the GPU-AV layer to differentiate between errors with
uniform buffers versus storage buffers and map these to the relevant
VUIDs.
2021-01-11 08:42:48 -05:00
sfricke-samsung
ad77ed7a8d
spirv-val: Label standalone Vulkan VUID (#4091) 2021-01-07 09:00:05 -05:00
sfricke-samsung
aa005e8bd4
spirv-val: Add Vulkan decroation VUID (#4090) 2021-01-06 14:30:56 -05:00
Steven Perron
4ed1f4fce9
Fix binding number calculation in desc sroa (#4095)
When there is an array of strutured buffers, desc sroa will only split
the array, but not a struct type in the structured buffer.  However,
the calcualtion of the number of binding a struct requires does not take
this into consideration.  This commit will fix that.
2021-01-06 13:59:04 -05:00
sfricke-samsung
94d1a80159
spirv-val: Add Vulkan FP Mode VUID (#4088) 2021-01-06 12:45:28 -05:00
sfricke-samsung
6d05ed8410
spirv-val: Fix Vulkan image sampled check (#4085)
* Fix SampledType logic
2021-01-06 12:36:13 -05:00
sfricke-samsung
37c03859de
spirv-val: Add Vulkan ForwardPointer VUID (#4089) 2021-01-06 11:26:58 -05:00
sfricke-samsung
d630e5f8c1
spirv-val: Add Vulkan ImageTexelPointer format check (#4087) 2021-01-06 08:51:15 -05:00
sfricke-samsung
1bb80d2778
spirv-val: Add Vulkan Group Operation VUID (#4086) 2021-01-05 09:51:07 -05:00
sfricke-samsung
17ffa89097
spirv-val: Add first StandAlone VUID 04633 (#4077) 2020-12-17 13:51:17 -05:00
sfricke-samsung
8f4b35c332
spirv-val: Add Subgroup VUIDs (#4074) 2020-12-17 08:37:43 -05:00
Alastair Donaldson
4e31fdd4aa
spirv-fuzz: Fix OpPhi handling in DuplicateRegionWithSelection (#4065)
Avoid generating OpPhi on void types, and allow the transformation to
take place on regions that produce pointer and sampled image result
ids if such ids are not used after the region.

Fixes #3787.
2020-12-17 11:45:52 +00:00
David Neto
ad898cb949
validation: validate return type of OpImageRead (#4072)
Vulkan: must be 4-element vector
WebGPU: must be 4-element vector
OpenCL:
- must be scalar float for depth image
- must be 4-element vector otherwise
2020-12-15 12:00:59 -05:00
David Neto
305caff2eb
validation: tighter validation of multisampled images (#4059)
* validation: tighter validation of multisampled images

- if MS=1, then Sample image operand is required
- Sampling operations are not permitted when MS=1

Fixes #4057, #4058

* Fail early for multisampled image for sampling, dref, gather
2020-12-14 14:45:48 -05:00
David Neto
a0370efd58
validate OpTypeImage Sampled values for environemnts (#4064)
Fixes #4063
2020-12-10 17:15:46 -05:00
David Neto
7170218b8d
validate StorageImageMultisampled capability (#4062)
* validate StorageImageMultisampled capability

The StorageImageMultisampled capability is required when declaring
an image type with with Multisampled==1 and it's a storage image (Sampled == 2)

Fixes #4061

* Allow SubpassData with Multisampled and Sampled==2
2020-12-10 10:40:46 -05:00
sfricke-samsung
3b85234542
spirv-val: Add last TessLevelOuter and TessLevelInner VUID (#4055) 2020-12-08 14:38:55 -05:00
sfricke-samsung
171290703a
spirv-val: Add last ClipDistance and CullDistance VUID (#4054) 2020-12-08 14:37:24 -05:00
sfricke-samsung
1a6b4053fa
spirv-val: Add last ViewportIndex and Layer VUID (#4053) 2020-12-08 14:34:51 -05:00
sfricke-samsung
9df5225e67
spirv-val: Add last Position VUID (#4052) 2020-12-08 14:31:40 -05:00
alan-baker
862d44a86e
Allow forward pointer to be used in types generally (#4044)
Fixes #4042

* Allow types to have forward declarations as long as that declaration
  is an OpTypeForwardPointer
2020-12-08 08:46:47 -05:00
Marijn Suijten
bda102d7a7
opt: Run DCE when SPV_KHR_shader_clock is used (#4049)
Similar to [1] DCE should be ran when this extension is enabled to
prevent unused bindings from showing up (in particular atomic counters
attached to buffers).

[1]: https://github.com/KhronosGroup/SPIRV-Tools/pull/4047
2020-12-07 14:42:25 -05:00
Ehsan
cd05078662
Take new (raytracing) termination instructions into account. (#4050)
* Take new (raytracing) termination instructions into account.

* Remove duplicate function and add unit test.

* Use KHR for symbols in the test.
2020-12-07 10:26:05 -05:00
Ehsan
10e0ae7946
Do run DCE if SPV_KHR_ray_query is used. (#4047) 2020-12-02 18:46:19 -05:00
greg-lunarg
c1d5a045f6
Change ref_analysis to RefAnalysis to follow coding standards. (#4045) 2020-12-01 19:16:49 -05:00
Steven Perron
c502a15f25
Handle 8-bit index in elim dead member (#4043)
The eliminate dead member pass is written assuming that the index to an
OpAccessChain will be a 32-bit integer or 64-bit integer.  That is
changed to work for any width 64-bits or less.

Fixes https://crbug.com/1151727
2020-12-01 14:48:25 -05:00
Daniel Koch
32573bb216
Add validation support for the ray tracing built-in variables (#4041)
* Add validation for ray tracing builtins

- Remove existing InstanceId testing that was combined with VertexId in awkward ways.
- Rather than adding a new set of functions for each ray tracing builtin, add
  an error table that maps the builtin ID to the 3 common VUIDs for each builtin
  (I could see this being extended for other builtins in the future).
- add F32 matrix validation function
- augment existing PrimitiveId validation to verify Input storage class for the
  RT stages this is accepted in, and correct the list of stages that it is actually
  accepted in (only Intersection / Any Hit / Closest Hit)

* add testing for ray tracing builtins

- remove exising InstanceId testing as it was tangled in with VertexId in now weird ways
  and combine it with the new tests
- add testing for ray tracing builtins
- builtins accepted in the same stages and of the same types are combined into test functions
- add some new matrix types to the code generator so they can be used for testing
2020-12-01 11:42:37 -05:00
greg-lunarg
7046c05d2f
Add texel buffer out-of-bounds checking instrumentation (#4038)
This instruments ImageRead, ImageWrite and ImageFetch when applied to
texel buffers.

Also add new (but not yet generated) buffer OOB error codes differentiated
for VUID classification.
2020-12-01 11:28:16 -05:00
Alastair Donaldson
1299436c8f
Reject SPIR-V that applies void to OpUndef, OpCopyObject, OpPhi (#4036)
Fixes #4035.
2020-11-27 16:31:04 +00:00
David Neto
2c458414c0
BuildModule: optionally avoid adding new OpLine instructions (#4033)
* BuildModule: optionally avoid adding new OpLine instructions

Fixes #4029 for my use case

* Fix formatting

* Create last_line_inst_ only if doing extra line tracking
2020-11-25 14:54:32 -05:00
David Neto
a79aa038ec
Remove prototype for unimplemented method (#4031) 2020-11-25 13:47:38 -05:00
Alastair Donaldson
b0e22d28f5
spirv-fuzz: Fix facts arising from CompositeConstruct (#4034)
Fixes #4023.
2020-11-25 12:03:05 +00:00
Alastair Donaldson
5ffa320fee
spirv-fuzz: Do not flatten conditionals that create synonyms (#4030)
Fixes #4024.
2020-11-24 20:18:23 +00:00
David Neto
cd590fa334
Update MeshShadingNV dependencies (and land Ray tracing updates) (#4028)
* Update to final ray tracing extensions

Drop Provisional from ray tracing enums
    sed -ie 's/RayQueryProvisionalKHR/RayQueryKHR/g' **/*
    sed -ie 's/RayTracingProvisionalKHR/RayTracingKHR/g' **/*
Add terminator support for SpvOpIgnoreIntersectionKHR and SpvOpTerminateRayKHR
Update deps for SPIRV-Headers

* Update capability dependencies for MeshShadingNV

Accommodate https://github.com/KhronosGroup/SPIRV-Headers/pull/180

MeshShadingNV: enables PrimitiveId, Layer, and ViewportIndex

Co-authored-by: Daniel Koch <dkoch@nvidia.com>
2020-11-23 12:23:54 -05:00
greg-lunarg
671914c28e
Fix buffer oob instrumentation for matrix refs (#4025)
Fix buffer oob instrumentation for matrix refs.

Matrix stride decoration is not on matrix type but is a member decoration
on the enclosing struct type. Also correctly apply matrix stride depending
on row or column major.
2020-11-18 12:39:15 -05:00
Alastair Donaldson
1f2fcddd39
spirv-opt: Set parent when adding basic block (#4021)
Ensures that the parent of a block is set in Function::AddBasicBlock.
Removes various now unnecessary calls to BasicBlock::SetParent.

Fixes #3912.
2020-11-13 12:33:15 -05:00
Jaebaek Seo
f686518cee
spirv-opt: properly preserve DebugValue indexes operand (#4022)
spirv-opt has a bug that `DebugInfoManager::AddDebugValueWithIndex()` does not
preserve `Indexes` operands of
[DebugValue](https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.DebugInfo.100.html#DebugValue).
It has to preserve all of those `Indexes` operands, but it preserves only the first index
operand.

This PR removes `DebugInfoManager::AddDebugValueWithIndex()` and lets the spirv-opt
use `DebugInfoManager::AddDebugValueForDecl()`.
`DebugInfoManager::AddDebugValueForDecl()` preserves the Indexes operand correctly.
2020-11-13 12:06:38 -05:00
David Neto
1cda495274
Use less stack space when validating Vulkan builtins (#4019)
Don't pass a constructed string as an argument to
ValidateNotCalledwithExecutionModel. That method is captured via
std::bind and it ends up using lots of stack space.
Instead, pass in:
- a Vulkan validation unique ID as an integer instead,
  (with -1 meaning no VUID), and
- the const char* for the explanator text.
2020-11-11 13:29:28 -05:00
sfricke-samsung
a61d07a727
spirv-val: Fix SPV_KHR_fragment_shading_rate VUID label (#4014)
in 3943 the new tests should have failed, but didn't due to the AnyVUID
check not handling case with trailing whitespace. Added trimming to handle
it as easily might happen again in future
2020-11-05 13:04:47 -05:00
sfricke-samsung
650acb575b
spirv-val: Label Layer and ViewportIndex VUIDs (#4013) 2020-11-05 13:04:07 -05:00
alan-baker
0c036df288
Add dead function elimination to -O (#4015)
Fixes #4003

Both legalization and size formulae already run dead function
elimination after inlining. This change does the same for performance
passes.
2020-11-05 13:03:45 -05:00
Jaebaek Seo
c2b2b57885
Add DebugValue for invisible store in single_store_elim (#4002)
The front-end language compiler would simply emit DebugDeclare for
a variable when it is declared, which is effective through the variable's
scope. Since DebugDeclare only maps an OpVariable to a local variable,
the information can be removed when an optimization pass uses the
loaded value of the variable. DebugValue can be used to specify the
value of a variable. For each value update or phi instruction of a variable,
we can add DebugValue to help debugger inspect the variable at any
point of the program execution.
For example,

float a = 3;
... (complicated cfg) ...
foo(a); // <-- variable inspection: debugger can find DebugValue of `float a` in the nearest dominant

For the code with complicated CFG e.g., for-loop, if-statement, we
need help of ssa-rewrite to analyze the effective value of each variable
in each basic block.

If the value update of the variable happens only once and it dominates
all its uses, local-single-store-elim pass conducts the same value update
with ssa-rewrite and we have to let it add DebugValue for the value assignment.

One main issue is that we have to add DebugValue only when the value
update of a variable is visible to DebugDeclare. For example,

```
{  // scope1
   %stack = OpVariable %ptr_int %int_3
   {  // scope2
       DebugDeclare %foo %stack    <-- local variable "foo" in high-level language source code is declared as OpVariable "%stack"
       // add DebugValue "foo = 3"
       ...
       Store %stack %int_7   <-- foo = 7, add DebugValue "foo = 7"
       ...
       // debugger can inspect the value of "foo"
    }
    Store %stack %int_11   <-- out of "scope2" i.e., scope of "foo". DO NOT add DebugValue "foo = 11"
}
```

However, the initalization of a variable is an exception.
For example, an argument passing of an inlined function must be done out of
the function's scope, but we must add a DebugValue for it.

```
// in HLSL
bar(float arg) { ... }
...
float foo = 3;
bar(foo);

// in SPIR-V
%arg = OpVariable
OpStore %arg %foo   <-- Argument passing. Out of "float arg" scope, but we must add DebugValue for "float arg"
... body of function bar(float arg) ...
```

This PR handles the except case in local-single-store-elim pass. It adds
DebugValue for a store that is considered as an initialization.

The same exception handling code for ssa-rewrite is done by this commit: df4198e50e.
2020-11-04 13:43:59 -05:00
Diego Novillo
c74d5523bb
Fix SSA re-writing in the presence of variable pointers. (#4010)
This fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/3873.

In the presence of variable pointers, the reaching definition may be
another pointer.  For example, the following fragment:

 %2 = OpVariable %_ptr_Input_float Input
%11 = OpVariable %_ptr_Function__ptr_Input_float Function
      OpStore %11 %2
%12 = OpLoad %_ptr_Input_float %11
%13 = OpLoad %float %12

corresponds to the pseudo-code:

layout(location = 0) in flat float *%2
float %13;
float *%12;
float **%11;
*%11 = %2;
%12 = *%11;
%13 = *%12;

which ultimately, should correspond to:

%13 = *%2;

During rewriting, the pointer %12 is found to be replaceable by %2.
However, when processing the load %13 = *%12, the type of %12's reaching
definition is another float pointer (%2), instead of a float value.

When this happens, we need to continue looking up the reaching definition
chain until we get to a float value or a non-target var (i.e. a variable
that cannot be SSA replaced, like %2 in this case since it is a function
argument).
2020-11-04 10:23:53 -05:00
Alastair Donaldson
02195a029c
spirv-fuzz: Fixes to pass management (#4011) 2020-11-04 10:45:53 +00:00
Alastair Donaldson
bcf5b211db
spirv-fuzz: Add support for reining in rogue fuzzer passes (#3987)
Adds some functions that allow a fuzzer pass to check whether it is
spiralling out of control and exit early.  The fuzzer pass for adding
bit instruction synonyms now uses this.  Also make many methods in
FuzzerContext const.
2020-11-03 16:51:10 +00:00
Vasyl Teliman
7d250ed510
spirv-fuzz: Fix assertion failure in FuzzerPassAddCompositeExtract (#3995) 2020-11-03 15:09:36 +00:00
Vasyl Teliman
f9937bcc83
spirv-fuzz: Fix invalid equation facts (#4009)
Fixes #4008.
2020-11-03 15:06:55 +00:00
Vasyl Teliman
aa6035f1c6
spirv-fuzz: Fix bugs in TransformationFlattenConditionalBranch (#4006)
Fixes #4005.
Fixes #3993.
2020-11-03 15:03:08 +00:00
André Perez
5735576f87
spirv-fuzz: Fix bug related to transformation applicability (#3990)
This PR fixes a bug related to the transformation applicability.
When the OpNot case was implemented, its opcode was not
added to the list of supported bit instructions in IsApplicable.
So, the changes made are the following.

- Add OpNot to the list of supported bit instructions.
- Update the tests.
2020-11-03 10:48:30 +00:00
Jaebaek Seo
f7da527757
Temporarily add EmptyPass to prevent glslang from failing (#4004)
Removing PropagateLineInfoPass and RedundantLineInfoElimPass from
56d0f5035 makes unit tests of many open source projects fail.
It will happen before submitting this glslang PR
https://github.com/KhronosGroup/glslang/pull/2440. This commit will be
git-reverted after merging the glslang PR.
2020-10-30 18:03:56 -04:00
Junda Liu
82b378d671
spirv-opt: Add support to prevent functions from being inlined if they have DontInline flag (#3858)
This commit add support for optimizer to not inline functions with DontInline control flag, so that the [noinline] attribute in HLSL will be useful in DXC SPIR-V generation.

This is part of work of github.com/microsoft/DirectXShaderCompiler/issues/3158
2020-10-29 16:38:56 -04:00
Jaebaek Seo
56d0f50357
Propagate OpLine to all applied instructions in spirv-opt (#3951)
Based on the OpLine spec, an OpLine instruction must be applied to
the instructions physically following it up to the first occurrence
of the next end of block, the next OpLine instruction, or the next
OpNoLine instruction.

```
OpLine %file 0 0
OpNoLine
OpLine %file 1 1
OpStore %foo %int_1
%value = OpLoad %int %foo
OpLine %file 2 2
```

For the above code, the current spirv-opt keeps three line
instructions `OpLine %file 0 0`, `OpNoLine`, and `OpLine %file 1 1`
in `std::vector<Instruction> dbg_line_insts_` of Instruction class
for `OpStore %foo %int_1`. It does not put any line instruction to
`std::vector<Instruction> dbg_line_insts_` of
`%value = OpLoad %int %foo` even though `OpLine %file 1 1` must be
applied to `%value = OpLoad %int %foo` based on the spec.

This results in the missing line information for
`%value = OpLoad %int %foo` while each spirv-opt pass optimizes the
code. We have to put `OpLine %file 1 1` to
`std::vector<Instruction> dbg_line_insts_` of
both `%value = OpLoad %int %foo` and `OpStore %foo %int_1`.

This commit conducts the line instruction propagation and skips
emitting the eliminated line instructions at the end, which are the same
with PropagateLineInfoPass and RedundantLineInfoElimPass. This
commit removes PropagateLineInfoPass and RedundantLineInfoElimPass.

KhronosGroup/glslang#2440 is a related PR that stop using
PropagateLineInfoPass and RedundantLineInfoElimPass from glslang.
When the code in this PR applied, the glslang tests will pass.
2020-10-29 13:06:30 -04:00
Ben Clayton
7403dfafd8
CMake: Add SPIRV_TOOLS_BUILD_STATIC flag (#3910)
If enabled the following targets will be created:

* `${SPIRV_TOOLS}-static` - `STATIC` library. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.
* `${SPIRV_TOOLS}`        - will alias to one of above, based on BUILD_SHARED_LIBS.

If disabled the following targets will be created:

* `${SPIRV_TOOLS}`        - either `STATIC` or `SHARED` based on the new `SPIRV_TOOLS_LIBRARY_TYPE` flag. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.

Defaults to `ON`, matching existing build behavior.

This flag can be used by package maintainers to ensure that all libraries are built as shared objects.
2020-10-29 09:25:26 -04:00
David Neto
25ee275763
Avoid copying a ref in a loop (#4000)
Avoid triggering a warning from newer Clang, which turns into an error
on macOS.
2020-10-29 09:20:45 -04:00
Sidney Just
5edb328e81
spirv-val: Allow the ViewportIndex and Layer built-ins on SPIR-V 1.5 (#3986)
* spirv-val: Allow the ViewportIndex and Layer built-ins when their corresponding SPIR-V 1.5 capabilities are present
* Added tests for OpCapability ShaderViewportIndex and OpCapability ShaderLayer
2020-10-28 14:05:06 -04:00
Diego Novillo
cbd1fa6c42
Simplify logic to decide whether CCP modified the IR (#3997)
Simplify logic to decide whether CCP modified the IR.

The previous attempts at fixing this issue relied on marking the IR
changed only when CCP was able to fold an instruction during
propagation (https://github.com/KhronosGroup/SPIRV-Tools/pull/3799,
https://github.com/KhronosGroup/SPIRV-Tools/pull/3732).

Those fixes missed the case described in
https://github.com/KhronosGroup/SPIRV-Tools/issues/3991.  In this case,
the folder never actually succeeds in folding the instruction, but it
does create constants in the process.

Fixed with this change.
2020-10-28 10:18:34 -04:00
Jaebaek Seo
df4198e50e
Add DebugValue for DebugDecl invisible to value assignment (#3973)
For some cases, we have DebugDecl invisible to a value assignment, but
the value assignment information is important i.e., debugger cannot inspect
the variable without the information. For example, a parameter of an inlined
function must have its value assignment i.e., argument passing out of its
function scope. If we simply remove DebugDecl because it is invisible to the
argument passing, we cannot inspec the variable.

This PR
- Adds DebugValue for DebugDecl invisible to a value assignment. We use
the value of the variable in the basic block that contains DebugDecl, which is
found by ssa-rewrite. If the value instruction does not dominate DebugDecl,
we use the value of the variable in the immediate dominator of the basic block.
- Checks the visibility of DebugDecl for Phi value assignment based on the
all value operands of the Phi. Since Phi just references multiple values from
multiple basic blocks, scopes of value operands must be regarded as the scope
of the Phi.
2020-10-27 15:10:08 -04:00
greg-lunarg
34ae8a4757
Fix bounds check instrumentation to handle 16-bit values (#3983) 2020-10-26 09:31:35 -04:00
André Perez
abe2eff36f
spirv-fuzz: Add expand vector reduction transformation (#3869)
The following implementations are introduced:

- Transformation and fuzzer pass for expanding vector reduction.
- Unit tests to cover the instructions with different vector sizes.

Fixes #3768.
2020-10-23 14:59:08 +01:00
Vasyl Teliman
99ad4f1e29
spirv-fuzz: Don't replace irrelevant indices in OpAccessChain (#3988)
Part of #3980.
2020-10-23 14:52:22 +01:00
Vasyl Teliman
895dafcc1d
spirv-fuzz: Add FuzzerPassAddCompositeExtract (#3904)
Fixes #3806.
2020-10-23 14:49:50 +01:00
Alastair Donaldson
69f07da41b
spirv-fuzz: Fix mismatch with shrinker step limit (#3985)
Fixes #3984.
2020-10-22 23:23:59 +01:00
Alastair Donaldson
9223493f4d
spirv-fuzz: Fix off-by-one error in replayer (#3982)
Fixes #3981.
2020-10-22 20:07:09 +01:00
Alastair Donaldson
4f5423187d
spirv-fuzz: Get order right for OpSelect arguments (#3974)
Fixes #3948.
2020-10-22 16:05:51 +01:00
Alastair Donaldson
88f7bcb6af
spirv-fuzz: Do not add synonym-creating loops in dead blocks (#3975)
Fixes #3954.
2020-10-22 12:07:49 +01:00
Alastair Donaldson
64eaa9832f
spirv-fuzz: Skip OpTypeSampledImage when propagating up (#3976)
Fixes #3959.
2020-10-22 12:07:17 +01:00
Alastair Donaldson
53f2a69c19
spirv-fuzz: Pass OpUndef in function call if needed (#3978)
Fixes #3977.
2020-10-22 12:06:54 +01:00
Alastair Donaldson
de2c0ba202
spirv-fuzz: Fix off-by-one in TransformationCompositeConstruct (#3979) 2020-10-22 12:06:37 +01:00
Alastair Donaldson
dc4a182282
spirv-fuzz: Tolerate absent ids in data synonym fact management (#3966)
Fixes #3952.
2020-10-22 00:06:53 +01:00
Alastair Donaldson
8496780f57
spirv-fuzz: Fix to id availability (#3971)
Fixes #3958.
2020-10-21 22:52:47 +01:00
Alastair Donaldson
3b7aebca45
spirv-fuzz: Fix operand types (#3962)
Fixes #3945.
Fixes #3946.
2020-10-21 22:41:30 +01:00
Alastair Donaldson
a8d7062fe5
spirv-fuzz: Don't flatten conditional if condition is irrelevant (#3944)
Fixes #3942.
2020-10-21 21:26:59 +01:00
Alastair Donaldson
a3d5378df6
spirv-fuzz: Do not produce OpPhis of type OpTypeSampledImage (#3964)
Also removes some redundant validity checks in tests.

Fixes #3950.
2020-10-21 21:12:19 +01:00
Alastair Donaldson
7edd0525b9
spirv-fuzz: Restrict fuzzer pass to reachable blocks (#3970) 2020-10-21 20:52:58 +01:00
Alastair Donaldson
f03779a1a1
spirv-fuzz: Handle more types when extending OpPhi instructions (#3969)
Fixes #3953.
2020-10-21 20:52:36 +01:00
Alastair Donaldson
c794b70461
spirv-fuzz: Skip early terminator wrappers when merging returns (#3968)
Fixes #3955.
2020-10-21 20:51:10 +01:00
Alastair Donaldson
dc9c6407d6
spirv-fuzz: Avoid irrelevant constants in synonym-creating loops (#3967)
Fixes #3956.
2020-10-21 20:50:45 +01:00
Alastair Donaldson
26954c281e
spirv-fuzz: Skip dead blocks in FuzzerPassAddOpPhiSynonyms (#3965)
Fixes #3949.
2020-10-21 20:49:33 +01:00
Alastair Donaldson
5600fb85b6
spirv-fuzz: Avoid the type manager when looking for struct types (#3963)
Fixes #3947.
2020-10-21 18:28:05 +01:00
Alastair Donaldson
ba15b58862
spirv-fuzz: Fix to TransformationDuplicateRegionWithSelection (#3941)
Also incorporates a few style fixes.

Fixes #3940.
2020-10-20 18:59:53 +01:00
Alastair Donaldson
5984350044
spirv-fuzz: Skip OpFunction when replacing irrelevant ids (#3932)
Fixes #3927.
2020-10-20 18:58:42 +01:00
Alastair Donaldson
8362eae552
spirv-fuzz: Use component-wise selectors when flattening conditional branches (#3921)
Fixes #3920.
2020-10-20 18:57:56 +01:00
Tobski
ebe0ea09f0
Add SPV_EXT_shader_image_int64 (#3852)
* Add SPV_EXT_shader_image_atomic_int64
* Added 64-bit image tests


Co-authored-by: Arkadiusz Sarwa <arkadiusz.sarwa@amd.com>
2020-10-20 11:55:26 -04:00
Tobski
a1d38174b1
Support SPV_KHR_fragment_shading_rate (#3943) 2020-10-20 08:00:13 -04:00
Alastair Donaldson
6fac705e76
spirv-val: Fix validation of OpPhi instructions (#3919)
Fixes #3918.
2020-10-19 17:36:21 +01:00
Alastair Donaldson
b1350659b6
spirv-fuzz: Avoid void struct member when outlining functions (#3936)
Fixes #3935.
2020-10-19 17:34:31 +01:00
Alastair Donaldson
fd0f295da6
spirv-fuzz: Do not allow Block-decorated structs when adding parameters (#3931)
Fixes #3929.
2020-10-19 17:34:04 +01:00
Alastair Donaldson
5d7893b376
spirv-fuzz: Fix to operand id type (#3937)
Fixes #3934.
2020-10-19 17:33:25 +01:00
Alastair Donaldson
cd1d3b6e0c
spirv-fuzz: Handle dead blocks in TransformationEquationInstruction (#3933)
Fixes #3926.
2020-10-19 17:32:56 +01:00