Import Tint changes from Dawn

Changes: - 8800d885e76533b27ef1bfd791863a0e21335717 tint: const eval of 'select' builtin by Antonio Maiorano <amaiorano@google.com>
  - 6b3f4aaf2662a6a9afaa37781de5fe77e082dce7 tint: add vector cases for const eval builtin tests by Antonio Maiorano <amaiorano@google.com>
  - fc7994ba4c3cf6eac3dc75cf80f6c88b20fbf0ee tint: fix intrinsic table lookup of mixed const and non-c... by Antonio Maiorano <amaiorano@google.com>
  - 7a69a3411f1147f90d7669da153b51e770083d7c Update type_decl grammar element name. by dan sinclair <dsinclair@chromium.org>
  - 1dbda6f254884aaec4d8c50160b70190d015b4ec Update variables in address space template. by dan sinclair <dsinclair@chromium.org>
  - e89c27c648436e3470a27d628aea9a1a2c2e7312 Remove some DISABLED tests. by dan sinclair <dsinclair@chromium.org>
  - 82023d6980e116eefd66217fcac12cee3e4d756b Enable disabled const eval tests. by dan sinclair <dsinclair@chromium.org>
  - 2a3eae73719d35189267a31bfd2083e87d365dec Revert "Replace std::stof with std::strtof." by Dan Sinclair <dsinclair@chromium.org>
  - 40b5d01b065d504a7c221b7b03801abc42d158f8 Remove unused Resolver::TypeDeclInfo. by dan sinclair <dsinclair@chromium.org>
  - bdeee03c0115e28ac706cdc7e5963c528b3b3bf3 Remove unused Resolver::BlockInfo by dan sinclair <dsinclair@chromium.org>
  - 6f39b6c416d3637da27d391cfd4c3bad865f4cb0 Remove empty disabled generator tests. by dan sinclair <dsinclair@chromium.org>
  - 26aa5820546a1d979c2c598619923b398ea298a8 Remove Inspector test for unsupported feature. by dan sinclair <dsinclair@chromium.org>
  - ca6fedc96a7521042fcf6d42daffa4fd25b6116e Rename `array size` to `array count` in error messages. by dan sinclair <dsinclair@chromium.org>
  - 68124ab7d1467f74afc2edd51614c95f351aeb30 Add missing robustness tests. by dan sinclair <dsinclair@chromium.org>
  - d4fa2a022e137eae64d5a89808cecc23d2830ace Enable DISABLED const evaluation tests. by dan sinclair <dsinclair@chromium.org>
  - e67c9f94d337b804373cc6c375b4f78990424a1d Remove disabled float inf and nan tests. by dan sinclair <dsinclair@chromium.org>
  - d94a10ba7e164630ea97ffb2d78a1bf37282d7d7 Re-enable spirv reader tests after spirv-tools roll. by dan sinclair <dsinclair@chromium.org>
  - 01b885bfde15d940d88782145b4d7c5f9e9144ce Fix comment in spirv-reader. by dan sinclair <dsinclair@chromium.org>
  - 66d3efb669c71cd8699ee3e603756b584ef47a05 Limit array element count to less then 65536 elements. by dan sinclair <dsinclair@chromium.org>
  - 5f9996dc9c4c057a6d54d4332d4e4baf2ea904a1 Replace std::stof with std::strtof. by John Stiles <johnstiles@google.com>
  - ff7cf2102153bf93af93d65ce20a9b406df64cda Rename StorageClass to AddressSpace. by dan sinclair <dsinclair@chromium.org>
  - 82177da76789ed3f5e58630cd79123367a0e465f spirv-reader: add ColMajor decoration as needed for end2end by David Neto <dneto@google.com>
  - feb14eb7613436bf5fe5ff46ae312523ebf23e85 tint: update spirv-tools and fix unittests by dawn-autoroll <dawn-autoroll@skia-public.iam.gserviceaccount.com>
  - 2bcade246a80151649d2fe87eb6f031e657cd5f1 Update MSL generator to handle casts of packed types. by dan sinclair <dsinclair@chromium.org>
  - 06844a5e24af9c880d76ae84595300995dc8fe6b tint/hlsl: remove [loop] attribute on all loops by Antonio Maiorano <amaiorano@google.com>
  - 2af7ab3b168e5239b65858251da93670357a8312 Add missing operator to regex fuzzer by Alastair Donaldson <afdx@google.com>
  - f9f583bfe4a3b738161b2f551edc500a85902745 Update align attribute to allow u32. by dan sinclair <dsinclair@chromium.org>
  - a33bc2c6f2a657e4f91f27534da640aa063c4892 Add some GLSL zero initialization tests. by dan sinclair <dsinclair@chromium.org>
  - 764a2abc90312cdb3f982591072c440017a9ada6 Have DeepestElementOf always return a type. by dan sinclair <dsinclair@chromium.org>
  - cb41b8f97f12341af2c5667b3c059767fa14b2de Convert `align` attribute to expressions. by dan sinclair <dsinclair@chromium.org>
  - 4c70d7fff23f36a371ccbfe6fdf9e7d9817a62e3 tint: Make uniformity analysis failures a hard error by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 8800d885e76533b27ef1bfd791863a0e21335717
