OSDN Git Service

android-x86/external-swiftshader.git
4 years agoKokoro: Move llvm configs into 7.0 subdirectory, create 10.0 copies.
Ben Clayton [Thu, 26 Mar 2020 11:50:48 +0000 (11:50 +0000)]
Kokoro: Move llvm configs into 7.0 subdirectory, create 10.0 copies.

And add the LLVM_VERSION env var and plumb this into the shell scripts.
Stub building the 10.0 builds for now. We'll enable them one at a time.

Bug: b/152339534
Change-Id: I645a6d748dec956505ba550ce96ff85a21f9f73e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43012
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoRegres: Add support for generating collated coverage info
Ben Clayton [Tue, 24 Mar 2020 17:55:40 +0000 (17:55 +0000)]
Regres: Add support for generating collated coverage info

`run_testlist` now supports the `--coverage` flag, which will collate the coverage information from each and every deqp test that's run.
This information is written to a `coverage.json` file which can be consumed by a html browser.

An early version of this can be found here (likely to move):
https://ben-clayton.github.io/swiftshader-coverage/

Bug: b/152192800
Change-Id: I52434f1ce30e6a091d2932fbae309cd81809cb79
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42890
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoCMake: Emit coverage-toolchain.txt file next to ICD json
Ben Clayton [Tue, 24 Mar 2020 17:48:31 +0000 (17:48 +0000)]
CMake: Emit coverage-toolchain.txt file next to ICD json

When `SWIFTSHADER_EMIT_COVERAGE` is enabled, generate a new `coverage-toolchain.txt` text file next to the `vk_swiftshader_icd.json` file. This file contains a path to the C++ compiler toolchain used to build swiftshader, so that the regres tooling can locate the llvm tools used to parse the coverage data.

Bug: b/152192800
Change-Id: I3aa718206c3262bcd05e13e854002dea8f40801f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42889
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoCMake: Add SWIFTSHADER_EMIT_COVERAGE option
Ben Clayton [Mon, 23 Mar 2020 13:18:09 +0000 (13:18 +0000)]
CMake: Add SWIFTSHADER_EMIT_COVERAGE option

Enables code coverage generation for gcc and clang toolchains.

Bug: b/152192800
Change-Id: If4cca74f2c5edf23626fe6053f29928e62ec00d3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42709
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoCMake: Add option for selecting LLVM version.
Ben Clayton [Thu, 26 Mar 2020 11:18:05 +0000 (11:18 +0000)]
CMake: Add option for selecting LLVM version.

And move LLVM_DIR and LLVM_CONFIG_DIR into the llvm's CMakeLists.txt

Bug: b/145758253
Bug: b/152339534
Change-Id: I29e555e09b82dcf77cd9e9d57b5fb8a477473bbe
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43008
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoMerge "Initial drop of LLVM 10 to third_party/llvm-10.0"
Ben Clayton [Thu, 26 Mar 2020 09:09:53 +0000 (09:09 +0000)]
Merge "Initial drop of LLVM 10 to third_party/llvm-10.0"

4 years agoIdentify image views based on their state
Nicolas Capens [Thu, 19 Mar 2020 04:26:21 +0000 (00:26 -0400)]
Identify image views based on their state

It is typical for apps to have many image views (and buffer views) with
the same parameters. This change avoids generating new sampling routines
for image views with identical state.

The vk::Identifier class compresses the state into a 32-bit value that
is used as part of the key for the sampling routine cache.

Bug: b/151235334
Change-Id: I00fc19a91639803273d0f7d6b9fed9fc5b481898
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42388
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoProvide packed VkFormat to uint8_t mapping
Nicolas Capens [Wed, 18 Mar 2020 21:23:18 +0000 (17:23 -0400)]
Provide packed VkFormat to uint8_t mapping

There are only 241 unique format enums at this moment, so they can fit
in an 8-bit variable instead of the 32-bit enum.

Bug: b/148016460
Change-Id: I00d47a87ac0d053aee44a5d18f3c96d78c0f7cb0
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42528
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoUniquely identify sampler state
Nicolas Capens [Tue, 17 Mar 2020 21:29:11 +0000 (17:29 -0400)]
Uniquely identify sampler state

To avoid re-generating sampling routines for sampler with identical
state, keep a map of sampler state to 32-bit integer identifiers.

Bug: b/151235334
Change-Id: I105151675afbf29bd29585e866b8cd976f66fb49
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42468
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSplit vk::Sampler state off into a structure
Nicolas Capens [Mon, 23 Mar 2020 17:00:43 +0000 (13:00 -0400)]
Split vk::Sampler state off into a structure

This enables deriving the state structure from Memset<> so we can ensure
it is fully zero-initialized and becomes comparable, while vk::Sampler
holds the identifier for the state.

Bug: b/151235334
Change-Id: I23a09eda9b50409c761bdd6ed10911ec159dc3ba
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42768
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoFix handling Memset<> assignment and comparison
Nicolas Capens [Mon, 23 Mar 2020 15:28:44 +0000 (11:28 -0400)]
Fix handling Memset<> assignment and comparison

Previously the compiler would implicitly declare a copy constructor and
assignment operator for classes derived from Memset<>, if they didn't
have user-defined ones. This can cause them to have uninitialized
padding bytes. By defining them ourselves using memcpy() we can ensure
they're zero-initialized.

Also define equality and less-than operators. The latter makes classes
derived from Memset<> suitable as std::map<> keys.

is_memcmparable<> now no longer works on classed derived from Memset<>,
because it uses std::is_trivially_copyable<> which isn't true when a
user-defined copy constructor or assignment operator is provided.
Instead just rely on Memset<>'s new equality operators.

Bug: b/131246679
Change-Id: I6e4963db8186955d8d3d3ef356fa42ef6a024c64
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42728
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoInitial drop of LLVM 10 to third_party/llvm-10.0
Ben Clayton [Wed, 25 Mar 2020 17:45:48 +0000 (17:45 +0000)]
Initial drop of LLVM 10 to third_party/llvm-10.0

Not referenced or built by any build system yet.

llvm-10-update: d32170dbd
Bug: b/152339534
Change-Id: Ifeb90a8c6fb096f4e9a457a3d141f509f5d50800

4 years agoAdd script for updating llvm 10
Ben Clayton [Wed, 25 Mar 2020 12:40:18 +0000 (12:40 +0000)]
Add script for updating llvm 10

Upstream llvm now lives in a mono-repo along with clang, libc, lldb and a whole bunch of other projects (~90k files at time of writing).
SwiftShader only requires the llvm project from this repo, and does not wish to pull in everything else.

This script performs the following:
 * The llvm10-clean branch is fetched and checked out.
 * A sparse checkout of the llvm project is made to a temporary directory.
 * The third_party/llvm-10.0/llvm is replaced with the latest LLVM version.
 * This is committed and pushed.
 * The original branch is checked out again, and a merge from llvm10-clean to
   the original branch is made.

Bug: b/152339534
Change-Id: I75a7bf9e3f4deb7cbf6ff3f7f9428f07b8422800
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42968
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoregres: add daily run against SwiftShader/Subzero
Antonio Maiorano [Mon, 23 Mar 2020 22:46:58 +0000 (18:46 -0400)]
regres: add daily run against SwiftShader/Subzero

The regres daily run will now first build and run SwiftShader/Subzero,
followed by SwiftShader/LLVM, both uploading to the same CL. This allows
us to see if there are any diffs between the two, and we can still merge
the latest LLVM version.

* Also added -dailyonly to run the daily only and quit.
* Also added -limit to limit the number of tests that are run for testing.

Bug: b/152216043
Change-Id: I5923695d39316a43f867ee0e82fb33f65a66607e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42808
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
4 years agoCMake: Don't export LLVM_INCLUDE_DIR to PARENT_SCOPE
Ben Clayton [Wed, 25 Mar 2020 15:43:54 +0000 (15:43 +0000)]
CMake: Don't export LLVM_INCLUDE_DIR to PARENT_SCOPE

