Commit Graph

219 Commits

Author SHA1 Message Date
Ben Clayton e6e96def66 tint: Add operator support to intrinsic-gen
Adapt the builtin parsing and resolving to also support operators.
Will be used to generate intrinsic table entries for operators.

This will simplify maintenance of the operators, and will greatly
simplify the [AbstractInt -> i32|u32] [AbstractFloat -> f32|f16] logic.

Bug: tint:1504
Change-Id: Id75735ea24e501877418812185796f3fba88a521
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89026
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-05-09 18:08:23 +00:00
Ben Clayton e132516e6f tint: Rename and move builtin_table and builtin-gen
• Rename 'builtin-gen' back to 'intrinsic-gen', as 'intrinsics' now
  include both builtins and operators.
• Move the intrinsic definitions, and IntrinsicTable to the resolver
  package, where it belongs.

Bug: tint:1504
Change-Id: I5ad5c285c1e360a224ee1235c293ccd55eb2693d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89025
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-05-06 15:13:01 +00:00
Ben Clayton 8495affacf tools: More CTS tooling improvements
• Add the included trybots in the CL description. All of these trybots are tested by the roll, but the final CQ-submit wouldn't necessarily test all of the variants before landing. This would mean that the 'cts export' could miss some results, as it takes the last PS with any results.
• Add --force flag to cts roll to force a roll. Useful for testing.
• Emit timing diagnostics for tests labelled 'Slow' instead of unhelpfully stating they pass.
• Enable the --cl and --ps flags for cts export
• Export with the most recent data to the top of the spreadsheet

Bug: dawn:1401
Change-Id: Id926367ab805bfb9f3032fce9cce7f00daf7a5d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88661
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-03 16:58:43 +00:00
Ben Clayton 174c508c8d tools/cts: Bunch of fixes for 'cts roll'
• Strip 'release-x64' tags.
  These are always paired with 'release', and all
  other tests just have the 'release' tag. This
  means that results with the 'release' +
  'release-x64' tags are a subset of just the
  'release' tags, leading to many broken
  assumptions in the expectation update.

• Don't consider tests with the error reason
  'asyncio.exceptions.TimeoutError' as slow, but
  as a failure. The CTS expectation updater will
  already mark tests exceeding the config
  threshold as slow. This reduces the amount of
  data requested from resultdb, and prevents
  failed rolls when results are actually
  deadlocking.

• Fix inferring of patchset in GetResults().
  LatestPatchest() was called but was assigned to
  a nested scope.

Bug: dawn:1401
Change-Id: I57b2c9a029b31430d63a056f7b13c4bf1bc5b437
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88450
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-05-02 20:44:21 +00:00
Ben Clayton bf464ddbdf tools: Add the 'cts roll' sub-command
Performs a CTS roll, updating ts_sources.txt and expectations.txt.

Bug: dawn:1342
Change-Id: I18cc644e9eef1db6034fc07fd94f21f070561265
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88444
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-02 20:44:21 +00:00
Ben Clayton d9f2a61c6f tools: Add the 'cts export' sub-command
Updates a Google spreadsheet with latest CTS statistics.

Bug: dawn:1342
Change-Id: I01a9c99032c755d6a78af674675d8c9cbfc79019
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88443
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-02 20:44:21 +00:00
Ben Clayton 665c07ac6a tools: Add the 'cts update' sub-command
Updates the expectations file with new results.

Bug: dawn:1342
Change-Id: I05cab48eb1cf0f9ab7e652a1b7c3da361c45b0b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-29 19:09:17 +00:00
Ben Clayton 1ed858c20a tools: Add the 'cts merge' sub-command
Merges results files into one.

Bug: dawn:1342
Change-Id: Ia241afc982c88c840a102abba211053611f77f5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88441
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-29 19:09:17 +00:00
Ben Clayton 09eafe71b5 tools: Add the 'cts results' sub-command
Pulls the CTS results from a patchset

Bug: dawn:1342
Change-Id: I879605b71517004d3a8e81a1b4481bbc0105a22c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-29 19:09:17 +00:00
Ben Clayton 40bed821f8 tools: Add the 'cts time' sub-command
Add the common utilities for starting and fetching build results.

'cts time' provides views on the longest running tests, along with
a histogram view of all test times.

Bug: dawn:1342
Change-Id: Ia3707f7f062ea26a2406e3163a26e1cc7e30e3b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88319
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-29 19:09:17 +00:00
Ben Clayton 251e464af1 tools: Add the 'cts format' sub-command
Formats an expectation file

Bug: dawn:1342
Change-Id: Idc7728ad5b955fcbdb4062e511aff6665a711718
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88318
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-29 19:09:17 +00:00
Ben Clayton 846e3149b7 tools: Begin adding the CTS command line tool
This CL introduces the Config structure, and config file.
Used by all the sub-commands.

Bug: dawn:1342
Change-Id: Iaad5a02bc2ceba2c63265cf0d1086dc7901e7ed7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88317
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-04-29 19:09:17 +00:00
Ben Clayton e822f5e016 tools: Add 'Duration' field to cts.Result.
Will help identify slow tests.

Bug: dawn:1342
Change-Id: I422d345361785addcc2faa6281e0608de02629b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88316
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-29 19:09:17 +00:00
Ben Clayton 15a85dec7e tools: Add 'subcmd' package
Helper for writing command line tools that have sub-commands.
Will be used by the CTS tool (roll, results, export, etc).

