Commit Graph

72 Commits

Author SHA1 Message Date
Ryan Harrison
95df4c9643
Add in a bunch of missed files to the BUILD.gn (#3360)
Fixes #3357
2020-05-19 15:17:58 -04:00
Ryan Harrison
90930cb311
Remove stale entries from BUILD.gn (#3358)
Fixes #3357
2020-05-19 13:25:45 -04:00
Jaebaek Seo
42268740c9
Add debug information analysis (#3305)
We need an analysis for OpenCL.DebugInfo.100 extension instructions such
as a map between function id and its DebugFunction. This commit add an
analysis for it.
2020-04-27 15:18:55 -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
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
Geoff Lang
c316fb15fb
Add missing dependencies when generating spvtools_core_tables (#3199) 2020-02-21 17:23:42 -05:00
Shahbaz Youssefi
1b3441036a Fix chromium build (#3152)
Signed-off-by: Shahbaz Youssefi <syoussefi@google.com>
2020-01-24 17:14:16 -05:00
Shahbaz Youssefi
b97057e7f7 Use spirv-headers' BUILD.gn (#3148)
* Roll external/spirv-headers/ af64a9e82..dc77030ac (4 commits)

$ git log af64a9e82..dc77030ac --date=short --no-merges --format='%ad %ae %s'
2020-01-20 dneto Fix the license to match LICENSE
2020-01-20 syoussefi Add BUILD.gn
2019-11-20 Tobias.Hector Off-by-one errors
2019-11-20 Tobias.Hector Reserve a new block of 64 opcodes

Created with:
  roll-dep external/spirv-headers

* Use BUILD.gn from spirv-headers
2020-01-23 13:40:12 -05:00
David Neto
fb2e819819
Fix GN build for OpenCL.DebugInfo.100 update (#3134)
The utils/generate_grammar_tables.py vendor-operand-kind-prefix
can now take a value of "...nil..." to signify the empty string.
That's needed because GN doesn't quote empty string arguments
correctly down into its action commands.

Fixes #3120
2020-01-08 17:27:38 -05:00
David Neto
64f36ea529
Support OpenCL.DebugInfo.100 extended instruction set (#3080)
* Clone opencl.debuginfo.100 grammar from debuginfo grammar

Update version number to 200 revision 2

* Apply content from OpenCL.DebugInfo.100 extension text

* Rename grammar file

* Support OpenCL.DebugInfo.100 extended instructions

Add support for prefixing operand type names, to disambiguate
them between different instruction sets.

* Add tests for OpenCL.DebugInfo.100

* Support lookup of OpenCL.DebugInfo.100 extinst

* Add tests for enum values

* Recognize 2017-2019 as copyright date range

* Android.mk: support OpenCL.DebugInfo.100 extended instruction set

Also, stop generating core instruction tables for non-unified1 versions
of the grammar.

* Imported entity operand type is concrete

* Bazel: Suppoort OpenCL.DebugInfo.100

* BUILD.gn: Support OpenCL.DebugInfo.100
2019-12-19 17:16:26 -05:00
Jamie Madill
e0d5544c98 Add missing headers to GN. (#3009)
Detected via ANGLE's export_targets.py.

Fixes #3008
2019-11-04 21:01:57 -05:00
Ryan Harrison
c705032b2b
Remove non-existent files from BUILD.gn (#2955)
Fixes #2954
2019-10-09 15:46:36 -04:00
alan-baker
527a689307
Remove validate_datarules.cpp (#2911)
* Checks moved into individual opcode validation
  * removes duplicated checks
* Add check that forward pointer points to struct
2019-09-24 17:55:12 -04:00
dan sinclair
3a762d54f6
Add missing GN dependency (#2899) 2019-09-23 12:56:29 -04:00
David Turner
36c1c0e22f Fix Fuchsia build. (#2868)
Most auto-generated files included by the SPIRV-Tools sources
do not have a proper newline at the end of file, creating a
hundred of compiler warnings, and even some build failures
when BUILD.gn is used for the Fuchsia build.

This fixes the issue by disabling the warning entirely.
2019-09-17 15:57:15 -04:00
Steven Perron
35c9518c4e
Handle id overflow in the ssa rewriter. (#2845)
* Handle id overflow in the ssa rewriter.

Remove LocalSSAElim pass at the same time.  It does the same thing as the SSARewrite pass. Then even share almost all of the same code.

Fixes crbug.com/997246
2019-09-10 09:38:23 -04:00
Jamie Madill
635b583cf1 GN: Add Chromium GoogleTest deps. (#2832)
This fixes a GN header check in the Chromium integration.
2019-09-04 12:43:26 -04:00
greg-lunarg
d11725b1d4 Add --relax-float-ops and --convert-relaxed-to-half (#2808)
The first pass applies the RelaxedPrecision decoration to all executable
instructions with float32 based type results. The second pass converts
all executable instructions with RelaxedPrecision result to the equivalent
float16 type, inserting converts where necessary.
2019-09-03 13:22:13 -04:00
Jamie Madill
1c9ca422dd GN: Make SPIRV-Tools target use public_deps. (#2828)
Should prevent invalid header usage warnings in dependent targets.

See http://anglebug.com/3876 for context.
2019-09-03 12:57:32 -04:00
Corentin Wallez
4ae9b71651 Fix gn check (#2821)
spriv-opt was missing a dependency on the AMD ballot extension that was
needed because it uses a header in the AMD ext to KHR ext pass.
2019-08-30 09:09:34 -04:00
Steven Perron
35d98be3bc
Amd ext to khr (#2811)
Add the first steps to removing the AMD extension VK_AMD_shader_ballot.
Splitting up to make the PRs smaller.

Adding utilities to add capabilities and change the version of the
module.

Replaces the instructions:

OpGroupIAddNonUniformAMD = 5000
OpGroupFAddNonUniformAMD = 5001
OpGroupFMinNonUniformAMD = 5002
OpGroupUMinNonUniformAMD = 5003
OpGroupSMinNonUniformAMD = 5004
OpGroupFMaxNonUniformAMD = 5005
OpGroupUMaxNonUniformAMD = 5006
OpGroupSMaxNonUniformAMD = 5007

and extentend instructions

WriteInvocationAMD = 3
MbcntAMD = 4

Part of #2814
2019-08-29 12:48:17 -04:00
jonahryandavis
1eb89172a8 Add missing files to BUILD.gn (#2809)
New files missing from BUILD.gn caused build failures in Chromium and
ANGLE:
remove_relaxed_precision_decoration_opportunity_finder.cpp
remove_relaxed_precision_decoration_opportunity_finder.h
2019-08-23 13:14:34 -04:00
greg-lunarg
06407250a1 Instrument: Add support for Buffer Device Address extension (#2792) 2019-08-16 09:18:34 -04:00
Steven Perron
60043edfa1
Replace OpKill With function call. (#2790)
We are no able to inline OpKill instructions into a continue construct.
See #2433.  However, we have to be able to inline to correctly do
legalization.  This commit creates a pass that will wrap OpKill
instructions into a function of its own.  That way we are able to inline
the rest of the code.

The follow up to this will be to not inline any function that contains
an OpKill.

Fixes #2726
2019-08-14 09:27:12 -04:00
Steven Perron
4b64beb1ae
Add descriptor array scalar replacement (#2742)
Creates a pass that will replace a descriptor array with individual variables.  See #2740 for details.

Fixes #2740.
2019-08-08 10:53:19 -04:00
David Neto
31590104ec
Add pass to inject code for robust-buffer-access semantics (#2771)
spirv-opt: Add --graphics-robust-access

Clamps access chain indices so they are always
in bounds.

Assumes:
- Logical addressing mode
- No runtime-array-descriptor-indexing
- No variable pointers

Adds stub code for clamping coordinate and samples
for OpImageTexelPointer.

Adds SinglePassRunAndFail optimizer test fixture.

Android.mk: add source/opt/graphics_robust_access_pass.cpp

Adds Constant::GetSignExtendedValue, Constant::GetZeroExtendedValue
2019-07-30 19:52:46 -04:00
greg-lunarg
92c41ff1e7 Remove Common Uniform Elimination Pass (#2731)
Remove Common Uniform Elimination Pass

Fixes #2520.
2019-07-12 11:02:10 -04:00
Corentin Wallez
59de04ad68 BUILD.gn: Add deps and move files for gn check (#2735)
This makes SPIRV-Tools produce no GN check errors when used in Dawn and
ANGLE.
2019-07-12 10:35:59 -04:00
alan-baker
1a2de48a12 Extra small storage validation (#2732)
Fixes #2729

* Check acceptable uses of small type generators
2019-07-11 13:05:14 -04:00
David Turner
5081512502 BUILD.gn: Add targets to build all command-line tools (#2727)
This adds all the command-line tools from the CMakeLists.txt
file to the BUILD.gn used by Chromium and Fuchsia.

+ Add a convenient "all_spirv_tools" GN target to rebuild
  all command-line tools at once.

+ "gn format" pass to fix a few minor issues in the file.

Tested on Chromium with the following procedure:

 1) Have a clean Chromium checkout

 2) # Update to upstream spirv-headers (otherwise spirv-tools build fails)
    cd $CHROMIUM_SRC/third_party/spirv-headers/src &&
    git remote add upstream https://github.com/KhronosGroup/SPIRV-Headers.git &&
    git fetch upstream &&
    git checkout upstream/master

 3) # Update to upstream spirv-tools (Chromium is tracking older revision)
    cd $CHROMIUM_SRC/third_party/SPIRV-Tools/src &&
    git remote add upstream https://github.com/KhronosGroup/SPIRV-Tools.git &&
    git fetch upstream &&
    git checkout -tb check-patch upstream/master &&
    git cherry-pick <patch>

 3) # Rebuild Chromium and all SPIR-V tools for the host
    cd $CHROMIUM_SRC/src &&
    gn gen out/Linux --args 'use_goma = true' &&
    ninja -C out/Linux -j1000 -l30 gn_all all_spirv_tools

 4) Run the command-line tools, e.g.:

    out/Linux/spirv-link --help
2019-07-10 16:37:10 -04:00
David Turner
a6bfc26e5f Fix BUILD.gn for Fuchsia platform build. (#2692)
In order for the Fuchsia source tree to update its
version of SPIRV-Tools to a newer upstream, the
BUILD.gn needs to be slightly altered to take care
of the fact that it can be used with a different
GN //build set of rules and configs than the
Chromium one.

This is done by using |build_with_chromium|, already
defined by //build_overrides/build.gni, to guard
Chromium-specific statements.

+ Add a target to generate spirv-opt which is used by
  Fuchsia to optimize shaders at build time for some
  of its graphics libraries.
2019-07-03 16:26:06 -04:00
Jeff Bolz
2c0111e6eb Add validation for SPV_EXT_fragment_shader_interlock (#2650) 2019-06-03 10:55:07 -04:00
Ryan Harrison
f6d9a17843
Add pass to fix some invalid unreachable blocks for WebGPU (#2563)
Attempts to split up unreachable blocks that are used both as a
merge-block and a continue-target.

Fixes #2429
2019-05-09 12:56:10 -04:00
Ryan Harrison
048dcd38ce
Implement WebGPU->Vulkan initializer conversion for 'Function' variables (#2513)
WebGPU requires certain variables to be initialized, whereas there are
known issues with using initializers in Vulkan. This PR is the first
of three implementing a pass to decompose initialized variables into
a variable declaration followed by a store. This has been broken up
into multiple PRs, because there 3 distinct cases that need to be
handled, which require separate implementations.

This first PR implements the basic infrastructure that is needed, and
handling of Function storage class variables. Private and Output will
be handled in future PRs.

This is part of resolving #2388
2019-04-16 14:31:36 -04:00
Ryan Harrison
102e430a88
Add pass to legalize OpVectorShuffle for WebGPU (#2509)
In WebGPU, the component operand 0xFFFFFFFF is forbidden, but in
Vulkan it is used to indicate a value is undefined. When converting to
WebGPU, 0xFFFFFFFF needs to converted to a legal value, though the
specific one does not matter, since it was used to indicate an
undefined entry in the original code. Choosing to use 0, since the
operands are required to be on [0, N-1], so 0 is guaranteed to always
be valid.

Fixes #2349
2019-04-12 12:14:23 -04:00
Steven Perron
3a0bc9e724
Add fix storage class code. (#2434)
This pass tries to fix validation error due to a mismatch of storage classes
in instructions.  There is no guarantee that all such error will be fixed,
and it is possible that in fixing these errors, it could lead to other
errors.

Fixes #2430.
2019-04-05 13:12:08 -04:00
Shahbaz Youssefi
e8c2d95ed4 Fix webgpu header file name in BUILD.gn (#2493)
A .h file was specified as .hpp file, causing `gn gen path/ --check` to
fail.
2019-04-04 11:46:51 -04:00
Ryan Harrison
01964e325f
Add pass to generate needed initializers for WebGPU (#2481)
Fixes #2387
2019-04-03 11:44:09 -04:00
Ryan Harrison
e545522146
Add --strip-atomic-counter-memory (#2413)
Adds an optimization pass to remove usages of AtomicCounterMemory
bit. This bit is ignored in Vulkan environments and outright forbidden
in WebGPU ones.

Fixes #2242
2019-03-14 13:34:33 -04:00
Jamie Madill
4b42cd19d3 BUILD.gn: Only build tests in Chromium. (#2392)
The prior GoogleTest integration was incomplete and produced errors
when building with 'gn check' enabled. Fix this by scoping the test
integration to Chromium.

Fixes Issue #2382
2019-02-19 10:38:38 -05:00
Steven Perron
1b0047f210
Add pass to remove dead members. (#2379)
Add a pass that looks for members of structs whose values do not affects
the output of the shader. Those members are then removed and just
treated like padding in the struct.
2019-02-14 13:42:35 -05:00
Takuto Ikuta
0187c190b5 Fix BUILD.gn (#2381)
extensions_enum.inc is included from source/table.h.
So spvtools_core_enums_unified1 target should be in public_deps of
spvtools target.

This is for crbug.com/931596
2019-02-13 10:24:06 -05:00
Alastair Donaldson
34c5ac614c
Fixes #2358. Added to the reducer the ability to remove a function t… (#2361)
* Fixes #2358.  Added to the reducer the ability to remove a function that is not directly called.  Factored out some code from the optimizer to help with this.
2019-02-08 16:20:29 +00:00
David Neto
cf78346230 Add source/opt/block_merge_util.* to BUILD.gn (#2344) 2019-01-28 21:42:35 -05:00
Steven Perron
dd4157dcee
Sink (#2284)
Add code sinking pass. It will move OpLoad and OpAccessChain instructions as close as possible to their uses.

Part of #1611.
2019-01-17 15:56:36 -05:00
Ryan Harrison
cf37ab7213
Merge two implementations of ValidateMemorySemantics (#2175)
Fixes #2170
2018-12-06 14:38:15 -05:00
dan sinclair
67b2e1555a
Fixup BUILD.gn from addtion of upgrade_memory_model (#2152) 2018-12-03 09:11:56 -05:00
Ryan Harrison
8ce3dbabb8
Merge two implementations of ValidateExecutionScope (#2131) 2018-11-29 13:48:42 -05:00
dan sinclair
703305b1a5
Fixup BUILD.gn file (#2129) 2018-11-28 09:17:13 -05:00
greg-lunarg
c37388f1ad Add passes to propagate and eliminate redundant line instructions (#2027). (#2039)
These are bookend passes designed to help preserve line information
across passes which delete, move and clone instructions. The propagation
pass attaches a debug line instruction to every instruction based on
SPIR-V line propagation rules. It should be performed before optimization.
The redundant line elimination pass eliminates all line instructions
which match the previous line instruction. This pass should be performed
at the end of optimization to reduce physical SPIR-V file size.

Fixes #2027.
2018-11-15 14:06:17 -05:00