The base change moved the LLVM rules out to a separate CMakeLists.txt file, while trying to keep the behaviour as close as possible to original. `LLVM_INCLUDE_DIR` is not needed to be exposed if we made it a public include directory on the llvm target, so do that.

Bug: b/145758253
Bug: b/152339534
Change-Id: I6e409da409d9a28847ac5bb4074899d70bb38145
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42971
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoCMake: Move LLVM rules out to third_party/llvm-7.0
Ben Clayton [Tue, 24 Mar 2020 22:51:17 +0000 (22:51 +0000)]
CMake: Move LLVM rules out to third_party/llvm-7.0

This is a copy-paste, with an additional `set()` with `PARENT_SCOPE` to expose `LLVM_INCLUDE_DIR` to the master `CMakeLists.txt`

Bug: b/145758253
Bug: b/152339534
Change-Id: I40c2316d4a08689b60d56fd5d485a5c8044a5693
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42950
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoAdd missing copyright header to CMakeLists.txt
Ben Clayton [Tue, 24 Mar 2020 22:38:59 +0000 (22:38 +0000)]
Add missing copyright header to CMakeLists.txt

Bug: none
Change-Id: I72e708c562f7b3eadb6d7f2360d1c99fd31bd872
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42949
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoInitial drop of LLVM 10 to third_party/llvm-10.0
Ben Clayton [Wed, 25 Mar 2020 12:41:13 +0000 (12:41 +0000)]
Initial drop of LLVM 10 to third_party/llvm-10.0

llvm-10-update: d32170dbd
Change-Id: I654944085579e1e7a738ae8611bbaea27ccf0ccc

4 years agoRegres: Add new run_testlist flags
Ben Clayton [Mon, 23 Mar 2020 13:23:11 +0000 (13:23 +0000)]
Regres: Add new run_testlist flags

`shuffle` will randomize the order in which the tests are run.
`limit` will run (post-shuffle) at most this number of tests.
 `no-results` will disable emission of the `results.json` file.

 These are useful for testing a random subset of the filtered test list.

Change-Id: Ied54b4fd57c9e02fa6a9e63b808417fdc8f73a43
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42710
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoMerge changes I9862d8e2,Ie1024655
Ben Clayton [Tue, 24 Mar 2020 08:17:05 +0000 (08:17 +0000)]
Merge changes I9862d8e2,Ie1024655

* changes:
  Update Marl to 16e1dc37c
  Squashed 'third_party/marl/' changes from ca8408f68..16e1dc37c

4 years agoRemove unused sampler parameter
Nicolas Capens [Thu, 19 Mar 2020 19:21:13 +0000 (15:21 -0400)]
Remove unused sampler parameter

The sampling routine no longer requires a sampler parameter, since all
data is treated as state instead.

Bug: b/151957215
Change-Id: I1917bf78ef18f6726ed6c87525f0bc42356d5c19
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42589
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoSpecialize sampling routine for immutable sampler data
Nicolas Capens [Tue, 17 Mar 2020 21:29:11 +0000 (17:29 -0400)]
Specialize sampling routine for immutable sampler data

Treat floating-point sampler values as state that is baked into the
sampling routine, instead of reading it from memory. This offers more
opportunities for optimizing the generated code.

Bug: b/151957215
Change-Id: If41455dece60307a54d97463e9ad26ed052f2588
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42588
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoUpdate Marl to 16e1dc37c
Ben Clayton [Tue, 24 Mar 2020 00:27:33 +0000 (00:27 +0000)]
Update Marl to 16e1dc37c

Contains more optimizations for coroutine usage, better teardown behavior
for single-threaded workers, and more cmake-idiomatic linking of pthreads.

x86 fixes were already cherry-picked.

Changes:
    16e1dc37c Add missing copyright header to marl-config.cmake.in
    09b759550 CMake: link with pthread in a CMake way (#108)
    47afda398 Kokoro+ubuntu: enable x86 and clang testing
    f421c8b4f Kokoro+ubuntu: Plubming for x86 & clang
    69797fcf0 Fixes for x86.
    3d6365b82 Scheduler: add wait() overloads that do not take a lock
    db1e8c767 Scheduler: block until all threads are unbound.

Commands:
    git subtree pull --prefix third_party/marl https://github.com/google/marl master --squash

Bug: b/140546382
Change-Id: I9862d8e2996db1e97e69d008125eeaf86da434c3

4 years agoSquashed 'third_party/marl/' changes from ca8408f68..16e1dc37c
Ben Clayton [Tue, 24 Mar 2020 00:27:33 +0000 (00:27 +0000)]
Squashed 'third_party/marl/' changes from ca8408f68..16e1dc37c

16e1dc37c Add missing copyright header to marl-config.cmake.in
09b759550 CMake: link with pthread in a CMake way (#108)
47afda398 Kokoro+ubuntu: enable x86 and clang testing
f421c8b4f Kokoro+ubuntu: Plubming for x86 & clang
69797fcf0 Fixes for x86.
3d6365b82 Scheduler: add wait() overloads that do not take a lock
db1e8c767 Scheduler: block until all threads are unbound.

git-subtree-dir: third_party/marl
git-subtree-split: 16e1dc37c5e12c35b93272f0353d0e6e9f200a26

4 years agoCMake: make SWIFTSHADER_DCHECK_ALWAYS_ON work on Windows
Antonio Maiorano [Mon, 23 Mar 2020 18:11:01 +0000 (14:11 -0400)]
CMake: make SWIFTSHADER_DCHECK_ALWAYS_ON work on Windows

Bug: b/145758253
Change-Id: Ie444337ea0efe91820d64400a857136f800cd3d6
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42788
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoRefactor vertex fetch to use VkFormat more aggressively
Chris Forbes [Mon, 23 Mar 2020 16:43:48 +0000 (09:43 -0700)]
Refactor vertex fetch to use VkFormat more aggressively

Bug: b/152218432
Change-Id: I71eb0cbda5ae98ab39d9953fe049368b8341193a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42748
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoMerge changes I2b7adc3c,I5873dfa8
Ben Clayton [Mon, 23 Mar 2020 13:49:23 +0000 (13:49 +0000)]
Merge changes I2b7adc3c,I5873dfa8

* changes:
  Update Marl to ca8408f68
  Squashed 'third_party/marl/' changes from 64d123947..ca8408f68

4 years agoSubzero: fix CoroutineBegin generation
Antonio Maiorano [Fri, 20 Mar 2020 04:13:28 +0000 (00:13 -0400)]
Subzero: fix CoroutineBegin generation

Rework how instructions are injected at the top of the CoroutineBegin
function by getting rid of replaceEntryNode, which attempted to replace
the entry node with a non-entry one. This seemed to work on all targets,
except for Windows x86-32 (Win32) when passing enough arguments to
Coroutines. In this case, it would crash in the code generated right
after this injected code. It looks like the code in replaceEntryNode is
not quite right, resulting in Subzero creating needless stack allocs per
argument, and ultimately generating invalid offsets from the stack
pointer.

Instead of fixing replaceEntryNode, I now simply remember the entryNode
for CoroutineBegin to use, adding the rest to a separate node for
basicBlock, and when finalizing the function, I connect entryNode to the
initial basicBlock node via a branch. This way, there is not messing
around with function's node list.

This not only fixes the crash, but gets rid of the needless stack
allocs per arg.

Bug: angleproject:4482
Change-Id: I13f9c8c43ee07f35302208d9876e6fbdf0b1ad26
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42608
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoFix float to r11g11b10 conversion
Alexis Hetu [Thu, 19 Mar 2020 13:25:29 +0000 (09:25 -0400)]
Fix float to r11g11b10 conversion

Floating point negative values were first converted to half values,
followed with a conversion to 11 bit or 10 bit mini floats by
chopping the mantissa and removing the sign bit. Negative values
were converted to the same values as positive values since removing
the sign bit ended up doing the equivalent of an Abs() call.

Clamped the value to 0 before the conversion to solve the issue.

Bug: b/146223877 b/147900455
Change-Id: I97decae66dc57a68f175b06902eb6725fc7d5794
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42548
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agomarl: manually apply partial patch to fix x86 crashes
Antonio Maiorano [Thu, 19 Mar 2020 14:07:27 +0000 (10:07 -0400)]
marl: manually apply partial patch to fix x86 crashes

Original patch: https://github.com/google/marl/commit/69797fcf044d7c4b077a38c587e5dd168b530d0b

Bug: angleproject:4482
Change-Id: I1aea95267e63bd776479c74bc2160ecf83f9e816
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42549
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoSubzero: fix external function calls on x86-32
Antonio Maiorano [Tue, 17 Mar 2020 19:46:22 +0000 (15:46 -0400)]
Subzero: fix external function calls on x86-32

On x86-32, the CALL instruction takes an IP-relative target address.
These are emitted as relocatable addresses, which we fix up in
rr::loadImage in SubzeroReactor.cpp. The problem is that we were calling
loadImage multiple times when compiling Coroutine functions - three
times, in fact, since there are three Coroutine functions (create,
await, destroy). As such, we would fixup the same relocatable addresses
multiple times, but the fixup uses the existing value, so it would
become invalid after the second fixup. To fix this, we now only call
loadImage once, collecting all entry points at once.

Also opportunistically fixed a missing argument to coro::isDone, and
added a static_assert to sz::Call to avoid this happening again.

Bug: angleproject:4482
Change-Id: If847d02649152abc1a9d8476023dd240465fa736
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42448
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSubzero: fix partially initialized ManagedStatic assert
Antonio Maiorano [Tue, 17 Mar 2020 21:26:53 +0000 (17:26 -0400)]
Subzero: fix partially initialized ManagedStatic assert

This is the same fix that I applied to LLVM7 here:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/37608
but this time to subzero-llvm.

Fixes ANGLE dEQP tests run against SwiftShader/Subzero.

Bug: chromium:151653536
Change-Id: Ia4725b74d068a3afd99d407c53b11f757bc5e11f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42469
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years ago[vulkan]: Support multiple external semaphore implementations.
David 'Digit' Turner [Wed, 4 Dec 2019 11:08:39 +0000 (12:08 +0100)]
[vulkan]: Support multiple external semaphore implementations.

This CL refactors the implementation of VkSemaphore objects
in the following way:

- Add the ability to support several external handle types
  concurrently. Before this CL, each platform could support
  a single handle type (e.g. on Linux,
  VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT only).

  The changes here will allow future CLs to support more than
  one type per platform (e.g. the Linux implementation may
  support OPAQUE_FD_BIT as well as SYNC_FD_BIT at the same
  time).

- Better implementation of temporary imports. In particular,
  the following sequence now works properly:

    1) Create exportable semaphore A.
    2) Export A to an external handle/descriptor.
    3) Signal A.
    4) Temporarily import _another_ handle into A.
    5) A.wait()   // waits on the temporary payload, then discard it.

  Before the CL, A would end up, incorrectly, unsignalled. Because
  the export operation created an External instance that held
  the payload modified in 3), which was then discarded after
  the wait() in 5).

