Import Tint changes from Dawn

Contains manual fixes for:
 * BUILD.gn
 * CMakeLists.txt
 * DEPS
 * Doxyfile
 * build_overrides/build.gni
 * kokoro/linux/docker.sh
 * scripts/tint_overrides_with_defaults.gni
 * third_party/CMakeLists.txt

And two new files:
 * third_party/google_benchmark/BUILD.gn
 * third_party/google_benchmark/README.chromium

Changes: - 5784a4bd7a0ca25ff2ec57a2b9759a34621ba51c [tint][utils] Add support for large allocations by Ben Clayton <bclayton@google.com>
  - 48a4eabdad4985dff82e2dc897d8245a2df4a36f Fix Combine Sampler transform on function with unused tex... by Shrek Shao <shrekshao@google.com>
  - 6d370e591b68d9abb68eb25bf1638476fbe98f15 [ir] Process uncalled functions in DemoteToHelper by James Price <jrprice@google.com>
  - d037b6031f0b0e5b4a5122f660ac24bc454f5a55 [tint][gn] Fix cmd generation by Ben Clayton <bclayton@google.com>
  - 0c7be2d6360c30922096e3a1bc7e37610dc3013d [spirv-reader] Avoid nested struct deduplication by James Price <jrprice@google.com>
  - f1b8a01f97c5567d9f93feb7b276e567849240bb [tint][glsl] Put GLSL validation behind a build flag. by Ben Clayton <bclayton@google.com>
  - 49a564c40dd569b29fe9e569cd1ace173a170844 [tint][gn] Only build 'cmd' targets when 'tint_standalone' by Ben Clayton <bclayton@google.com>
  - fc9b2c489785c4154d4b8988f25a11ec3f349bc9 [tint][resolver] Error if ptr store type is not storable by Ben Clayton <bclayton@google.com>
  - 80b987eccbcb17fe679db6e5801cf956d17fcd36 [tint][build] Guard WGSL reader with tint_build_wgsl_reader by Ben Clayton <bclayton@google.com>
  - ddd2f5905b1d725a865e5b558ddf681f7d88ef7d [tint][resolver] Move handling of incomplete types by Ben Clayton <bclayton@google.com>
  - 8886d0b3bdb7b3f79d4899d1d9930d17a5d31865 [tint][resolver] Convert abstract-numerics for array() by Ben Clayton <bclayton@google.com>
  - 2550b49be0b0f59612e668db92c40dccab108cc4 [tint][build] Guard WGSL writer with tint_build_wgsl_writer by Ben Clayton <bclayton@google.com>
  - fe9e9d8c69c02df82bd75f376b8350c337dfa989 Support larger maxInterStageShader limits on D3D and Vulkan by Jiawei Shao <jiawei.shao@intel.com>
  - 9bbb27a1c5b945b3815c2f867564c20f34997957 [tint] Add missing build guards by Ben Clayton <bclayton@google.com>
  - 3a533674ffa6881844516706307a965cd967da89 [tint][utils] Assert vectors aren't mutated while iterating by Ben Clayton <bclayton@google.com>
  - 3cd439bfaf464c0ea5ab2d669febda4bc5651e0a [tint] Resolve types without recursion by Ben Clayton <bclayton@google.com>
  - d283e95ad3bfe7c307ede27c6593d5d0b4bfb091 [gn] Add new groups() for various targets, grouped by tar... by Ben Clayton <bclayton@google.com>
  - 535535bf1b3de33fa7fb146761afe14f352c256c [tint] Move override tracking into sem objects by Ben Clayton <bclayton@google.com>
  - b8ff13ee7e41f9e9d3a8480457c8eef350619b5b [tint] Add sem::Array, derives from core::type::Array by Ben Clayton <bclayton@google.com>
  - c3a47ef072710d83dcc6f313d3d96d2f8d65a6f0 [tint][resolver] Add UnresolvedIdentifier, IncompleteType by Ben Clayton <bclayton@google.com>
  - 0b4efc53e94e2199a0fc688a14e5f2ce764bec24 [tint] Add setters to sem variable types by Ben Clayton <bclayton@google.com>
  - ac72499c0a8a154fdfdc13a6442ef440d69f0ed0 Wrap fuzzer generation in GN tint_has_fuzzers check by Jim Van Verth <jvanverth@google.com>
  - 23f3c347a2ea07b88b41657178cd2ed36163f244 [spirv-writer] Clean up some obsolete TODOs by James Price <jrprice@google.com>
  - 01c15776a2e8e0b319f157d1e9670ae70a3a96d2 [spirv-writer] Move LiteralOperand to spirv::ir by James Price <jrprice@google.com>
  - dc5e5196a03c79fbd4490b58c72dcd8577125bfb [spirv-writer] Add pass-matrix-by-pointer option by James Price <jrprice@google.com>
  - ac001956d8395e7ec907b883aed0a9a3c7da023b [tint][IrToProgram] Reconstruct workgroupUniformLoad by Ben Clayton <bclayton@google.com>
  - abfb8e09a03b72d8fb03dc105f053336d399cae1 [spirv-writer] Fix ftoi conversion polyfill by James Price <jrprice@google.com>
  - 6f071847315a18825f6c217f784d672e75b5bf47 [spirv-writer] Don't hash `const char*` by Austin Eng <enga@chromium.org>
  - 5294cb0e9e7f4ca373b7638a92c44f2ed97fb045 Using binding information for SPIR-V/Tint interface by dan sinclair <dsinclair@chromium.org>
  - 66b75667e70724cef9912e78c50c25e164163a00 [gn] Disable fuzzers when '[dawn|tint]_has_build' is false by Ben Clayton <bclayton@google.com>
  - 99bc3e8ab7b60cad7909571b925d0ed48c75552a [tint][resolver] Rename builder_ to b and make a reference by Ben Clayton <bclayton@google.com>
  - c00c569fca7d3e1d40a179e340177815f3292733 [ir] Check for orphaned instructions in validator by James Price <jrprice@google.com>
  - 68c25b86e5e2ac299a4c84efa6ac75df31f9b545 [tint][resolver] Move lambdas to methods by Ben Clayton <bclayton@google.com>
  - 0eec270d3e1451cec2ffd712b00d3c28b3e47d92 [tint][utils] Add VectorIterator class by Ben Clayton <bclayton@google.com>
  - 7d95661d5b198f322edb31a507afecf54d74123a [kokoro] Update GCC to 13 by Ben Clayton <bclayton@google.com>
  - e82fe98bd900efceca25ee39099315c2ad8468e0 [tint][ir] Add Disassemble() free function by Ben Clayton <bclayton@google.com>
  - 89f9d6d4c49643b5d2d23ee3765d1f183ce38cf9 [tint][ir] Various fixes to IR -> Program by Ben Clayton <bclayton@google.com>
  - 1a1da4576f273526876d1b8e4fecfbcf619a9518 [spirv-writer] Combine access instruction chains by James Price <jrprice@google.com>
  - 6ab5462857c27c5f08f70a90c9a974d4bfc90b61 [tint][fuzzers] Add tint_wgsl_fuzzer executable by Ben Clayton <bclayton@google.com>
  - 415f1bed2988cdb6ae539093f1b86347c6861de6 [ir] Fix use-after-free in MultiplanarExternalTexture by James Price <jrprice@google.com>
  - 1d1205c77ca96f18be2cb77fe6278bac0223af77 [fuzzers] Skip *.expected.ir.spvasm files by James Price <jrprice@google.com>
  - 089347a5062e47e2761f8f262a21eafe14f7142a [tint] Don't link 'benchmark_main' target by Ben Clayton <bclayton@google.com>
  - ef3f5dc888e81edfdddd059b8a1ec06fb913890b [tint] Change signature of ApplySubstituteOverrides() by Ben Clayton <bclayton@google.com>
  - a9cc4c1ceb544d3e23e15ec70ee82b1a4b7c7e39 [tint] Add fuzzer target support to 'gen build' by Ben Clayton <bclayton@google.com>
  - a324e1a5e0e2a7c1b5e76247a783217c6c71cb65 [ir] Add polyfill for ftoi conversions by James Price <jrprice@google.com>
  - ddd6d24e437a54548ac446d009dcfeadf77dc6ad [wgsl][ir] Polyfill workgroupUniformLoad on lower by James Price <jrprice@google.com>
  - dcf6c42bed367b79377cdb335e29a6b849e351bb [spirv-writer] Use OpConstantNull for composites by James Price <jrprice@google.com>
  - fcda9f809f4d1092372379381c8f32f862fa8238 [tint][bench] Fix linker errors for certain build by Ben Clayton <bclayton@google.com>
  - 9d05868b851a00feb884b902f1756f0ed887019e [tint][gn] Remove `testonly = true` from emitted BUILD.gn... by Ben Clayton <bclayton@google.com>
  - d09eb2406339e8c4608b425fae3c7a78450b4cb3 [tint][utils] Use [[maybe_unused]] on TINT_STATIC_INIT by Ben Clayton <bclayton@google.com>
  - 997c2cbe94dd6a4bb5878d702926b0ef9b2a11ee [tint][utils] Add a TINT_STATIC_INIT() helper by Ben Clayton <bclayton@google.com>
  - 9d1b610d7666f3b8081fd83004c7376e8725790b [tint][build] Generate benchmarks for GN and Bazel by Ben Clayton <bclayton@google.com>
  - 77a51263418907750a14e1a6b55d31c2c57690c5 [tint] Move ApplySubstitueOverrides() fuzzers -> wgsl/hel... by Ben Clayton <bclayton@google.com>
  - 6f2ede60bf320ce42315de35eb257c289e1215f0 [tint] Remove blankline before copyright by Ben Clayton <bclayton@google.com>
  - 77350e94b50beb8366b0cfd06fc5afca228387f7 [tint] Support iteration while adding to BlockAllocator by Ben Clayton <bclayton@google.com>
  - ffcb82acc65d2c740ddf5ce463c2b52fead00d38 [tint][cmake] Rework targets for fuzzers by Ben Clayton <bclayton@google.com>
  - 8c71a15d9019dcfa98454c7dd76f5277ff341a05 [tint] Remove tint_spirv_tools_fuzzers by Ben Clayton <bclayton@google.com>
  - b099a8fc31eb4788bc144789c13dc6981055f389 [ir] Add PreservePadding transform by James Price <jrprice@google.com>
  - 9ff85267afccef5a8dbd86aea57a4da417fc8d6d [ir] Fix let instructions in BlockDecoratedStructs by James Price <jrprice@google.com>
  - c0476283ff86f358c76346d7f014330e5206bf76 [tint] Remove tint_black_box_fuzz_target by Ben Clayton <bclayton@google.com>
  - d5fcc3dd1751834721d2bd4b89b2e511f27b2a6b Add support for unorm10-10-10-2 vertex format by François Beaufort <beaufort.francois@gmail.com>
  - f744cf4a265f07aab17ad2605a46ec078afdacd6 [ir] Do not automatically add cloned functions by James Price <jrprice@google.com>
  - b1c7464f22074e923f90c3fc474cd16c19513ba0 [ir] Use Builder::LoopRange helper by James Price <jrprice@google.com>
  - a2bf4bdc476986228397d9584f6c78d08e606cd6 [ir] Fix use-after-free in ShaderIO transform by James Price <jrprice@google.com>
  - 8f403335073f241870c4bd9176146c4f20325331 [wgsl][lower] Destroy converted call instructions by James Price <jrprice@google.com>
  - d66eeb775802fcf92ddc9995ffd53096f13f9e96 [ir][spirv-writer] Add index to IO output names by James Price <jrprice@google.com>
  - 57d9ec4f87f22a562d4221d1e1ed15ecbabf18e3 [tint][fuzzers] Disable concurrency fuzzer for pixel-loca... by Ben Clayton <bclayton@google.com>
  - 1ec4835ca75d777a294587d50cb6640dcc6bd740 [ir] Change ir::BindingRemapper to take a set of options. by dan sinclair <dsinclair@chromium.org>
GitOrigin-RevId: 5784a4bd7a0ca25ff2ec57a2b9759a34621ba51c
Change-Id: Id46f334e607067a4b8bb341bd214dc2b33aa0b05
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/155921
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
425 files changed
tree: d94dfb507f1251fe39f9e7552a7f1e1d874e39a8
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. scripts/
  8. src/
  9. third_party/
  10. tools/
  11. .clang-format
  12. .gitignore
  13. .gn
  14. AUTHORS
  15. BUILD.gn
  16. CMakeLists.txt
  17. CMakeSettings.json
  18. CODE_OF_CONDUCT.md
  19. CPPLINT.cfg
  20. DEPS
  21. Doxyfile
  22. LICENSE
  23. OWNERS
  24. PRESUBMIT.py
  25. README.md
  26. standalone.gclient
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.