Bug: dawn:1342
Change-Id: Id22beecbc02b73af23064adc67c590f825b37789
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88315
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-29 16:30:24 +00:00
Ben Clayton 526087bde7 tools: Add more functionality to gerrit package
Add Patchset.RefsChanges(). Returns the 'refs/changes/X/Y/Z' string
for the given patchset.

Add []FileComment parameter to Gerrit.Comment(), allowing the posting
of comments on particular lines of the change.

Bug: dawn:1342
Change-Id: Ia4113a158b285c606b2c6c520cef6c9e8030fae7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88314
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-29 15:15:43 +00:00
Ben Clayton 2fb28e008d tools: Extract getDawnRoot() from run-cts to utils
This is needed elsewhere.
Rename location.go to paths.go, as this is really dealing with file
paths.

Bug: dawn:1342
Change-Id: Ifdbfafc0fd763ac7ec2b8f692efc35772c4793da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87704
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-29 11:18:43 +00:00
Ben Clayton 27f480b7e6 tools: Add src/cts/expectations Update()
Implement the logic to update an existing expectations file with new
results.

Bug: dawn:1342
Change-Id: Idcbad57946712539cc5f0d238f89a2adf42f5aa0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87702
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-29 11:06:34 +00:00
Ben Clayton 2c1154c36f tools: Add src/cts/results.List.MinimalVariantTags
MinimalVariantTags accepts a list of tag-sets (e.g GPU tags, OS tags, etc),
and returns an optimized list of variants, folding together variants that
have identical result query-to-status mappings, and removing redundant tags.

Bug: dawn:1342
Change-Id: I759c82e9a0631a9d321d376656e5a2dbbf5f5507
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87643
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-29 08:13:19 +00:00
Ben Clayton 68e039c456 tools: Add src/cts/expectations
Implement an expectation parser, data structures and writer.

Bug: dawn:1342
Change-Id: I53587a9b55346ccf1543e15c9cec5ff68c6849ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87641
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-28 22:32:23 +00:00
Ben Clayton bd18618bf6 tools: Move go.mod & go.sum files to root
Go tooling does not work properly when modifying go files in subdirectories from the root of the IDE.

Consolidate the two go modules in the source tree.
We'll eventually want to move `src/dawn/node/tools` to `tools/src`.

Allows us to type `go test ./...` at the root, and test all go code in
the entire repo.

Bug: dawn:1342
Change-Id: Ie3dd2c89a769cd25c2b68884970ef0f2ba8c7560
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86532
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-04-28 09:51:03 +00:00
Ben Clayton 1c3f88eb0c tools: Fix LoadCredentials()
If the URL ends in a slash, this would fail to match the gitcookies file

Change-Id: I987ec637b2f6db172d4173938960060321722bfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87920
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-04-26 14:53:42 +00:00
Ben Clayton 368b3eaae4 tools/src/cmd/perfmon: Fixes / improvements
• Fix up various references of 'tint' to 'dawn' post-migration.
• Round the CPU speed to 100MHz. This appears to fluctuate on reboots
  for some machines.
• Fix git.Log() - the Count was trimming from the wrong end, leading
  to perfmon spamming the github repo with repeat results.
• Instead of using google-benchmark's `--benchmark_repetitions` flag
  for repeating benchmarks, calculate averages by re-running the
  benchmark executable. Use '--benchmark_enable_random_interleaving'
  to randomize the order in which benchmarks are run, which greatly
  helps reduce noise in the averaged results.
• If the host machine supports CPU temperature sensors, wait for
  thermals to stabilise before running the benchmarks. Further helps
  reduce result noise.
• Breakout of the historic benchmarking loop every 15 minutes to check
  for new Gerrit changes to benchmark.
• When idle, attempt to re-benchmark historic results that are 'spiky'
  to reduce noise in the graphs.
• Specify more CMake flags to avoid building non-benchmark executables.
• Update the default base change for historic results. Attempting to
  use the old hash, which was prior to the tint -> dawn  merge makes,
  the git log go back to T0 on the dawn branch. We don't want to
  benchmark nearly 3k changes.

Change-Id: I8e59c7838720eb8bd11f217e9bd3104ba1eb51c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87642
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-25 21:06:21 +00:00
Ben Clayton 2363ad16ea tools/src/cts/result: Add more helpers
Add result.List.StatusTree() for building a query.Tree[Status].
Add helpers for serializing results.
Add helpers for merging and de-duplicating results.

Change the interface of result.List.ReplaceDuplicates() so that the
merging function takes a status set instead of a list of results.

Bug: dawn:1342
Change-Id: I77580ec5fd4c8f12109fb6e9e83afea8b740260c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-20 19:10:42 +00:00
Ben Clayton 1a10b73552 tools/src/cts/query: Add Tree
A tree of query to data. Has utilities for reducing the tree based on a
custom merger function.

Bug: dawn:1342
Change-Id: If1c0503be05ee04bcf55dd5bdc9aa3caf6fb56ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87222
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-20 19:10:42 +00:00
Ben Clayton 529747b041 tools/src/resultsdb: Request 'test_id' field
Required as the test name tag field is limited to 256 bytes.

Bug: dawn:1342
Change-Id: I9f604181561acb6b7b9250599508474c0190333a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87221
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-20 00:29:05 +00:00
Ben Clayton ba9404dac2 tools/src/utils: Add location.go
Contains helpers for obtaining the source location of the caller