- Improved and consistent handling of errors during import/export
  operations, through the use of templates.

+ Add a technical note in VkSemaphore.h explaining how everything
  works, since there are several subtle points in the spec.

Bug: b/140421736

Change-Id: I9b6935db3238fec7af8e0c81666e2f5c72075756
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39880
Tested-by: David Turner <digit@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Kokoro-Presubmit: David Turner <digit@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
4 years agoUpdate Marl to ca8408f68
Ben Clayton [Mon, 16 Mar 2020 20:30:01 +0000 (20:30 +0000)]
Update Marl to ca8408f68

Contains a number of optimizations that improve the Subzero coroutine performance up to 10x.

Changes:
    ca8408f68 Scheduler: Reduce the number of mutex locks / unlock.
    575b61e76 Fix compilation of marl::Ticket::onCall()
    e9f312688 waitForWork(): Early out if there work.num > 0
    3196a0539 Scheduler: Use std::deque instead of std::queue
    08a820171 Add flags to marl::Task
    cb3c481d0 Scheduler: Use a separate flag to indicate whether to call notify()
    598c993ec marl::ConditionVariable - use containers::list
    d0c501a9c Add marl::containers::list
    aa1de9091 Benchmarks: Add EventBaton

Commands:
    git subtree pull --prefix third_party/marl https://github.com/google/marl master --squash

Bug: b/140546382
Change-Id: I2b7adc3c624a1f3aef686de7e0e88c52a5666e3a

4 years agoSquashed 'third_party/marl/' changes from 64d123947..ca8408f68
Ben Clayton [Mon, 16 Mar 2020 20:30:01 +0000 (20:30 +0000)]
Squashed 'third_party/marl/' changes from 64d123947..ca8408f68

ca8408f68 Scheduler: Reduce the number of mutex locks / unlock.
575b61e76 Fix compilation of marl::Ticket::onCall()
e9f312688 waitForWork(): Early out if there work.num > 0
3196a0539 Scheduler: Use std::deque instead of std::queue
08a820171 Add flags to marl::Task
cb3c481d0 Scheduler: Use a separate flag to indicate whether to call notify()
598c993ec marl::ConditionVariable - use containers::list
d0c501a9c Add marl::containers::list
aa1de9091 Benchmarks: Add EventBaton

git-subtree-dir: third_party/marl
git-subtree-split: ca8408f6890ff447eb5f90d663149f3327b1607e

4 years agoRegres: Update test lists @ 3a50a43d
SwiftShader Regression Bot [Mon, 16 Mar 2020 09:59:21 +0000 (05:59 -0400)]
Regres: Update test lists @ 3a50a43d

Change-Id: I2833d77b233998725288f4df3ddee5138805981d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42349
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSpirvShaderDebugger: Implement scope nesting
Ben Clayton [Fri, 13 Mar 2020 18:13:42 +0000 (18:13 +0000)]
SpirvShaderDebugger: Implement scope nesting

Previously nested scopes would hide their parent variables.
This is no longer the case.

Bug: b/148401179
Change-Id: Icf2771a525524b8796ab12e295e141388bb5b399
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42368
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoCompile Vulkan library with Subzero in Chromium
Alexis Hetu [Tue, 10 Mar 2020 20:44:26 +0000 (16:44 -0400)]
Compile Vulkan library with Subzero in Chromium

This allows Chromium to use the SwiftShader Vulkan library
with the Subzero backend when available.

Bug: chromium:1060139
Change-Id: I444b3e6844c52781ada9f51c8ddb4e4d2ea6a6d4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42108
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSpirvShader: Silence warnings of unexpected opcodes
Ben Clayton [Fri, 13 Mar 2020 13:07:12 +0000 (13:07 +0000)]
SpirvShader: Silence warnings of unexpected opcodes

... between the `OpFunction` and `OpLabel`.

It is legal to have `OpLine`s between here, which we were incorrectly warning about.
The `OpenCL.Debug.Info` opcodes can also sit here, which are numerous. Just silence the warning, we're only scanning forward for the `OpLabel` here.

Bug: b/148401179
Change-Id: Ia9b8b024a1a15bbf431abec8f8ec47e2b735ed1b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42328
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoSubzero: hide dependency on Marl
Antonio Maiorano [Fri, 28 Feb 2020 18:39:11 +0000 (13:39 -0500)]
Subzero: hide dependency on Marl

Subzero maintains an internal scheduler that it uses only if there's no
external scheduler already bound on the current thread. This removes the
dependency on Marl in ReactorUnitTests, as we can rely on the internal
one being used.

Bug: b/145754674
Change-Id: Iddbaa299ccd904a87b8aa86e82e5517c9d72ef59
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41789
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
4 years agoBUILD.gn: add missing dependency onto marl for SubzeroReactor
Antonio Maiorano [Fri, 13 Mar 2020 16:12:17 +0000 (12:12 -0400)]
BUILD.gn: add missing dependency onto marl for SubzeroReactor

To fix broken Chromium build:
https://chromium-review.googlesource.com/c/chromium/src/+/2102747

Bug: fix Chromium build
Change-Id: I00e3bbe3087d6c885164d6b91e55ac50a89b5dad
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42348
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoConsistently use TRUE/FALSE in CMakeLists.txt
Nicolas Capens [Thu, 12 Mar 2020 21:12:52 +0000 (21:12 +0000)]
Consistently use TRUE/FALSE in CMakeLists.txt