Change-Id: I83b3a10d6ed00e763c1bac3de95f7a1c4927d776
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/103960
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
248 files changed
tree: ce8895a2adaf5332d937069378eba1487e3dbddf
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. src/
  8. third_party/
  9. tools/
  10. .clang-format
  11. .gitignore
  12. .gn
  13. AUTHORS
  14. BUILD.gn
  15. CMakeLists.txt
  16. CMakeSettings.json
  17. CODE_OF_CONDUCT.md
  18. CPPLINT.cfg
  19. DEPS
  20. Doxyfile
  21. LICENSE
  22. OWNERS
  23. PRESUBMIT.py
  24. README.md
  25. standalone.gclient
  26. tint_overrides_with_defaults.gni
README.md

Tint


Note: This repo is read-only, minimized mirror of the Dawn repo.

Tint changes should be made in the Dawn repo.


Tint is a compiler for the WebGPU Shader Language (WGSL).

This is not an officially supported Google product.

Requirements

  • Git
  • CMake (3.10.2 or later)
  • Ninja (or other build tool)
  • Python, for fetching dependencies
  • depot_tools in your path

Build options

  • TINT_BUILD_SPV_READER : enable the SPIR-V input reader (off by default)
  • TINT_BUILD_WGSL_READER : enable the WGSL input reader (on by default)
  • TINT_BUILD_SPV_WRITER : enable the SPIR-V output writer (on by default)
  • TINT_BUILD_WGSL_WRITER : enable the WGSL output writer (on by default)
  • TINT_BUILD_FUZZERS : enable building fuzzzers (off by default)

Building

Tint uses Chromium dependency management so you need to install depot_tools and add it to your PATH.

Getting source & dependencies

# Clone the repo as "tint"
git clone https://dawn.googlesource.com/tint tint
cd tint

# Bootstrap the gclient configuration
cp standalone.gclient .gclient

# Fetch external dependencies and toolchains with gclient
gclient sync

Compiling using CMake + Ninja

mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja # or autoninja

Compiling using CMake + make

mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build

Compiling using gn + ninja

mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug

Fuzzers on MacOS

If you are attempting fuzz, using TINT_BUILD_FUZZERS=ON, the version of llvm in the XCode SDK does not have the needed libfuzzer functionality included.

The build error that you will see from using the XCode SDK will look something like this:

ld: file not found:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.fuzzer_osx.a

The solution to this problem is to use a full version llvm, like what you would get via homebrew, brew install llvm, and use something like CC=<path to full clang> cmake .. to setup a build using that toolchain.

Checking [chromium-style] issues in CMake builds

The gn based work flow uses the Chromium toolchain for building in anticipation of integration of Tint into Chromium based projects. This toolchain has additional plugins for checking for style issues, which are marked with [chromium-style] in log messages. This means that this toolchain is more strict then the default clang toolchain.

In the future we will have a CQ that will build this work flow and flag issues automatically. Until that is in place, to avoid causing breakages you can run the [chromium-style] checks using the CMake based work flows. This requires setting CC to the version of clang checked out by gclient sync and setting the TINT_CHECK_CHROMIUM_STYLE to ON.

mkdir -p out/style
cd out/style
cmake ../..
CC=../../third_party/llvm-build/Release+Asserts/bin/clang cmake -DTINT_CHECK_CHROMIUM_STYLE=ON ../../ # add -GNinja for ninja builds

Issues

Please file any issues or feature requests at https://bugs.chromium.org/p/tint/issues/entry

Contributing

Please see the contributing guide in the Dawn repo.