Bug: dawn:1342
Change-Id: I6eddf9140d10bc7889260392e04c3e2adec715d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87220
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-19 23:35:15 +00:00
Ben Clayton a8b651a7cc tools: Add resultsdb package
Wraps the luci package to make it a bit friendlier.

Bug: dawn:1342
Change-Id: I8e0b5c27696d23aaf704fedcbdf71b26070f5d34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86528
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-14 10:53:10 +00:00
Ben Clayton 5827191cc5 tools: Add buildbucket package
Wraps the luci package to make it a bit friendlier.

Bug: dawn:1342
Change-Id: I80e02344ea1ecd95134a719f21eb8bd2a1cb1997
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86527
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-14 09:50:30 +00:00
Ben Clayton ac068c9a31 tools: Add gitiles package
Wraps the luci package to make it a bit friendlier.

Bug: dawn:1342
Change-Id: I70bf01b7ef5fcf210a2ff7ccafa49ea0720ae125
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86526
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-04-12 18:01:51 +00:00
Ben Clayton 4c9a6b0951 tools: Minor improvements to the git package
Rename 'Auth' to 'Credentials' to match the gerrit package.

Add a couple more helpers, and add more comments.

Bug: dawn:1342
Change-Id: Ieb6d12d23bb71678e04ff694ab9085a8f5367437
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86525
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-12 16:16:01 +00:00
Ben Clayton 53ddabe48f tools: Flesh out the gerrit package
Add more helpers for interfacing with Gerrit.

Move dawn-specific constants out to a new 'dawn' package. Keeps the
packages dawn-specific-free.

Bug: dawn:1342
Change-Id: Iaebe0b68d877340fc848d711c848d01705ddae57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86524
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-12 16:13:31 +00:00
Ben Clayton 9173392671 tools: Add src/cts/result
Holds types that describe CTS test results

100% test coverage.

Bug: dawn:1342
Change-Id: I453e87549eb992b2dcb41da4e0b6e3907ab2ed06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85804
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-11 11:03:10 +00:00
Ben Clayton 4127abfd41 tools: Simplify gerrit-stats and snippets
Automatically try to infer 'user' from git config.
Default to 'dawn' repo over tint.

Usage:

tools/run snippets
tools/run gerrit-stats

Change-Id: I8c4617101447ac635e753b0a2a0b655ba6c64b54
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86300
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-11 10:49:50 +00:00
Ben Clayton afbe161cd4 Remove standalone.gclient
Use `scripts/standalone.gclient` instead.

Bug: dawn:1339
Change-Id: Id702d42d104a0f6951973792389f897a6bdf4b10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86069
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-07 19:28:44 +00:00
Ben Clayton 59e96fe55e tools/src: Fix up paths post-tint-merge
Bug: dawn:1339
Change-Id: Icdc15e4d80ed4e65b343294eb3bc22a417fcf490
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86062
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-07 17:50:24 +00:00
Ryan Harrison e87ac76f7d Merge remote-tracking branch 'tint/main' into HEAD
Integrates Tint repo into Dawn

KIs:
- Building docs for Tint is turned off, because it fails due to lack
  of annotations in Dawn source files.
- Dawn CQ needs to be updated to run Tint specific tests
- Significant post-merge cleanup needed

R=bclayton,cwallez
BUG=dawn:1339

Change-Id: I6c9714a0030934edd6c51f3cac4684dcd59d1ea3
2022-04-06 15:37:27 -04:00
Ben Clayton 3a279a84e7 tools: Remove error return value from query.Parse()
It was always nil

Bug: dawn:1342
Change-Id: I7bc623bba1cbc65e6b91dee7af9bc6b096174605
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85803
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-05 17:08:25 +00:00
Ben Clayton 75cc17f2d1 tools: Add src/cts/query
Provides a type to represent the CTS query strings.

100% test coverage.

Bug: dawn:1342

Change-Id: I3769b094ba64221a7b79dd38f76daf0125ee9e28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85221
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-01 16:31:15 +00:00
Ben Clayton 475941c295 tools: Add src/container
Contains generic Map and Set types.

Golang 1.18 added new support for generics, but has not yet added a standard library that provides generic containers. In future versions of Golang, there will almost certainly be similar implementations of these types.
Until then, use these to simplify some code.

100% test coverage.

Bug: dawn:1342
Change-Id: I2a5c7bfb26f15c2099037d3fa0f0576df641d9f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85220
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-03-30 21:12:14 +00:00
Antonio Maiorano ade4e74ec4 test-runner: add 'fxc-and-dxc' arg to run both FXC and DXC for HLSL
When enabled, for each test, FXC is run first, and if it succeeds, DXC
is run. If both succeed, the test passes, otherwise it fails. This
option allows us to get meaningful feedback from running this script
against HLSL files, as well as taking advantage of the feature to delete
skips for tests that now pass (both FXC and DXC in this case).

Change-Id: Iae2ebfda7bd92f1b94893e648e2d1fb1f6979b39
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84680
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-28 20:17:22 +00:00
Antonio Maiorano 7419f0e26a Fix test-runner not skipping dirsWithNoPassExpectations
Tests were moved to a new 'tint' subdirectory for the tint -> Dawn
merge, but these paths were not updated.

Also regen'd files for HLSL and a couple are no longer failing.