Instead of ON/OFF and 1/0. TRUE/FALSE are the original Boolean classes:
https://cmake.org/pipermail/cmake/2007-December/018548.html

Bug: b/145758253
Change-Id: Ida6a0d81da37914a01d7da9ecf2bb2d2f840e369
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42148
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoExclude all static libraries from "all" build target
Nicolas Capens [Fri, 13 Mar 2020 14:54:21 +0000 (14:54 +0000)]
Exclude all static libraries from "all" build target

This ensures these intermediate targets only get built when needed,
and allows reducing the complexity of conditional logic.

Bug: b/151250656
Change-Id: I3cbc2cc7a4c3d6f3691eeeef55d381ef03c2db9f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42308
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoSubzero: replace Win32 fibers with Marl for couroutines
Antonio Maiorano [Fri, 28 Feb 2020 18:13:45 +0000 (13:13 -0500)]
Subzero: replace Win32 fibers with Marl for couroutines

* This change was authored by bclayton@, with some modifications.
* Replaces Win32 fiber implementation with marl tasks, making coroutines
  work on all marl-supported platforms.

Bug: b/145754674
Change-Id: Ic3de82afc69549e1d56688c6faf8077a6f446ee0
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41788
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoSpirvShaderDebugger: Add flag for printing opcodes as they're executed
Ben Clayton [Thu, 12 Mar 2020 14:19:27 +0000 (14:19 +0000)]
SpirvShaderDebugger: Add flag for printing opcodes as they're executed

The `PRINT_EACH_EXECUTED_INSTRUCTION` preprocessor flag complements the existing `PRINT_EACH_PROCESSED_INSTRUCTION` flag to print each instruction before they are executed.
This is exceptionally helpful when debugging the debugger.

Bug: b/148401179
Change-Id: If35728f115d664c1dba63e625eefccac9d3140ce
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42249
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSpirvShaderDebugger: Make Function extend Scope
Ben Clayton [Thu, 12 Mar 2020 14:17:54 +0000 (14:17 +0000)]
SpirvShaderDebugger: Make Function extend Scope

Reading between the lines of the spec, Functions are also scopes.

Move common scope fields into the base Scope class.

Fix `scope` fields requiring a `LexicalBlock` to take the more general `Scope`.

Bug: b/148401179
Change-Id: Iac7b4fd4440a701905e2dbcdf71b91146ea8ff7d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42248
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoSpirvShaderDebugger: Add string helper for debug kinds
Ben Clayton [Thu, 12 Mar 2020 12:46:00 +0000 (12:46 +0000)]
SpirvShaderDebugger: Add string helper for debug kinds

Makes for easier reading of the assertion macros.

Bug: b/148401179
Change-Id: Icc48baa9c476967c6dea19c2f0e91ed253dce323
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42194
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSpirvShader: Implement OpenCLDebugInfo100DebugInfoNone
Ben Clayton [Thu, 12 Mar 2020 12:45:02 +0000 (12:45 +0000)]
SpirvShader: Implement OpenCLDebugInfo100DebugInfoNone

Acts as a placeholder for no-debug-info. Implemented as nullptr.

Bug: b/148401179
Change-Id: I6cbfb227296d98befa6a7d2baa29128cb0c7bd29
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42193
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSpirvShaderDebugger: Stub UNIMPLEMENTED() opcodes
Ben Clayton [Thu, 12 Mar 2020 11:56:44 +0000 (11:56 +0000)]
SpirvShaderDebugger: Stub UNIMPLEMENTED() opcodes

Bug: b/148401179
Change-Id: I3a5cacc24bcb31a0b7e7cc3319ba500de59baa8a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42192
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSpirvShader: Implement OpenCLDebugInfo100DebugInlinedAt
Ben Clayton [Wed, 11 Mar 2020 13:43:20 +0000 (13:43 +0000)]
SpirvShader: Implement OpenCLDebugInfo100DebugInlinedAt

The inlined-at isn't currently used, but this unblocks tests that emit this instruction.

Bug: b/145351270
Change-Id: I787e0de3d7ede8225ad3a86544f867559ea9c387
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42095
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoAllow 3D filtering in the Blitter
Alexis Hetu [Wed, 11 Mar 2020 21:06:53 +0000 (17:06 -0400)]
Allow 3D filtering in the Blitter

According tot he Vulkan spec, about vkCmdBlitImage:
"As the sizes of the source and destination extents can
 differ in any dimension, texels in the source extent
 are scaled and filtered to the destination extent."

Logic was added to allow filtering in 3 dimensions in
the Blitter. Since it requires more instructions, a
state member was added in order to only filter in Z
whenever we actually to do so (when the number of
slices differ between source and destination regions).

Fixes all tests mentioned in the issue.

Bug: b/150155499
Change-Id: I63da92db94d8d0394a06271cd47d4930cf5f726a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42208
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
4 years agoFix building with latest LLVM
Nicolas Capens [Thu, 12 Mar 2020 17:19:33 +0000 (13:19 -0400)]
Fix building with latest LLVM

Bug: b/151314247
Change-Id: Ib10831c42a0c18f86397ed3b6c5d32a578653c89
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42288
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoDocument single-level YCbCr image assumption
Nicolas Capens [Thu, 12 Mar 2020 04:20:00 +0000 (00:20 -0400)]
Document single-level YCbCr image assumption

We currently rely on limiting the mipmap level count of YCbCr images
and the presence of sampler YCbCr conversion to disable mipmapping.

This is valid, but fragile. The Vulkan 1.2 spec guarantees that when
sampler Y'CbCr conversion is used, the image view must have a Y'CbCr
format:

"If the descriptor refers to a sampler that performs Y'CbCr conversion,
 the sampler must only be used to sample the image in the same
 descriptor."

"If the image view is to be used with a sampler which supports sampler
 Y'CbCr conversion, an identically defined object of type
 VkSamplerYcbcrConversion to that used to create the sampler must be
 passed to vkCreateImageView in a VkSamplerYcbcrConversionInfo included
 in the pNext chain of VkImageViewCreateInfo. Conversely, if a
 VkSamplerYcbcrConversion object is passed to vkCreateImageView, an
 identically defined VkSamplerYcbcrConversion object must be used when
 sampling the image."

"maxMipLevels is the maximum number of mipmap levels. maxMipLevels must
 be equal to the number of levels in the complete mipmap chain based on
 the maxExtent.width, maxExtent.height, and maxExtent.depth, except when
 one of the following conditions is true, in which case it may instead
 be 1:
  * ...
  * image format is one of those listed in Formats requiring sampler
    Y′CBCR conversion for VK_IMAGE_ASPECT_COLOR_BIT image views"

Bug: b/151263485
Change-Id: Ibb8e3fe34ecda04d6fb41308437fa4c66815f1fb
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42228
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoClarify the PointCoord calculation
Nicolas Capens [Mon, 9 Mar 2020 20:59:37 +0000 (16:59 -0400)]
Clarify the PointCoord calculation

Bug: b/149537975
Change-Id: Ia589e0015437e5257991fe2e8b5f6459384a76de
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42048
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoRemove unnecessary point setup calculations
Nicolas Capens [Mon, 9 Mar 2020 20:50:15 +0000 (16:50 -0400)]
Remove unnecessary point setup calculations

SetupRoutine uses V0 == V1 == V2 when drawing points, so we don't have
to duplicate those vertices explicitly.

Bug: b/149537975
Change-Id: I723a7139f5eb5735bedb0c17796c00dc4b414fa7
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42028
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoDon't needlessly build LLVM
Nicolas Capens [Thu, 12 Mar 2020 04:35:14 +0000 (00:35 -0400)]
Don't needlessly build LLVM

If the Reactor backend is Subzero, there's no need to build LLVM. This
is accomplished by excluding the LLVM target from the "all" target.

Bug: b/151250656
Change-Id: I26dc44921cc44d379c619700c6dd03f6fe94ee27
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42229
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoUpdate Marl to 64d123947
Ben Clayton [Thu, 12 Mar 2020 13:58:33 +0000 (13:58 +0000)]
Update Marl to 64d123947

A single change to fix windows breakage due to 'alloc' requiring an underscore prefix on some toolchains.

Changes:
    64d123947 thread.cpp: Replace use of alloca with vector.

Commands:
    git subtree pull --prefix third_party/marl https://github.com/google/marl master --squash

Bug: b/140546382
Bug: angleproject:4474
Change-Id: If15baa2531a5b49537bb0ba9f190454f2044ad9b

4 years agoSquashed 'third_party/marl/' changes from 94a361cf0..64d123947
Ben Clayton [Thu, 12 Mar 2020 13:58:33 +0000 (13:58 +0000)]
Squashed 'third_party/marl/' changes from 94a361cf0..64d123947

64d123947 thread.cpp: Replace use of alloca with vector.

git-subtree-dir: third_party/marl
git-subtree-split: 64d123947e4dbc741217ea7b49f3d2b6275be117

4 years agoVkImage: Implement BC7 texture format
Ben Clayton [Wed, 11 Mar 2020 10:41:32 +0000 (10:41 +0000)]
VkImage: Implement BC7 texture format

Also contains the following changes:
* Replace the use of `unsigned char` with `uint8_t`. `char` is not guaranteed to be 8-bit.
* Remove the `dstW` and `dstH` parameters from `BC_Decoder::Decode` and `ETC_Decoder::Decode`. They're always the same as the `w` and `h` parameters.
* Add BC6 types to various switch cases. The actual decode logic is not implemented for these formats.

Tests: *bc7*
Bug: b/151203718
Change-Id: I7b232b9dc3a9b02d172f87a62c88ce56b2cca956
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41508
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoUpdate Marl to 94a361cf0
Ben Clayton [Wed, 11 Mar 2020 22:27:09 +0000 (22:27 +0000)]
Update Marl to 94a361cf0

Contains a fix for an arm linker error (chromium:1058107) and
scaling beyond 64 threads on Windows.

Changes:
    94a361cf0 thread.cpp Fix minor bug in getProcessorGroups()
    0249a2624 Thread: Use WaitForObject for Thread::join()
    62f209bbb arm: Annotate marl_fiber_swap as type %function
    00f091e08 Update README.md
    773d9f475 Add new example 'tasks_in_tasks'
    3f69e73ce Scheduler: Replace use of std::thread with marl::Thread

Commands:
    git subtree pull --prefix third_party/marl https://github.com/google/marl master --squash

Bug: b/140546382
Bug: chromium:1058107
Change-Id: Ic5a96ad5f054a19f6a5a77e1f106c73ba60c0a78

4 years agoSquashed 'third_party/marl/' changes from a047dd0bb..94a361cf0
Ben Clayton [Wed, 11 Mar 2020 22:27:09 +0000 (22:27 +0000)]
Squashed 'third_party/marl/' changes from a047dd0bb..94a361cf0

94a361cf0 thread.cpp Fix minor bug in getProcessorGroups()
0249a2624 Thread: Use WaitForObject for Thread::join()
62f209bbb arm: Annotate marl_fiber_swap as type %function
00f091e08 Update README.md
773d9f475 Add new example 'tasks_in_tasks'
3f69e73ce Scheduler: Replace use of std::thread with marl::Thread

git-subtree-dir: third_party/marl
git-subtree-split: 94a361cf0b5187a5845f3a37c9e67c8406ccb40b

4 years agoSupport running PowerVR samples using SwiftShader on Linux
Nicolas Capens [Fri, 6 Mar 2020 18:21:10 +0000 (13:21 -0500)]
Support running PowerVR samples using SwiftShader on Linux

By setting the RPATH to $ORIGIN, Linux executables can behave like on
Windows and search for shared libraries in the exectuables directory
before looking elsewhere. We copy SwiftShader's Vulkan library into this
directory, naming it vulkan.so.1 to match the loader name the
executables look for.

This also relies on SwiftShader exporting all Vulkan API entry functions
like the loader library does: b/148240133

Bug: b/141361933
Change-Id: I617303cc11faead7aac9e689142a4400731a58a5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41970
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoRegres: Roll dEQP to 1.2.1
Ben Clayton [Tue, 18 Feb 2020 18:40:16 +0000 (18:40 +0000)]
Regres: Roll dEQP to 1.2.1

Test: none
Change-Id: I10ca476ed7dade95b516fabc1279fe751285114f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42128
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
4 years agoRegres: support testlist creation from specified hash
Nicolas Capens [Tue, 10 Mar 2020 21:23:42 +0000 (17:23 -0400)]
Regres: support testlist creation from specified hash

Using --dailynow --dailychange <hash> makes Regres check out the specified
change to obtain the vk-master.txt from and perform a full run of all the
tests.

Also fix --keep usage.

Bug: none
Change-Id: Ia126bfc136e6b86a6fcc570f79a9293ae97ca392
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42109
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
4 years agoSuppress warnings in Subzero dependencies
Nicolas Capens [Fri, 6 Mar 2020 16:08:13 +0000 (11:08 -0500)]
Suppress warnings in Subzero dependencies

https://swiftshader-review.googlesource.com/c/SwiftShader/+/40788 and
https://swiftshader-review.googlesource.com/c/SwiftShader/+/41968 cause
us to use different compile flags for Subzero's LLVM dependencies than
the rest of SwiftShader. Suppress the warnings that this has unleashed.

Bug: b/132445520
Change-Id: I1f20e32b487035e953c02cd4829460c072e38ac3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41969
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoRegres: Simplify running of local tests
Ben Clayton [Tue, 10 Mar 2020 18:42:49 +0000 (18:42 +0000)]
Regres: Simplify running of local tests

Add `filter` flag to run_testlist so that tests can be filtered by wildcard or regex.
Update `run_testlist.sh` and `run_testlist.bat` to automatically use the vk-master.txt test list.

Change-Id: I94ef1d2e9220f18bdf50555db8c291b3736ec3f3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42089
Reviewed-by: Paul Thomson <paulthomson@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoKokoro: Update clang-8 URL
Ben Clayton [Wed, 11 Mar 2020 11:51:22 +0000 (11:51 +0000)]
Kokoro: Update clang-8 URL

The http URL now results in a redirect to an https URL.
Update the URL to the new redirect URL.
Also add the `-L` flag to curl so that future redirects don't break our presubmits.

Also verify with the provided PGP signatures instead of using a more vulnerable sha1.

Bug: none. Fixing presubmits.
Change-Id: I715c45f7083bf0f5528d82ba93d008464d0d7f88
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42093
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
4 years agoSubzero: fix Call on bool-returning functions
Antonio Maiorano [Tue, 10 Mar 2020 14:53:24 +0000 (10:53 -0400)]
Subzero: fix Call on bool-returning functions

On some ABIs, C++ functions that return bool only set the least
significant bits of the return register (e.g. AL on x64). The Call
implementation in SubzeroReactor would use uninitialized i32 target
to hold the result of a bool-returning function, but this would return
erroneous results when the called function would return false by setting
the LSB to 0, but with a non-zero MSB, thus returning true.
This change makes sure to truncate the i32 result to i8 (bool),
returning true only if the lsb is non-zero.

Bug: b/151158858
Change-Id: I41055a94d7f8045da503f27881ed887c1926f77b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42068
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoRegres: Update test lists @ b44162fd
SwiftShader Regression Bot [Mon, 9 Mar 2020 10:05:47 +0000 (06:05 -0400)]
Regres: Update test lists @ b44162fd

Change-Id: I57d7aaaaf85f009721b791ad15f20ea7971a9092
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41988
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSupport for the largePoints feature in Vulkan
Marc-Antoine Desroches [Thu, 5 Mar 2020 18:35:43 +0000 (13:35 -0500)]
Support for the largePoints feature in Vulkan

Bug: b/149537975

Tests: dEQP-VK.*point*