Change-Id: I11c315d948013ed30635d20e6da565450859cb03
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84341
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-23 15:10:22 +00:00
Ben Clayton 1fcb2a7a24 tools: Update post-shuffle paths for builtin-gen
Bug: tint:1418
Change-Id: Ic1560bf7a0aa99ecbe554b985dc07f1b055fab64
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81500
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-22 20:24:59 +00:00
Ryan Harrison 555e94e7e3 Fix legacy non-inclusive language issues
Explicitly filters out problematic files from presubmit with issues
that are not under our control, i.e. URLs.

BUG=tint:1433

Change-Id: I34a449c825edc39f934cbe9afa3436f7514f2808
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80860
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-17 15:03:19 +00:00
Ryan Harrison 382b2a23c8 Add test-name-filter flag to `get-test-plan`
BUG=tint:1413

Change-Id: I6a4735a97f64003cb4999d6a64b64666d0ce08ad
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79140
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Ryan Harrison <rharrison@chromium.org>
2022-02-03 20:55:03 +00:00
Ryan Harrison 43ad59d3dc Clean up for automatically detected issues
Mostly typos and one case of a return not being error checked.

Change-Id: Id33e93402b05c165aa129bb22e4b0c7f55b0a71b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79141
Kokoro: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-03 19:52:22 +00:00
Ben Clayton b85e692aa7 Rename 'intrinsic' to 'builtin'
This matches the term used in the WGSL spec.

Change-Id: I4603332b828450c126ef806f1064ed54f372013f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78787
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-02-02 23:07:11 +00:00
Ben Clayton e3d4197822 tools/perfmon: Don't stop on errors
Don't terminate on first error. Sleep a bit and try again.

Post a message to a gerrit change if it cannot be built. The fact the PS has a message from perfmon will prevent it from retrying the same change.

Remove trailing newlines from log.Printf() messages, they're automatically added.

Bug: tint:1383
Change-Id: I78a627c53c492e7da33a74470d5a064e90a7a753
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78783
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-01 15:28:21 +00:00
Ben Clayton f34038b1a0 tools: Fix benchmark tests
The diff format changed.

Change-Id: I13930e0aeb450384d95d71460f9623adb5c1b192
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78581
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-01-28 19:21:20 +00:00
Ben Clayton c126bc95df tools: Add perfmon
A tool to continually automatically generate performance metrics for tint CLs.

perfmon monitors gerrit changes, benchmarks them and posts results to
the gerrit change.

Commit changes are also benchmarked, and results are automatically posted to:
https://tint-perfmon-bot.github.io/tint-perf

Bug: tint:1383
Change-Id: I3470b170046e1d9af456f5e3a1d6ff76c305898a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-27 14:51:06 +00:00
Stephen White d5560400a3 Run all of the backends in the test runner.
Essentially, this adds GLSL to the list of backends to run.

Bug: tint:1358
Change-Id: I5075df32d935a3e08733daadbe5ac9dc1e13f03c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77220
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-25 00:35:20 +00:00
Ben Clayton 4b433dfe07 test-runner: Add test/benchmark to excluded dirs
Don't generate .expected.* files for these benchmarks. We don't want to inspect their generated output.

This was a great recommendation from jrprice here:
https://dawn-review.googlesource.com/c/tint/+/77443/4#message-a91825492f67033c51326022dd1b4a340aa75dd7

Change-Id: I2a8a5f0ac747531228b78675b96173875fb02851
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77446
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-24 15:49:40 +00:00
Ben Clayton 6cadbb2712 test-runner: Change behavior of 'excluded' directories
For the directories "/test/unittest/" and "/test/vk-gl-cts/", continue to prevent the emission of PASS expectations, but now:
* Generate SKIP expectations in these directories if `--generate-skip` is passed.
* Delete expectation files in these directories if the tests now pass and `--generate-expected` is passed.

There's no change in behaviour for other test directories.

Change-Id: Ibd9e84a51029715e7c3d9e22e76a65770b66f1c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-01-21 19:16:29 +00:00
Ben Clayton 01e4b6fc18 wgsl: Replace [[decoration]] with @decoration
Deprecate the old syntax. Migrate everything to the new syntax.

Bug: tint:1382
Change-Id: Ide12b2e927b17dc93b9714c7049090864cc568d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-19 22:46:57 +00:00
Ben Clayton be2362b18c benchmarks: Add a basic set of benchmarks
Add google benchmark to the DEPs.

Implement a basic set of benchmarks for each of the writers and the WGSL parser.

Add build rules for CMake. GN build rules TODO.

Add a simple go tool (ported from Marl) to diff two benchmarks. Less
noisy than the one provided by google benchmark.

Bug: tint:1378
Change-Id: I73cf92c5d9fd2d3bfac8f264864fd774afbd5d01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/76840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-01-18 18:58:16 +00:00
Ben Clayton 7dc901fa4f tools roll-release: Bump branchLegacyCutoff to M96
The tool was getting slow, due to the number of branches being examined.
M96 is the latest stable release. We aren't applying fixes to this or older branches.

Also avoids an issue where the M95 branch was missing a cherry-pick, which the tool wanted to merge with each run.

Change-Id: I8a8b1466c10633d9539725cd4f9b1b0514e41e93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75067
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-01-05 21:03:10 +00:00
Ben Clayton 9c7b39f365 msl: Explicity validate against MSL 1.2
Fixed: tint:1327
Change-Id: I7d2e182f60c42894410500f393a1235d37efe5e1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71680
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-06 13:02:36 +00:00
Ben Clayton 177e7bfa5d IntrinsicTable: remove double underscores
'__' is reserved in C++, and the 'match__' and 'build__' functions are causing OSS-fuzz builds to fail.