Change-Id: I22ee0c0ebc4e7b414e055e2b87010004dfc8741a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41948
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Marc-Antoine Desroches <madesroches@google.com>
4 years agoExplicitly compile with warnings-as-errors
Nicolas Capens [Fri, 6 Mar 2020 06:12:01 +0000 (01:12 -0500)]
Explicitly compile with warnings-as-errors

This is a partial revert of https://swiftshader-review.googlesource.com/c/SwiftShader/+/40788
where .c files were renamed to .cpp to avoid a warning treated as error:
command line option ‘-fno-operator-names’ is valid for C++/ObjC++ but not for C [-Werror]
This appears to have caused macOS linker issues: chromium:1059196

Instead, explicitly add the flag to compile with warnings-as-errors
(when enabled) for code that is actively maintained by us, and make
Subzero's legacy LLVM dependencies a separate library compiled without
warnings-as-errors.

Also revert CMakeSettings.json changes that were inadvertently committed.

Bug: b/141361933
Bug: chromium:1059196
Change-Id: I27dd57d954a413a710613b0bfa2e69bd5242853a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41968
Reviewed-by: Marc-Antoine Desroches <madesroches@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSupport launching PowerVR samples from Visual Studio using SwiftShader
Nicolas Capens [Thu, 30 Jan 2020 21:41:00 +0000 (16:41 -0500)]
Support launching PowerVR samples from Visual Studio using SwiftShader

On Windows placing the vulkan-1.dll next to the executables suffices for
them to load SwiftShader instead of the system's Vulkan ICD loader (if
present).

Also make warnings-as-errors only affect our own projects, and put
things into project folders.

Bug: b/141361933
Change-Id: Ibdf8bcb992aa484d4bebaaf52ae77a8ced61709a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40788
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoSubzero: implement Short4::Short4(RValue<Float4)
Antonio Maiorano [Wed, 4 Mar 2020 20:06:19 +0000 (15:06 -0500)]
Subzero: implement Short4::Short4(RValue<Float4)

Implement non-optimized version. Should generalize and optimize code in
UShort4::UShort4(RValue<Float4> cast, bool saturate) so we can use it
here.

Bug: b/145754674
Change-Id: I16a24dab2979bb97d2d5f36a406aeb62aeb976e8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41928
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSubzero: don't assert about lack of atomic load/store on x86
Antonio Maiorano [Fri, 28 Feb 2020 20:48:22 +0000 (15:48 -0500)]
Subzero: don't assert about lack of atomic load/store on x86

On x86-32/64, assume that loads and stores are atomic, and that
strictest memory order is supported.

Bug: b/150475088
Change-Id: I5f99a0309eca668d0c1197387bcf687b32381179
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41790
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoFix Regres regression post CMake var renaming
Antonio Maiorano [Wed, 4 Mar 2020 15:03:31 +0000 (10:03 -0500)]
Fix Regres regression post CMake var renaming

CMake variables were renamed in
https://swiftshader-review.googlesource.com/c/SwiftShader/+/39909

This means regres has been running without DCHECK_ALWAYS_ON enabled,
possibly resulting in false positives when SwiftShader would assert.

Bug: n/a
Change-Id: Ifc4963a6c562bd21db9e1775e06dc5d4ff20f290
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41908
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoSubzero: fix regression in Optimizer
Antonio Maiorano [Wed, 4 Mar 2020 00:53:13 +0000 (19:53 -0500)]
Subzero: fix regression in Optimizer

Regression was introduced in
https://swiftshader-review.googlesource.com/c/SwiftShader/+/41269

When detecting and removing intermediate stores, if the storeValue is a
constant, we skip it; however, we must make sure to set unmatchedLoads
to true, or the optimizer will incorrectly eliminate the skipped store
on a later iteration.

This bug lead to incorrect generated code, which failed certain deqp-vk
tests, e.g. dEQP-VK.clipping.user_defined.clip_cull_distance.vert.2_6

Bug: b/148272103
Change-Id: I024d75decdc4f1d13e7f82cade50f8be09d68f3e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41888
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoUse LINK_FLAGS for -BSymbolic in CMake build
James Price [Tue, 3 Mar 2020 15:20:00 +0000 (10:20 -0500)]
Use LINK_FLAGS for -BSymbolic in CMake build

This fixes the Vulkan Loader for CMake builds.

Bug: b/150626933
Change-Id: I600597c95c4a41f3242028fd9ccd65fced4ead33
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41848
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: James Price <jrprice@google.com>
4 years agoFix ASTC support for GN build
Nicolas Capens [Tue, 3 Mar 2020 15:35:53 +0000 (10:35 -0500)]
Fix ASTC support for GN build

Defines in BUILD.gn files don't apply transitively to dependencies, so
we have to repeat the SWIFTSHADER_ENABLE_ASTC for the Device
subdirectory.

Note we could also use 'public_configs = [:swiftshader_libvulkan_private_config]'
but this adds more defines and build flags than what we need. Since this
is intended as a temporary workaround anyway, we're keeping it simple.

Bug: b/150600814
Change-Id: Ib06f4a22559ee58114da5841e66e59bfce9aec4a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41868
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoRegres: Update test lists @ 416d3745
SwiftShader Regression Bot [Mon, 2 Mar 2020 10:54:39 +0000 (05:54 -0500)]
Regres: Update test lists @ 416d3745

Change-Id: I05b0a9fbad99116a7163a6cb4ad43e7eccb060f3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41808
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoEnable ASTC on supported builds only
Nicolas Capens [Sun, 1 Mar 2020 13:29:25 +0000 (08:29 -0500)]
Enable ASTC on supported builds only

To temporarily work around build issues related to Google3 integration,
make ASTC support optional and only enable it for CMake, Chromium, and
Android builds.

Bug: b/150600814
Change-Id: Iac6a404322c65a6f2727807ea8af2edfb219a5a2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41828
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoPipelineCache: Handle nullptr mismatch of specialization info.
Jamie Madill [Thu, 27 Feb 2020 16:34:09 +0000 (11:34 -0500)]
PipelineCache: Handle nullptr mismatch of specialization info.

It's valid in Vulkan for a shader to have specialization constants
and the pipeline to be lacking specialization constant data. This
could lead to a key match between the two even though there should
be a different shader payload. From the spec:

> It is legal for a SPIR-V module with specializations to be
> compiled into a pipeline where no specialization info was provided.
> SPIR-V specialization constants contain default values such that
> if a specialization is not provided.

Fix this by adding in the required checks. Should not affect perf.

Bug: b/150449637
Bug: angleproject:4426
Change-Id: I5f384420bdc1f03a36852db0b20393ae56452b62
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41728
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: Jamie Madill <jmadill@chromium.org>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoImplement ASTC support
Alexis Hetu [Mon, 24 Feb 2020 17:09:16 +0000 (12:09 -0500)]
Implement ASTC support

This cl adds both LDR and HDR support for ASTC compressed
textures. Only LDR formats are exposed in the
PhysicalDevice's properties, but HDR support can be added
trivially later by adding the HDR formats and exposing
"VK_EXT_texture_compression_astc_hdr".

Pulled from: https://github.com/ARM-software/astc-encoder
Git hash: 81a5e50741b4c8302cf7d78f314a53e44ee68e1f

The astc-encode git repo was added to third-party, with a
few minor modifications:
1) All encoding related code has been ripped out, only
   decoding related code remains
2) Replaced ASTC_CODEC_INTERNAL_ERROR() with UNREACHABLE()
   in a switch statement in astc_color_unquantize.cpp
3) Some functions were using a lot of stack memory, so I
   added a unique_ptr to allocate the same objects on the
   heap, to avoid potential issues.

LDR ASTC is decoded to 8bit unsigned RGBA.
HDR ASTC is decoded to 32b floating point.

Tests: dEQP-VK.*astc*
Bug: b/150130101
Change-Id: I6b03fed6e1f326a95c7aefe9f9a9d0a89cf24428
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41568
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoAdd missing attribute to eglGetConfigAttrib
Jonah Ryan-Davis [Thu, 27 Feb 2020 20:55:51 +0000 (15:55 -0500)]
Add missing attribute to eglGetConfigAttrib

EGL_ANGLE_iosurface_client_buffer added a new attribute to the config:
EGL_BIND_TO_TEXTURE_TARGET_ANGLE, which needed to be properly exposed
in the EGL frontend.

Bug: chromium:1015454
Change-Id: I58881df18d711ed7974a0a06e53fed42b1f28638
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41709
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
4 years agoAdd codereview.settings.
Jamie Madill [Thu, 27 Feb 2020 16:40:12 +0000 (11:40 -0500)]
Add codereview.settings.

Set squash uploads to false. This should make git cl upload work
properly from SwiftShader for those who prefer that over 'git push'
to a ref.

Bug: None
Change-Id: Ib80fdbd28c2a7a5808ab73ceec8ddb98f8962e0b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41708
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

4 years agoSubzero: add support for variadic calls (System V)
Antonio Maiorano [Wed, 26 Feb 2020 19:23:09 +0000 (14:23 -0500)]
Subzero: add support for variadic calls (System V)

For the System V ABI, variadic calls must store the number of floating
point arguments into RAX. This was mostly working by accident for
our calls to printf since RAX is used as a scratch register, and was
often non-zero, which is all that's really needed for printf with float
args to work; however, when RAX would become 0, printf would print the
wrong thing.

Bug: b/149913889
Change-Id: Id4b519c5416927d537fca078109c0dc850f08359
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41668
Tested-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoFix comparison of specialization constant keys.
Jamie Madill [Wed, 26 Feb 2020 22:39:53 +0000 (17:39 -0500)]
Fix comparison of specialization constant keys.

The code in VkPipelineCache was correctly comparing all the attributes
of the specialization constants and then was also doing a faulty shared
pointer comparison. This was causing major drag on draw calls as every
draw call in ANGLE was recompiling the shader.

Bug: angleproject:4426
Change-Id: Ia0466738eb7de78c0c3b53e61e2f2bc6831bbcca
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41688
Kokoro-Presubmit: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoSubzero: add support for large stacks on Windows
Antonio Maiorano [Tue, 25 Feb 2020 15:36:02 +0000 (10:36 -0500)]
Subzero: add support for large stacks on Windows

If the stack size is > 4K, emit chkstk, which probes the stack to commit
the pages required to support the large stack.

Bug: swiftshader:25
Change-Id: I6b9f09218736ffb641cb1dbf95a1de7149633ef8
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41608
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoBuild with -Bsymbolic to prevent symbol preemption
Nicolas Capens [Wed, 26 Feb 2020 03:45:42 +0000 (22:45 -0500)]
Build with -Bsymbolic to prevent symbol preemption

The CMake build was already using -fvisibility=protected, which has the
same effect but uses duplicate symbol entries for internal/external use.

Bug: b/148240133
Change-Id: I8069a1b293a6ec0604be32179ed591ffaa645ed7
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41648
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
4 years agoFix ANGLE standalone build
Nicolas Capens [Tue, 25 Feb 2020 20:07:34 +0000 (15:07 -0500)]
Fix ANGLE standalone build

Referencing //third_party/SPIRV-Tools directly only works when building
inside a Chromium checkout.

Bug: angleproject:4425
Change-Id: I70ace58145a93b747a67d98b6efd4af7e3cfd370
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41628
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoFix Android build after SPIRV-Tools update
Nicolas Capens [Tue, 25 Feb 2020 16:39:49 +0000 (11:39 -0500)]
Fix Android build after SPIRV-Tools update

Bug: angleproject:4425
Change-Id: I2785b9f5c6f96b2b12eeacf64ff5316355f1ae54
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41609
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
4 years agoLog instead of warn of unsupported extensions
Sean Risser [Wed, 19 Feb 2020 17:52:24 +0000 (12:52 -0500)]
Log instead of warn of unsupported extensions

Currently we produce a warning every time an unsupported extension is
used. The original bug (b/139528538) called for logging these structs
silently unless a debugger's attached.

So I've replaced all of our warnings for unsupported structs with
calls to LOG_TRAP. This is an update to TRACE_ASSERT. LOG_TRAP will
never emit to the debug log, instead it will only print to a file if
writing to files is enabled for logv.

Bug: b/148415347
Change-Id: Ib4ad2b20b3dffce4fac597c891b2f5ee23e032c4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41348
Tested-by: Sean Risser <srisser@google.com>
Presubmit-Ready: Sean Risser <srisser@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoRegres: Update test lists @ e162b023
SwiftShader Regression Bot [Tue, 25 Feb 2020 10:55:20 +0000 (05:55 -0500)]
Regres: Update test lists @ e162b023

Change-Id: Id5607e9329a01bcc137cd2f9c25db798dab15a4a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41488
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoAdd SPIRV-Tools headers dependency
Nicolas Capens [Mon, 24 Feb 2020 22:59:32 +0000 (17:59 -0500)]
Add SPIRV-Tools headers dependency

And remove external SPIRV-Headers dependency. We use an internal copy.

Bug: angleproject:4425
Change-Id: I36c8c836197d6642d4c696520d61bdf7790fce6c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41589
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
4 years agoAdd SPIR-Tools include headers path for src/Pipeline
Nicolas Capens [Mon, 24 Feb 2020 22:18:07 +0000 (17:18 -0500)]
Add SPIR-Tools include headers path for src/Pipeline

Will be used by SpirvShaderEnumNames.cpp in https://swiftshader-review.googlesource.com/c/SwiftShader/+/41510

Bug: angleproject:4425
Change-Id: I631c593432c12a6ccf64edcb83b2e11ac87104c0
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41588
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
4 years agoUpdate SPIRV-Tools to 8910ea5f1
Ben Clayton [Mon, 24 Feb 2020 14:54:25 +0000 (14:54 +0000)]
Update SPIRV-Tools to 8910ea5f1

Also applies a fix for `spvOpcodeString` being moved to the public spirv-tools interface.