Add the change in tint behavior to the OT notes.

Add end to end tests for underscores. While the GLSL and MSL compilers seem to accept leading and double underscores in identifiers, the tint build failure has highlighted we have more work to do here (crbug.com/tint/1319)

Fixed: oss-fuzz:41214
Bug: tint:1292
Bug: tint:1319
Change-Id: I32b7bf4e0cff26e678b788457f90452c2503da50
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70480
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-11-22 15:24:16 +00:00
Antonio Maiorano 2551458aef fix-tests: fix when gtest outputs absolute source paths
Since CMake 3.21, the Ninja generator now outputs absolute paths to
source files, rather than relative. These paths are what __FILE__ gets
mapped to during compilation, and is what gtest outputs for test
failures. This broke fix-tests, which assumed a build-relative source
path. This change detects when the source file path is absolute, and
converts it to a build-relative one.

Also, on Windows, absolute paths include the drive with a colon
character, so I added matching the colon to the regex for the path
portion.

Change-Id: I065161d65f098023376b7e479d8a24a83beb1df7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69440
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-16 15:09:56 +00:00
Antonio Maiorano bb1a9930c1 test-runner: don't generate for excluded paths on Windows
Script would erroneously generate for files in excluded paths because of
slash differences.

Also make the output display the path to the MSL and HLSL executable
being used.

Change-Id: I0bf55dd461c96b7b910f7a9aa9756ab2006c2a33
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68821
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-11-10 14:34:55 +00:00
Ben Clayton e9c6a64147 test-runner: Add support for GLSL
This is not included in the default for 'filter' as it is far from ready.
Also: Don't generate SKIPs in the excluded directories.

Change-Id: I02cb40c1bf8adebc77e9e5102988dd41e4b1f7a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68522
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-11-05 22:45:23 +00:00
Ben Clayton 8648120bbe Make all ast and sem pointers const
And remove a whole load of const_cast hackery.

Semantic nodes may contain internally mutable fields (although only ever modified during resolving), so these are always passed by `const` pointer.

While all AST nodes are internally immutable, we have decided that pointers to AST nodes should also be marked `const`, for consistency.

There's still a collection of const_cast calls in the Resolver. These will be fixed up in a later change.

Bug: tint:745
Change-Id: I046309b8e586772605fc0fe6b2d27f28806d40ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66606
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-10-19 18:38:54 +00:00
Ben Clayton 7f1c8d98c5 tools: Fix file regex in fix-tests
The old regex was not allowing numbers in the filenames.

Change-Id: Ic16de247f9caadefda6d6eb05896923ba4399ba5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66441
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-10-14 16:16:48 +00:00
Sarah 7ff308fd18 cts: write test URL in url() instead of description
test name: from "... + section name" -> "section name + ..."

bug: tint:1203
Change-Id: Ic71f2cd3ef3e45d335f382dde93cc8694d998204
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65980
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-10-06 22:00:58 +00:00
Sarah 22daca166b cts: Change uniqueId() parameter to string. Add how-to-contribute to description.
- Update the spec version used to:
  https://www.w3.org/TR/2021/WD-WGSL-20210929/
- replace extra white spaces with "\s" instead of "\n"
- github PR: https://github.com/gpuweb/cts/pull/770

Bug: tint:1189
Change-Id: Ib8d0aaf57eac3fff4fd6943b4a3d2d0a691a9a0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-10-04 14:54:37 +00:00
Sarah 7f4d02c7ab cts: fix generated test names in get-test-plan tool
testnames: sectionX_ruleY
fix init value

Bug: tint:1159 tint:1158
Change-Id: Icc92668ee141b2631d9705f41a5155d6483f9713
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64041
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-09-13 23:26:00 +00:00
Sarah e980ac1699 tools: parses wgsl spec and outputs a test plan (get-test-plan)
Change-Id: Id05013c862d168afbd7820a36a67d81ef0b7b01f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62980
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-07 17:14:54 +00:00
James Price 87cce20f67 test: Remove many expected files
For these tests, we only really care that we can successfully consume
them and generate valid output for each backend. Having the expected
files in the tree generates significant churn for any change to how we
generate backend code, which makes it hard to inspect diffs.

Change-Id: Ic98c248081144c0fb1791f1303eaf6d459548e3d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-08-24 22:49:42 +00:00
Ben Clayton ecadfc111b tools: Support adding tint flags to the test cases
Starting a test case with `// flags: <flags>` will
append the <flags> to the tint executable for that test case.

Let's you specify things like `// flags: --transform XXX`, which lets us
end-to-end test a particular set of transforms.

Change-Id: I181e9f7e7c1fba5e3a47cf58aee462b51e4b6e3b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60921
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-08-04 20:02:15 +00:00
Ben Clayton b209c477db tools: test-runner add TIME column
Shows the net time spent waiting for tint & validators to complete the test run
Helps identify the slow compilers

Change-Id: I3e915762fdb4dc56f02320d7f5e0e13f7cb83d78
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60343
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-07-30 21:32:22 +00:00
Ben Clayton 6ed467a340 tools: Link thread library for remote-compile
Fixes building on Linux, and possibly Windows

Change-Id: Ie8560618c4e0179e3a76da514d8835114b91b863
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60349
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-30 21:16:46 +00:00
Ben Clayton 5209a8170d tools: Add roll-release
roll-release is a tool to synchronize Dawn's release branches with Tint.

roll-release will scan the release branches of both Dawn and Tint, and will:
* Create new Gerrit changes to roll new release branch changes from Tint into Dawn.
* Find and create missing Tint release branches, using the git hash of Tint in the DEPS file of the Dawn release branch.

Change-Id: I009aedc826d604f7fda10769ea94fee931a56dcc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60341
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-30 16:20:46 +00:00
Ben Clayton 33c997b829 tools: Multi-thread remote-compile
Considerably speeds up compilation

Change-Id: Ic7e04938f79989a15da36999fab1b192aca9619c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60214
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-30 16:02:26 +00:00
Ben Clayton 053559d051 intrinsics: Add new struct form of modf(), frexp()
Implement these for all the writers.
SPIR-V reader not implemented (the old overloads weren't implemented either).

Deprecate the old overloads.

Fixed: tint:54
Change-Id: If66d26dbac3389ff604734f31b426abe47868b91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59302
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-23 16:43:01 +00:00
Ben Clayton f3fffdaded Build fixes
fuzzer: GetErrors() was replaced with Diagnostics()
remote-compile: Add missing header for macOS
Change-Id: I7697fd41b3cc4e3b59e10a6c395d610a51ec8daf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59025
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-21 09:40:41 +00:00
Ben Clayton f6660aa125 tools: Add snippets tool
Gathers information about changes merged and reviewed for team weekly reports.

Change-Id: I53e3acc45679b4822c506d16980393fbaf337b3b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59022
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-20 20:25:38 +00:00
Ben Clayton 9a052177d0 tools: Fix test-runner --filter flag on windows
Likely got broken with https://dawn-review.googlesource.com/c/tint/+/56776

Change-Id: Ie9db21e11084435a47f6fa0bfc809a590a353685
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58396
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-19 14:47:39 +00:00
Ben Clayton ff3dbc361b tools: Add gerrit-stats
Gives you juicy stats for contributions to the project.

Change-Id: I4f3e7f03cc43947675e916a8036317af4a894d12
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57883
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 16:29:16 +00:00
Ben Clayton 54cfa0b9a1 [tools]: Add remote-compile
A tool for compiling shaders on a remote machine.
Helpful for combining with `test-all`, so that a single non-windows
machine can validate SPIR-V, MSL and HLSL.

Change-Id: I3a0f70e6e4edd13952eb5dc72fbbed7c495036ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56940
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-08 19:35:53 +00:00
James Price facb5ced00 tools: Add --filename-column-width to test runner
If provided, this option truncates long filenames to avoid unpleasant
line wrapping behavior for those of us that use narrow terminals.

Change-Id: I684b91b7aa4b0ae86a4cf9ed9f047b685ab97550
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57100
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-06 18:31:15 +00:00
Ben Clayton 892aaf377f tools: Fixes for intrinsic-gen on windows
Fix slash-related issues.

Change-Id: I618649578746450df7cb2dcd372c5a778eb719ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56776
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-05 16:43:17 +00:00
Ben Clayton c2da12bb20 tools: Add --fxc option to test-runner
And add a reasonable timeout to tests.

Change-Id: I362d44f2a799562d236a80f5c35d50d93e8d094a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56769
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-02 21:13:24 +00:00
Ben Clayton 288c8ad32e test-runner: Fix printing on windows
Colors were not being escaped properly for windows (which has special non-ANSI color code handling)

Change-Id: I03c34b1205b26b1192af9c05162bbe03035172bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56500
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-29 20:55:16 +00:00
Ben Clayton 5a88ec8822 resolver: Remove error codes
We've decided that these will be omitted for now.

Move the check-spec-examples script into the tools/src directory, and update the go modules.
Add a bash script to build and run this.

Change-Id: I852f8ddb1b9b987410a2a49cf6d14e54c3cf3f0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56381
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-29 14:42:19 +00:00
Ben Clayton 230295dea4 test-runner: Don't print PASS rows by default
If a full test row PASSes, then omit this unless the --verbose flag is used.
Add a summary below the table for PASS, SKIP and FAIL for each column.

Change-Id: Ie88003696c59614cf8e5efa3c80dca37a8e4d3f0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56380
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-29 13:10:25 +00:00
Ben Clayton 433b4ec60d test: Generate more permutations for pointers
Instead of just generating pointers to functions, generate pointers to all permuted storage types and accesses.

Change-Id: I930b20150d823877eaf72dd7cac850078fe22f35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54656
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-18 18:56:13 +00:00
Ben Clayton c2c46a0533 test-runner: Consider wgsl output as validated
The resolver is the closest thing to a validator in this case.
Enables `--generate-expected` for WGSL files that were previously marked as SKIP.

Change-Id: Id7979ec39571ff52a2beb4255d88e4eb0962b82a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54650
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-17 12:53:54 +00:00
Ben Clayton d80bb9d997 tools: Improve fix-tests
Handle cases where the expected and got strings are both substrings of the test source. In this situation its better to use the longer option.

Fixes cases where fix-tests would keep on adding junk to an EXPECT_EQ string

Change-Id: I800d0d08178d01743b3587527830aefce3f3152e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54240
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-15 10:22:27 +00:00
Ben Clayton 3e59eb0e5c intrinsic_table.def: Support [[deprecated]] on fn
And produce a warning if these are used. Hard to test, as we don't want to introduce fake functions in our definition file.

Also add missing cast in EnumMatcher.

Bug: tint:806
Change-Id: I21f189e4befe419f6d5544acfc52387d9a5da782
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54001
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-10 17:31:54 +00:00
Ben Clayton 1987fd80f4 test-runner: Print results as soon as they're available
Gives feedback much eariler.

Also move the error messages after the table

Change-Id: If462fd9bbc72ff9428d6ee77c8ec6c9338f7f27e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54000
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-09 19:14:09 +00:00
Antonio Maiorano 089c9e34a5 test-runner: on Windows, use forward slash separators in paths passed to tint
This ensures that we don't fail when comparing against expected output
that contains paths in them.

Bug: tint:872
Change-Id: I93d4b940eae2c22175ef3add94bb28f907156ca0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53600
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-07 19:43:04 +00:00
Antonio Maiorano 6a665d1b85 test-runner: allow using '/' in filter on Windows, and fix using '\'
Change-Id: I635952a6c04bc305a896143333b2ae141bb6a2b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-07 14:51:22 +00:00
Ben Clayton 3db1820f0b test-runner: Don't overwrite SKIPs with --generate-expected
Unless the test also passed validation.
Prevents clobbering expected validation failures when you've only checked tint didn't error.

Change-Id: I44be0c8b1f9ef1a0df51bba81f5ad694715204b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53383
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-04 21:58:07 +00:00
Ben Clayton 93e8f527ee wgsl: Deprecate [[access]] decorations
Handle access control on var declarations instead of via [[access]]
decorations. This change does the minimal work to migrate the WGSL
parser over to the new syntax. Additional changes will be needed
to correctly generate defaulted access qualifiers, as well as
validating access usage.

The [[access]] decorations are still supported by the WGSL parser,
with new deprecated warnings, but not for aliases. Example:
   var x : [[access(x)]] alias_to_struct;

Making this work is far more effort than I want to dedicate to backwards
compatibility, and I do not beleive any real-world usage will be doing
this.

Still TODO:
* Adding access control as the optional, third parameter to ptr<>.
* Calculating default accesses for the various storage types.
* Validating usage of variables against the different accesses.

Bug: tint:846
Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:41:47 +00:00
Ben Clayton b175d91c7e test-runner: Pass a relative path to tint
Avoids absolute paths being emitted in diagnostics

Change-Id: Ic62af27e079ceac8d89735486edcaca75014b8c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53382
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:02:45 +00:00
Ben Clayton 71786c99b3 resolver: Validate pipline stage use for intrinsics
Use the new [[stage()]] decorations in intrinsics.def to validate that intrinsics are only called from the correct pipeline stages.

Fixed: tint:657
Change-Id: I9efda26369c45c6f816bdaa53408d3909db403a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53084
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-03 16:07:34 +00:00
Antonio Maiorano 0d7ea4bced Fix fileutils not working on Windows
Change-Id: Ifcda643e35bcb63c3d7a235391ba95384f7ef444
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53180
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-03 15:08:44 +00:00
Ben Clayton b07a7cead6 [tools]: Generate intrinisic test cases
Add test/intrinsics/intrinsics.wgsl.tmpl that generates a vast set of intrinsic overload permutations into test/intrinsics/gen/...

Add expected output for all of these, including 'SKIP' headers for those that currently fail.

Fixed: tint:832
Change-Id: Id6888df52c07f35e7a55199f2ad4d842c6e2595c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53051
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-03 11:26:17 +00:00
Ben Clayton 2270b434bc [tools] test-runner: Add --generate-skip flag
Generates expected cases that fail, using a SKIP header

Change-Id: I2738fa2cf47c715fe6e978edf51aa928c5e3b216
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53049
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-06-03 10:47:24 +00:00
Ben Clayton 194c58f89c intrinsics.def: Support [[stage()]] decorations on overloads
Specifies that the overload can only be used in the specific stages.
Actually validating this with the IntrinsicTable is TODO.

Bug: tint:657
Bug: tint:832
Change-Id: I11ffefee22e5f26103f008b23d16066a2a3ba90d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53050
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-06-03 09:53:34 +00:00
Ben Clayton 142143109a intrinsic-gen: Additional functionality
* Add new template utilty functions, including the ability to split out multiple files.
* Add basic printing of the semantic overloads.
* Add a pointer from the overload to the function
* Change TemplateArguments from a list of FQN to a list of interface{} (any).  This is required as once the overload is permutated, some arguments will need to hold integers.

This will be used by the test generator.

Bug: tint:832
Change-Id: Idbfbe85e52489b31850cbb0ee7430bb4b021530e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53046
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-03 09:16:14 +00:00
Ben Clayton fa9a9b5528 Support tools/src/fileutils on macos
Change-Id: Ibfb6b92f0df14822994a5c355f6d2044326f7028
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53080
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-03 08:49:04 +00:00
Ben Clayton 04bd2e8083 intrinsic-gen: Support decorations on enum entries
Add `[[internal]]` decoration on `storage_class.handle` - its not an entry that should ever appear in WGSL.

Bug: tint:832
Change-Id: I210f64c495bf37a8f48422919248806e7b096638
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53045
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-03 08:42:14 +00:00
Ben Clayton a70c14dbce main: Replace --dawn-validation with --validate
Performs output validation with spirv-val for SPIR-V (as before), HLSL
validation with DXC, and MSL validation with the Metal Shader Compiler.

Disable HLSL tests that fail to validate

Bug: tint:812
Change-Id: If78c351b4e23c7fb50d333eacf9ee7cc81d18564
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-02 21:02:34 +00:00
Ben Clayton b29a59de6e src: Reimplement IntrinsicTable from intrisics.def
Add a template file to generate intrinsic_table.inl and
include this from intrinsic_table.cc.

Speeds up execution of the unittests by 20 - 30%, and
reduces the executable size by a couple of percent.

Bug: tint:832
Change-Id: Ifa7f3c42202c92e97b46ed1716ece48660dd29dd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52504
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-06-01 19:06:31 +00:00
Ben Clayton e8177dade6 Add tools/src/lut: A lookup table with compaction
Used by the intrinsic definition generator.

Bug: tint:832
Change-Id: I000b1ebe067117e533b3edd8a3fac67a3cbc14c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52601
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 15:41:11 +00:00
Ben Clayton 131cbcc6af [tools]: Add intrinsic-gen tool
Parses the intrinsics.def file, then scans the source tree for .tmpl files.
Using both of these, it produces source files for use in tint.

Bug: tint:832
Change-Id: I718114f4c540b9d620899e89d5758f048377ee04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52642
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 09:38:30 +00:00
Ben Clayton 126adb1bbb [tools]: Minor intrinsic-gen changes
Have the resolver emit unique parameter names

Aslo: Update the parser tests to include ':' between parameter name and type.
This functionality landed a few changes up, but I missed this test from the change.

Bug: tint:832
Change-Id: If0d6d3a33bbcd8be4d70ee7182754158ed0da819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52641
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 09:07:10 +00:00
Ben Clayton 52c37f354f Add tools/src/list: A dynamic typed list
Will be used by the lookup table package, which is used by the intrinsic definition generator.

Bug: tint:832
Change-Id: I72c2dc5e37678dbaffc1a32e1631caa8ba6c690e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52600
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 19:49:50 +00:00
Ben Clayton 16e86d3225 Add cmd/intrinsic-gen resolver and sem
Part of the new intrinsic definition parser.

Bug: tint:832
Change-Id: I701072def1a4ca723d10d08b44c1e271b9458212
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-05-31 19:45:20 +00:00
Ben Clayton 3264765bc2 [tools] Move getProjectRoot() out to fileutils.
Add tests.
This is going to be used by intrinsic-gen, a new tool

Bug: tint:832
Change-Id: Ib22ffa88a699be9c8dfdf3f8f6e32cff4ffc88e3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52602
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 19:40:00 +00:00
Ben Clayton 8dd465a6f4 match/match_test.go: Fix import
This test was not building, as relative imports are not allowed when using modules

Change-Id: I661870c0d676029a782fe2a05acb98d4544fbb95
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton 6cf2fd42c5 Add cmd/intrinsic-gen parser and ast
Ground work for the new intrinsic definition parser.

Bug: tint:832
Change-Id: I0aff7f8cf5db4b6aa3a56939b944a37abc360cc7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52501
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton c95e05784d Add cmd/intrinsic-gen lexer and tokens
Ground work for the new intrinsic definition parser.

Bug: tint:832
Change-Id: I341ae11e36ef7af96ce7d01609a96e2c02425e87
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-31 09:48:48 +00:00
Ben Clayton a53a3b8c19 test-runner: Add option to limit number of threads
Fixed: tint:830
Change-Id: I46696d0f72760549743f95a35ea21fef96269146
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51924
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-21 18:02:33 +00:00
Ben Clayton c0587b6f2d test-runner: Return non-zero code on failure
Kokoro will use this to fail presubmits on new failures.

Change-Id: I32cf49d0380c7b751ae4410ccd91b20407262e9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51482
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-05-19 17:06:54 +00:00
Ben Clayton 57b2a06ba7 tools/test-all.sh: Reimplement in golang
Makes future development easier.

New features:
* A more compact and cleaner results view
* Concurrent testing, much quicker across multiple cores
* Supports comparing output against an expected file, including a text diff of differences. Also has a flag for updating the expected outputs
* Advanced file-globbing support, including scanning for files in subdirectories
* Skip lists are now no longer hidden away in the tool, but defined as a SKIP header in the *.expected.* file

Change-Id: I4fac80bb084a720ec9a307b4acf9f73792973a1d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50903
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-14 19:48:43 +00:00
Ben Clayton 54f4a21ee0 tools: Shuffle go code into an idiomatic tree
main packages usually go under a `cmd` directory.
Hoist utility packages to the root `src` directroy so they can be shared.

Change-Id: I0c221f6cd39980f5c202c030cd5134d775533efa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50901
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-05-14 18:47:33 +00:00
Ben Clayton 31d761329a tools/src: merge the two go.mod files
These are the module dependencies.
We'll never want different versions of third_party deps, so merging these makes sense.

Change-Id: If2ff93b77ad79d31a5aad04194dcf82c9782e0d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50900
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2021-05-14 16:19:03 +00:00
Ben Clayton 434cd396fe Move tools to a tools/src directory
Allows bash scripts to share the same name as the directory.

Add fix-tests bash script.

Change-Id: Iaf1943d50ec1fd3f382a2c7823fb7cdd13b1d9a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47766
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-04-16 10:42:24 +00:00