Changes:
    8910ea5f1 Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201)
    c316fb15f Add missing dependencies when generating spvtools_core_tables (#3199)
    03c9effb5 Brief guide to writing a spirv-fuzz fuzzer pass (#3190)
    dea1040fa Fix ignored const qualifier warning in static_cast (#3197)
    4a80497a8 Make spvOpcodeString part of the public API (#3174)
    03794b8f5 Fix static libraries linking order (#3189)
    79f8caf91 vscode: Add missing fields to schema.Opcode (#3169)
    4d912f4e6 spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
    77fefe765 spirvfuzz: Fix type-related bug, change undef to zero, and add assert (#3188)
    6c218ec60 spirv-fuzz: Fuzzer pass that adds access chains (#3182)
    77fb303e5 spirv-fuzz: Fuzzer pass to add function calls (#3178)
    3d4a0dd48 spirv-fuzz: Ensure that donated variables are always initialized (#3181)
    fe10239f9 spirv-fuzz: Add fuzzer passes to add loads/stores (#3176)
    1f03ac102 spirv-fuzz: Fuzzer passes to add local and global variables (#3175)
    9e52bc0d0 utils/vscode: LSP - Support OpExtInst (#3140)
    a3b5ad909 Fix typos in opt's help. Update environment version. (#3170)
    da5457f6b Start SPIRV-Tools v2020.2
    8dd174809 Finalize SPIRV-Tools v2020.1
    76616bab6 Update CHANGES
    bb56e892f spirv-fuzz: Fuzzer pass to add composite types (#3171)
    fdd0c8776 Update script that checks copyright years. (#3173)
    b7e0998e3 spirv-fuzz: Disallow copying of null and undefined pointers (#3172)
    a9624b4d5 Handle TimeAMD in AmdExtensionToKhrPass. (#3168)
    ddcc11763 Update CHANGES
    0265a9d4d Implement constant folding for many transcendentals (#3166)
    7a2d408de Fix typo in comment. (#3163)
    1fc7a9ec7 spirv-fuzz: Arbitrary variable facts (#3165)
    dd3f8d492 spirv-fuzz: Add outlining test (#3164)
    521223b70 spirv-fuzz: Make functions "livesafe" during donation (#3146)
    97f1d485b Dead branch elim fix (#3160)
    1b3441036 Fix chromium build (#3152)
    5d786f6cc Clarify mapping of target env to SPIR-V version (#3150)
    e7afeb060 Use dummy switch instead of dummy loop in MergeReturn pass. (#3151)
    6729c4a7c Fix structured exit validation (#3141)
    bb236c326 Add spvParseVulkanEnv (#3142)
    dd37d73c5 Handle conflict between debug info and existing validation rule (#3104)
    b97057e7f Use spirv-headers' BUILD.gn (#3148)
    6a1a1b326 Roll external/spirv-headers/ af64a9e82..dc77030ac (4 commits) (#3147)
    ab7ac60f1 spirv-fuzz: Refactoring and type-related fixes (#3144)
    323a81fc5 Validate Vulkan 1.2 capabilities
    d46a1b048 Add basic support for Vulkan 1.2: SPV_ENV_VULKAN_1_2
    f8d7df760 Fix OpLine bug of merge-blocks pass (#3130)
    8013d477a spirv-fuzz: add dead blocks (#3135)
    18b3b9456 Remove names and decorations of imported symbols (#3081)
    fb2e81981 Fix GN build for OpenCL.DebugInfo.100 update (#3134)
    c86dc0bcd Fix bad parameter names in error message (#3129)
    899735f45 Revert PR #3093 (#3131)
    a466b99db Disallow forward references in arrays (#3093)
    31acc7882 spirv-fuzz: Add fuzzer pass to perform module donation (#3117)
    c8bf14393 GetOperandConstants operand can be const (#3126)

Commands:
    git subtree pull --prefix third_party/SPIRV-Tools https://github.com/KhronosGroup/SPIRV-Tools master --squash

Bug: b/123642959
Bug: angleproject:4425
Change-Id: I73076a22b474893d900a017d94a5d122061381bc

4 years agoSquashed 'third_party/SPIRV-Tools/' changes from 8aa423930..8910ea5f1
Ben Clayton [Mon, 24 Feb 2020 14:53:40 +0000 (14:53 +0000)]
Squashed 'third_party/SPIRV-Tools/' changes from 8aa423930..8910ea5f1

8910ea5f1 Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201)
c316fb15f Add missing dependencies when generating spvtools_core_tables (#3199)
03c9effb5 Brief guide to writing a spirv-fuzz fuzzer pass (#3190)
dea1040fa Fix ignored const qualifier warning in static_cast (#3197)
4a80497a8 Make spvOpcodeString part of the public API (#3174)
03794b8f5 Fix static libraries linking order (#3189)
79f8caf91 vscode: Add missing fields to schema.Opcode (#3169)
4d912f4e6 spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
77fefe765 spirvfuzz: Fix type-related bug, change undef to zero, and add assert (#3188)
6c218ec60 spirv-fuzz: Fuzzer pass that adds access chains (#3182)
77fb303e5 spirv-fuzz: Fuzzer pass to add function calls (#3178)
3d4a0dd48 spirv-fuzz: Ensure that donated variables are always initialized (#3181)
fe10239f9 spirv-fuzz: Add fuzzer passes to add loads/stores (#3176)
1f03ac102 spirv-fuzz: Fuzzer passes to add local and global variables (#3175)
9e52bc0d0 utils/vscode: LSP - Support OpExtInst (#3140)
a3b5ad909 Fix typos in opt's help. Update environment version. (#3170)
da5457f6b Start SPIRV-Tools v2020.2
8dd174809 Finalize SPIRV-Tools v2020.1
76616bab6 Update CHANGES
bb56e892f spirv-fuzz: Fuzzer pass to add composite types (#3171)
fdd0c8776 Update script that checks copyright years. (#3173)
b7e0998e3 spirv-fuzz: Disallow copying of null and undefined pointers (#3172)
a9624b4d5 Handle TimeAMD in AmdExtensionToKhrPass. (#3168)
ddcc11763 Update CHANGES
0265a9d4d Implement constant folding for many transcendentals (#3166)
7a2d408de Fix typo in comment. (#3163)
1fc7a9ec7 spirv-fuzz: Arbitrary variable facts (#3165)
dd3f8d492 spirv-fuzz: Add outlining test (#3164)
521223b70 spirv-fuzz: Make functions "livesafe" during donation (#3146)
97f1d485b Dead branch elim fix (#3160)
1b3441036 Fix chromium build (#3152)
5d786f6cc Clarify mapping of target env to SPIR-V version (#3150)
e7afeb060 Use dummy switch instead of dummy loop in MergeReturn pass. (#3151)
6729c4a7c Fix structured exit validation (#3141)
bb236c326 Add spvParseVulkanEnv (#3142)
dd37d73c5 Handle conflict between debug info and existing validation rule (#3104)
b97057e7f Use spirv-headers' BUILD.gn (#3148)
6a1a1b326 Roll external/spirv-headers/ af64a9e82..dc77030ac (4 commits) (#3147)
ab7ac60f1 spirv-fuzz: Refactoring and type-related fixes (#3144)
323a81fc5 Validate Vulkan 1.2 capabilities
d46a1b048 Add basic support for Vulkan 1.2: SPV_ENV_VULKAN_1_2
f8d7df760 Fix OpLine bug of merge-blocks pass (#3130)
8013d477a spirv-fuzz: add dead blocks (#3135)
18b3b9456 Remove names and decorations of imported symbols (#3081)
fb2e81981 Fix GN build for OpenCL.DebugInfo.100 update (#3134)
c86dc0bcd Fix bad parameter names in error message (#3129)
899735f45 Revert PR #3093 (#3131)
a466b99db Disallow forward references in arrays (#3093)
31acc7882 spirv-fuzz: Add fuzzer pass to perform module donation (#3117)
c8bf14393 GetOperandConstants operand can be const (#3126)

git-subtree-dir: third_party/SPIRV-Tools
git-subtree-split: 8910ea5f1c7bc38f79a8b70b265cd9d1571f4b56

4 years agoFix Wrange-loop-analysis warnings in swiftshader.
Nico Weber [Sun, 23 Feb 2020 00:38:50 +0000 (19:38 -0500)]
Fix Wrange-loop-analysis warnings in swiftshader.

Bug: chromium:1039697
Change-Id: I5af47f44696a0eb1da7516ea57f3ae766651cae3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41548
Presubmit-Ready: Nico Weber <thakis@chromium.org>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
4 years agoReplace target_cpu with current_cpu in Build.gn files
Antonio Maiorano [Fri, 21 Feb 2020 20:37:37 +0000 (15:37 -0500)]
Replace target_cpu with current_cpu in Build.gn files

A recent change was made that failed when building nacl, because despite
the target_cpu being set to x86, current_cpu is x64 for nacl, as it is
cross-compiled to x64 using a different toolchain. As such, we were
building and linking the x86 version of Subzero with the x64 version of
nacl, resulting in a linker error.

See the following doc for more info:
https://chromium.googlesource.com/dart/dartium/src/+/refs/heads/master/tools/gn/docs/cross_compiles.md#as-a-build_gn-author

Bug: b/150008309
Change-Id: I581538cb7bb090e5b30819052eb7e245bc90ab12
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41528
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
4 years agoRevert "Subzero: add support for large stacks on Windows"
Alexis Hétu [Fri, 21 Feb 2020 13:42:10 +0000 (13:42 +0000)]
Revert "Subzero: add support for large stacks on Windows"

This reverts commit f50cc82b3bed049f50ce8e530e3be5db307baa64.

Reason for revert: Skia roll broken. See:
https://chromium-review.googlesource.com/c/chromium/src/+/2067664
"lld-link: error: undefined symbol: _chkstk"

Change-Id: I2ac508c9560e3a49e8a856906c3a5f6141c45207
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41489
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
4 years agoSubzero: add support for large stacks on Windows
Antonio Maiorano [Thu, 20 Feb 2020 04:56:40 +0000 (23:56 -0500)]
Subzero: add support for large stacks on Windows

If the stack size is > 4K, emit chkstk, which probes the stack to commit
the pages required to support the large stack.

Bug: swiftshader:25
Change-Id: Iac1850c528460f4244f6f14f851ef47ee5a737d0
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41388
Tested-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>