Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from gpuweb:main #11

Merged
merged 166 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
3acbf58
wgsl: f16 built-in execution test for bitcast (#2897)
jiangzhaoming Aug 22, 2023
4fc7483
Remove TODO about f32(-0.0) printing as '-0.0f' (#2903)
dneto0 Aug 22, 2023
2ee990a
Prevent details toggle if user is selecting text (#2906)
greggman Aug 22, 2023
5dfa3b8
Fix handling of batches in case filtering (#2908)
kainino0x Aug 23, 2023
75c5460
wgsl: Add execution tests for AF negation (#2909)
zoddicus Aug 28, 2023
a0dcafc
Revert "wgsl: Add execution tests for AF negation (#2909)" (#2912)
austinEng Aug 29, 2023
7f4eced
Don't color tests which have not been run as skipped (#2910)
greggman Aug 29, 2023
03819a5
Remove orientation from several texture copy tests (#2914)
toji Aug 29, 2023
4c8d2f6
Add `generate-cache` step to `grunt pre`
ben-clayton Sep 5, 2023
d2b2bad
Update fp_primer.md
ben-clayton Sep 4, 2023
d8c45b2
Reland AF negation tests: (#2920)
zoddicus Sep 5, 2023
4f3574d
Compat: Skip if copyTextureToTexture not supported (#2923)
greggman Sep 5, 2023
8ca48c8
wgsl: f16 built-in execution test for clamp (#2918)
jiangzhaoming Sep 6, 2023
ef82e7b
wgsl: f16 built-in execution test for sign and step (#2911)
jiangzhaoming Sep 6, 2023
23cdd20
wgsl: Implement scalar/vector AbstractFloat addition execution tests …
zoddicus Sep 6, 2023
7f1e5af
wgsl: f16 built-in execution test for frexp (#2925)
jiangzhaoming Sep 8, 2023
0126724
Implements filtering tests for mag/min/mipmapFilters with additional …
lokokung Sep 9, 2023
a8f254a
Allow unused variables starting with underscore
kainino0x Jun 16, 2023
da1527d
websocket-logger tool
kainino0x Jun 16, 2023
f42aeb4
Check that if the test is skipped, all subcases are skipped
kainino0x Jun 17, 2023
691e6b4
Tools for generating timing metadata and auto-chunking WPT
kainino0x Sep 8, 2023
76e56df
Add generated metadata for webgpu:*
kainino0x Sep 8, 2023
05e32a6
wgsl: Add f16 negation execution tests (#2927)
zoddicus Sep 11, 2023
90edae1
Fix presubmits (`npm test`)
ben-clayton Sep 11, 2023
f0044b9
Compat: Test vertex_index, instance_index limits (#2940)
greggman Sep 11, 2023
0b49ea7
wgsl: Add AbstractFloat matrix addition execution tests (#2926)
zoddicus Sep 12, 2023
7536133
Add documentation for adding timing metadata (#2942)
zoddicus Sep 12, 2023
18468be
wgsl: Add non-matrix AbstractFloat subtraction execution tests (#2928)
zoddicus Sep 12, 2023
fd0cf88
wgsl: Add AbstractFloat matrix subtraction execution tests (#2929)
zoddicus Sep 12, 2023
69a2c92
wgsl: Add AbstractFloat simple multiplication execution tests (#2930)
zoddicus Sep 12, 2023
679ea4c
wgsl: Add AbstractFloat `abs` execution tests (#2932)
zoddicus Sep 13, 2023
04cd7b8
Update websocket-logger instructions to use `npm ci` (#2947)
zoddicus Sep 13, 2023
3a5f789
Compat: Limit max attributes (#2953)
greggman Sep 14, 2023
ac6a70e
Split up 'scalar' tests into 'scalar' and 'vector' tests (#2946)
zoddicus Sep 14, 2023
4673f2f
wgsl: Add AbstractFloat `trunc` execution tests (#2948)
zoddicus Sep 14, 2023
732f9b5
wgsl: Add f16 `trunc` execution tests (#2949)
zoddicus Sep 14, 2023
abe8df9
wgsl: Add f16 `transpose` execution tests (#2951)
zoddicus Sep 14, 2023
edbf5a0
wgsl: Add AbstractFloat `transpose` execution tests (#2952)
zoddicus Sep 14, 2023
b178e35
Add a copy button (#2958)
greggman Sep 14, 2023
bc76dac
wgsl: Add f16 remainder (`%`) execution tests (#2950)
zoddicus Sep 14, 2023
301143f
wgsl: Add f16 `radians` execution tests (#2959)
zoddicus Sep 14, 2023
98aefef
wgsl: Add AbstractFloat `radians` execution tests (#2960)
zoddicus Sep 14, 2023
afb4f6f
wgsl: f16 execution test for binary matrix expression and built-in do…
jiangzhaoming Sep 14, 2023
617369d
wgsl: Add f16 `degrees` execution tests (#2961)
zoddicus Sep 14, 2023
b4dfdd2
Compat: Limit draw test attributes in compat (#2954)
greggman Sep 14, 2023
d70a32b
wgsl: Add AbstractFloat `degree` execution tests (#2962)
zoddicus Sep 16, 2023
be1210e
wgsl: f16 execution test for built-in exp and exp2 (#2963)
jiangzhaoming Sep 19, 2023
cff8019
wgsl: Add f16 `saturate` tests (#2964)
zoddicus Sep 19, 2023
808711e
wgsl: F16 unary conversion expression execution tests (#2965)
jiangzhaoming Sep 20, 2023
3c422eb
wgsl: Add interval names to unimplemented bindings (#2967)
zoddicus Sep 20, 2023
86e342f
wgsl: Add AbstractFloat `max` execution tests (#2971)
zoddicus Sep 20, 2023
efed3d8
wgsl: Add AbstractFloat `min` execution tests (#2972)
zoddicus Sep 20, 2023
52981ae
wgsl: Add AbstractFloat `clamp` execution tests (#2973)
zoddicus Sep 20, 2023
782e79f
wgsl: Add AbstractFloat `saturate` execution tests (#2974)
zoddicus Sep 20, 2023
a3cd755
wgsl: Add f16 `cross` execution tests (#2975)
zoddicus Sep 20, 2023
718a9ed
wgsl: Add AbstractFloat `cross` execution tests (#2976)
zoddicus Sep 20, 2023
b6cd07c
wgsl: f16 to bool/i32/u32 conversion expression execution tests (#2977)
jiangzhaoming Sep 21, 2023
b1a998f
wgsl: F16 execution tests for built-in length and distance (#2979)
jiangzhaoming Sep 21, 2023
c295665
Show parseQuery error (#2982)
greggman Sep 21, 2023
30c129e
Change generate-cache to validate-cache (#2981)
zoddicus Sep 25, 2023
0447990
Convert specifying complex case combos to map-reduce generation (#2984)
zoddicus Sep 25, 2023
5c10bd2
Compat: Refactor vertex_state tests for new limits (#2988)
greggman Sep 25, 2023
a50d090
Compat: Make createBindGroup test handle different limits (#2994)
greggman Sep 25, 2023
257cc42
Compat: Make createBindGroupLayout tests handle different limits (#2995)
greggman Sep 25, 2023
db357a2
Compat: make basic compute test handle different limits (#3001)
greggman Sep 25, 2023
28733c0
Compat: make requestDevice tests handle different limits
greggman Sep 25, 2023
62382d0
Compat: make maxColorAttachments test handle different limits
greggman Sep 25, 2023
5ab05f9
Compat: Refactor limits utils for compat limits
greggman Sep 25, 2023
bbddf3a
Compat: make buffer create test handle different limits (#3005)
greggman Sep 25, 2023
b62d1b8
Compat: make vertex state correctness tests handle different limits
greggman Sep 25, 2023
95855c1
add skipIf to Fixture
greggman Sep 26, 2023
6d6e7c9
Compat: make attachment compatibility test handle different limits
greggman Sep 25, 2023
bc9f282
util: Add negative zero in full F16/F32/F64 range (#2978)
jiangzhaoming Sep 26, 2023
7b1b8e8
wgsl: add f16 execution test for builtin normalize (#2985)
jiangzhaoming Sep 26, 2023
ca67842
wgsl: add f16 execution test for builtin tan (#2987)
jiangzhaoming Sep 26, 2023
fdbc673
wgsl: add f16 execution test for builtin smoothstep (#2989)
jiangzhaoming Sep 26, 2023
c799cfd
wgsl: add f16 execution test for builtin fma (#2990)
jiangzhaoming Sep 26, 2023
b09db5c
wgsl: f32 execution tests for builtin mix with non-matching parameter…
jiangzhaoming Sep 26, 2023
d9760bd
wgsl: add f16 execution test for builtin pow (#2986)
jiangzhaoming Sep 26, 2023
121e671
wgsl: add f16 builtin mix execution test (#2992)
jiangzhaoming Sep 26, 2023
8e6c5ac
Compat: Make setBindGroup tests handle different limits
greggman Sep 25, 2023
a55f58e
Compat: make device allocation test handle different limits
greggman Sep 25, 2023
206d3fb
Compat: Make setVertexBuffer test handle different limits
greggman Sep 25, 2023
cd6bc78
Compat: Make compute pass tests handle different limits
greggman Sep 25, 2023
ee7ac55
wgsl: Add AbstractFloat `fma` execution tests (#2996)
zoddicus Sep 26, 2023
af8a364
Compat: make maxXXXBufferBindingSize tests handle different limits
greggman Sep 25, 2023
055b78e
Compat: make maxDynamicXXX tests handle different limits
greggman Sep 25, 2023
3b3b222
add computeBytesPerSample helpers
greggman Sep 26, 2023
369bb8b
Compat: make pipline-output-targets tests handle different limits
greggman Sep 26, 2023
1120e90
Compat: make render pass descriptor tests handle different limits
greggman Sep 25, 2023
37ff0cb
Compat: make maxComputeInvocationsPerWorkgroup test handle different …
greggman Sep 25, 2023
47fd41c
wgsl: add f16 execution test for builtin sinh/cosh/tanh/asinh/acosh/a…
jiangzhaoming Sep 27, 2023
245e263
wgsl: add f16 builtin execution test for determinant (#3013)
jiangzhaoming Sep 27, 2023
43a704e
wgsl: add f16 builtin execution test for reflect and refract (#3014)
jiangzhaoming Sep 27, 2023
04a32ac
wgsl: add f16 builtin execution test for faceForward (#3015)
jiangzhaoming Sep 27, 2023
0dc8224
wgsl: refactor and add f16 execution test for builtin ldexp (#3018)
jiangzhaoming Sep 27, 2023
c2d24f1
wgsl: add f16 execution test for builtin fract (#3017)
jiangzhaoming Sep 27, 2023
cbe0d92
unittest: FP use correctly rounded dict for frequent number constant …
jiangzhaoming Sep 27, 2023
a3eaacd
wgsl: Add f16 `modf` execution tests (#3019)
zoddicus Sep 27, 2023
00859ea
wgsl: Add AbstractFloat `modf` execution tests (#3020)
zoddicus Sep 27, 2023
8ac2411
Add rgb10a2uint GPUTextureFormat testing. (#2956)
Kangz Sep 27, 2023
1013973
Compat: Skip copyTextureToTexture for compressed textures
greggman Sep 27, 2023
e61392d
Revert "util: Add negative zero in full F16/F32/F64 range (#2978)" (#…
amaiorano Sep 27, 2023
6442db8
Re-organize numeric constants to be consistent (#3025)
zoddicus Sep 28, 2023
a5638d6
Update subcaseMS of web_platform,copyToTexture,ImageBitmap (#3023)
jiangzhaoming Sep 28, 2023
cb86cd2
Compat: make fragment_state test handle different limits
greggman Sep 27, 2023
fc217e3
Compat: make perStageLimit tests handle different limits
greggman Sep 28, 2023
2b55623
Compat: Make createTexture tests handle different limits
greggman Sep 25, 2023
48b29a1
Fix Skip/Pass Issues
greggman Sep 28, 2023
9f71351
Compat: make createRenderBundleEncoder test handle different limits
greggman Sep 27, 2023
8f210ed
Compat: make device_pool not refer to kLimitInfo
greggman Sep 27, 2023
f2b59e0
Remove limit constants
greggman Sep 29, 2023
1889b53
Add unorm10-10-10-2 vertex format (#2941)
beaufortfrancois Oct 2, 2023
03df5bf
wgsl: Add f16 validation tests for bistcast from bad const (#3034)
jiangzhaoming Oct 2, 2023
609645e
unittest: Fix/add f16 cases for data cache serialization unittest (#3…
jiangzhaoming Oct 2, 2023
d253683
shader/execution/memory_model: test f16 adjacent writes (#3038)
dneto0 Oct 2, 2023
46e0a48
Compat: Skip unsupported texture operations
greggman Oct 3, 2023
e2763fb
Fix atan and tan validation tests (#3041)
amaiorano Oct 4, 2023
17c90bc
Revert "Fix Skip/Pass Issues" (#3043)
amaiorano Oct 4, 2023
4619a2b
gen_cache: Add --nth flag
ben-clayton Oct 5, 2023
b0ea37d
wgsl: Optimize memory allocations when quantizing data (#3052)
zoddicus Oct 5, 2023
202bdde
Compat: make zero_init tests handle different limits
greggman Oct 4, 2023
812ebaf
Compat: Fix attachment_compatibility color_count tests for limits
greggman Oct 4, 2023
db80cf2
Compat: skip unsupported formats in filter mode tests
greggman Oct 4, 2023
8bb4827
Make Pass > Skip (#3054)
greggman Oct 6, 2023
08a4f17
[Reland] util: Add negative zero in full F16/F32/F64 range (#3060)
jiangzhaoming Oct 10, 2023
4e91a54
memory_model: Add f16 to barrier tests (#3055)
dneto0 Oct 10, 2023
56e1a2e
wgsl: show output values in flow_control exec tests error messages (#…
jiangzhaoming Oct 13, 2023
0a01f38
wgsl: Correctly invoke multiplicationInterval instead impl directly (…
zoddicus Oct 16, 2023
cbd7ed8
Move listing_meta docs to docs/, clarify a few things (#3064)
kainino0x Oct 16, 2023
42f3da8
wgsl: Use sparse version of kMinus3PiTo3Pi for atan2 validation tests…
zoddicus Oct 16, 2023
b3cefa6
Require depthWriteEnabled and depthCompare only for formats with dept…
beaufortfrancois Oct 17, 2023
6696b0e
wgsl: make expectation id strat from 1 in flow_control exec tests (#3…
jiangzhaoming Oct 17, 2023
c78f0a4
Add compat moode support to cmdline.ts and server.ts
greggman Oct 18, 2023
e5e7ee1
wgsl: Implement validation test for parsing f16 literal (#3059)
jiangzhaoming Oct 20, 2023
c2d5b05
wgsl: Add AF Division execution tests (#3074)
zoddicus Oct 23, 2023
2757809
wgsl: Add AF remainder (%) execution tests (#3075)
zoddicus Oct 23, 2023
3148e15
wgsl: Add AF `select` execution tests (#3077)
zoddicus Oct 23, 2023
2499ea9
wgsl: Add AbstractFloat `sign` execution tests (#3081)
zoddicus Oct 23, 2023
b3c2508
Fix a bad slice operation in image_copy stencil tests
toji Oct 23, 2023
3fe36f2
Run grunt fix
toji Oct 23, 2023
d491499
wgsl: Add AbstractFloat `floor` execution tests (#3084)
zoddicus Oct 24, 2023
73bcf42
depthCompare is not required for depth attachments if not used (#3069)
beaufortfrancois Oct 24, 2023
7991cc7
Fix a minor issue introduced in previous stencil test fix (#3086)
toji Oct 24, 2023
8e7a995
Remove pipeline statistics query feature (#3085)
beaufortfrancois Oct 24, 2023
b929ebb
wgsl: Revert changes to `round` execution tests (#3090)
zoddicus Oct 24, 2023
2405593
wgsl: Filter `atan2` tests based on if const-eval or not (#3089)
zoddicus Oct 25, 2023
199c8f1
wgsl: Cleanup cruft related to quantizeToF16 (#3082)
zoddicus Oct 25, 2023
1281ee1
Add back generate-cache grunt command (#3091)
amaiorano Oct 25, 2023
42e6b6d
Slim down on typed array allocations in conversion.ts (#3092)
austinEng Oct 25, 2023
2be0e90
Remove duplicate definitions of reinterpret* (#3095)
austinEng Oct 25, 2023
e5f120e
Fixes flaky test because parameters were changed when the test was ra…
lokokung Oct 25, 2023
f3196f8
Make test params readonly so they can't be accidentally permanently m…
kainino0x Oct 26, 2023
6e21caa
Replace JSON case cache serialization with binary files
ben-clayton Oct 25, 2023
250e583
tsdoc: Remove @p with backticks
ben-clayton Oct 26, 2023
ba9e5d6
More cache deserialization micro-optimisations
ben-clayton Oct 26, 2023
aa7ab4f
wgsl: Speed up `ldexp` execution tests (#3101)
zoddicus Oct 26, 2023
36a23bf
Use largest maxInterStageShaderVariables in maxInterStageShaderCompon…
Jiawei-Shao Oct 27, 2023
2ef3f32
BinaryStream: Use little endian for f64
ben-clayton Oct 27, 2023
3dbe4ce
Add missing tests for adapter capability guarantees (#3107)
beaufortfrancois Oct 30, 2023
ef5d229
Test that DOMExceptions from WebGPU always have stacks (#3105)
kainino0x Oct 31, 2023
ccee5a9
dev_server: Serve on localhost by default (#3115)
kainino0x Oct 31, 2023
fc58db8
wgsl: Convert `quantizeToF16` to used `hfround` (#3118)
zoddicus Oct 31, 2023
cb5b33c
wgsl: Convert `quantizeToF32` to used `Math.fround` (#3119)
zoddicus Oct 31, 2023
2f3b68c
Fix cache files being padded with trailing 0's
ben-clayton Oct 31, 2023
ab09ed4
wgsl: Convert `quantizeToI32/U32` to used `Math.trunc` (#3120)
zoddicus Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
"@typescript-eslint/no-unused-vars": [
"warn",
{ "vars": "all", "args": "none", "varsIgnorePattern": "^_" }
],
"@typescript-eslint/prefer-as-const": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-namespace-keyword": "warn",
Expand Down
14 changes: 12 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ module.exports = function (grunt) {
cmd: 'node',
args: ['tools/validate', 'src/webgpu', 'src/stress', 'src/manual', 'src/unittests', 'src/demo'],
},
'validate-cache': {
cmd: 'node',
args: ['tools/gen_cache', 'out', 'src/webgpu', '--validate'],
},
'generate-wpt-cts-html': {
cmd: 'node',
args: ['tools/gen_wpt_cts_html', 'out-wpt/cts.https.html', 'src/common/templates/cts.https.html'],
args: ['tools/gen_wpt_cts_html', 'tools/gen_wpt_cfg_unchunked.json'],
},
'generate-wpt-cts-html-chunked2sec': {
cmd: 'node',
args: ['tools/gen_wpt_cts_html', 'tools/gen_wpt_cfg_chunked2sec.json'],
},
'generate-cache': {
cmd: 'node',
args: ['tools/gen_cache', 'out/data', 'src/webgpu'],
args: ['tools/gen_cache', 'out', 'src/webgpu'],
},
unittest: {
cmd: 'node',
Expand Down Expand Up @@ -181,6 +189,7 @@ module.exports = function (grunt) {
'copy:out-wpt-generated',
'copy:out-wpt-htmlfiles',
'run:generate-wpt-cts-html',
'run:generate-wpt-cts-html-chunked2sec',
]);
grunt.registerTask('build-done-message', () => {
process.stderr.write('\nBuild completed! Running checks/tests');
Expand All @@ -189,6 +198,7 @@ module.exports = function (grunt) {
registerTaskAndAddToHelp('pre', 'Run all presubmit checks: standalone+wpt+typecheck+unittest+lint', [
'clean',
'run:validate',
'run:validate-cache',
'build-standalone',
'run:generate-listings',
'build-wpt',
Expand Down
163 changes: 163 additions & 0 deletions docs/adding_timing_metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Adding Timing Metadata

## listing_meta.json files

`listing_meta.json` files are SEMI AUTO-GENERATED.

The raw data may be edited manually, to add entries or change timing values.

The **list** of tests must stay up to date, so it can be used by external
tools. This is verified by presubmit checks.

The `subcaseMS` values are estimates. They can be set to 0 if for some reason
you can't estimate the time (or there's an existing test with a long name and
slow subcases that would result in query strings that are too long), but this
will produce a non-fatal warning. Avoid creating new warnings whenever
possible. Any existing failures should be fixed (eventually).

### Performance

Note this data is typically captured by developers using higher-end
computers, so typical test machines might execute more slowly. For this
reason, the WPT chunking should be configured to generate chunks much shorter
than 5 seconds (a typical default time limit in WPT test executors) so they
should still execute in under 5 seconds on lower-end computers.

## Problem

When adding new tests to the CTS you may occasionally see an error like this
when running `npm test` or `npm run standalone`:

```
ERROR: Tests missing from listing_meta.json. Please add the new tests (set subcaseMS to 0 if you cannot estimate it):
webgpu:shader,execution,expression,binary,af_matrix_addition:matrix:*

/home/runner/work/cts/cts/src/common/util/util.ts:38
throw new Error(msg && (typeof msg === 'string' ? msg : msg()));
^
Error:
at assert (/home/runner/work/cts/cts/src/common/util/util.ts:38:11)
at crawl (/home/runner/work/cts/cts/src/common/tools/crawl.ts:155:11)
Warning: non-zero exit code 1
Use --force to continue.

Aborted due to warnings.
```

What this error message is trying to tell us, is that there is no entry for
`webgpu:shader,execution,expression,binary,af_matrix_addition:matrix:*` in
`src/webgpu/listing_meta.json`.

These entries are estimates for the amount of time that subcases take to run,
and are used as inputs into the WPT tooling to attempt to portion out tests into
approximately same-sized chunks.

If a value has been defaulted to 0 by someone, you will see warnings like this:

```
...
WARNING: subcaseMS≤0 found in listing_meta.json (allowed, but try to avoid):
webgpu:shader,execution,expression,binary,af_matrix_addition:matrix:*
...
```

These messages should be resolved by adding appropriate entries to the JSON
file.

## Solution 1 (manual, best for simple tests)

If you're developing new tests and need to update this file, it is sometimes
easiest to do so manually. Run your tests under your usual development workflow
and see how long they take. In the standalone web runner `npm start`, the total
time for a test case is reported on the right-hand side when the case logs are
expanded.

Record the average time per *subcase* across all cases of the test (you may need
to compute this) into the `listing_meta.json` file.

## Solution 2 (semi-automated)

There exists tooling in the CTS repo for generating appropriate estimates for
these values, though they do require some manual intervention. The rest of this
doc will be a walkthrough of running these tools.

Timing data can be captured in bulk and "merged" into this file using
the `merge_listing_times` tool. This is useful when a large number of tests
change or otherwise a lot of tests need to be updated, but it also automates the
manual steps above.

The tool can also be used without any inputs to reformat `listing_meta.json`.
Please read the help message of `merge_listing_times` for more information.

### Placeholder Value

If your development workflow requires a clean build, the first step is to add a
placeholder value for entry to `src/webgpu/listing_meta.json`, since there is a
chicken-and-egg problem for updating these values.

```
"webgpu:shader,execution,expression,binary,af_matrix_addition:matrix:*": { "subcaseMS": 0 },
```

(It should have a value of 0, since later tooling updates the value if the newer
value is higher.)

### Websocket Logger

The first tool that needs to be run is `websocket-logger`, which receives data
on a WebSocket channel to capture timing data when CTS is run. This
should be run in a separate process/terminal, since it needs to stay running
throughout the following steps.

In the `tools/websocket-logger/` directory:

```
npm ci
npm start
```

The output from this command will indicate where the results are being logged,
which will be needed later. For example:

```
...
Writing to wslog-2023-09-12T18-57-34.txt
...
```

### Running CTS

Now we need to run the specific cases in CTS that we need to time.
This should be possible under any development workflow (as long as its runtime environment, like Node, supports WebSockets), but the most well-tested way is using the standalone web runner.

This requires serving the CTS locally. In the project root:

```
npm run standalone
npm start
```

Once this is started you can then direct a WebGPU enabled browser to the
specific CTS entry and run the tests, for example:

```
http://localhost:8080/standalone/?q=webgpu:shader,execution,expression,binary,af_matrix_addition:matrix:*
```

If the tests have a high variance in runtime, you can run them multiple times.
The longest recorded time will be used.

### Merging metadata

The final step is to merge the new data that has been captured into the JSON
file.

This can be done using the following command:

```
tools/merge_listing_times webgpu -- tools/websocket-logger/wslog-2023-09-12T18-57-34.txt
```

where the text file is the result file from websocket-logger.

Now you just need to commit the pending diff in your repo.
44 changes: 22 additions & 22 deletions docs/fp_primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ reference, see
[binary64 on Wikipedia](https://en.wikipedia.org/wiki/Double-precision_floating-point_format),
[binary32 on Wikipedia](https://en.wikipedia.org/wiki/Single-precision_floating-point_format),
and
[binar16 on Wikipedia](https://en.wikipedia.org/wiki/Half-precision_floating-point_format).
[binary16 on Wikipedia](https://en.wikipedia.org/wiki/Half-precision_floating-point_format).

In the floating points formats described above, there are two possible zero
values, one with all bits being 0, called positive zero, and one all the same
Expand Down Expand Up @@ -144,7 +144,7 @@ This concept of near-overflow vs far-overflow divides the real number line into
| -∞ < `x` <= `-(2 ** (exp_max + 1))` | must round to -∞ |
| `-(2 ** (exp_max + 1))` < `x` <= min fp value | must round to -∞ or min value |
| min fp value < `x` < max fp value | round as discussed below |
| min fp value <= `x` < `2 ** (exp_max + 1)` | must round to max value or ∞ |
| max fp value <= `x` < `2 ** (exp_max + 1)` | must round to max value or ∞ |
| `2 ** (exp_max + 1))` < `x` | implementations must round to ∞ |


Expand Down Expand Up @@ -184,7 +184,7 @@ operations.
Operations, which can be thought of as mathematical functions, are mappings from
a set of inputs to a set of outputs.

Denoted `f(x, y) = X`, where f is a placeholder or the name of the operation,
Denoted `f(x, y) = X`, where `f` is a placeholder or the name of the operation,
lower case variables are the inputs to the function, and uppercase variables are
the outputs of the function.

Expand All @@ -208,7 +208,7 @@ Some examples of different types of operations:
`multiplication(x, y) = X`, which represents the WGSL expression `x * y`, takes
in floating point values, `x` and `y`, and produces a floating point value `X`.

`lessThen(x, y) = X`, which represents the WGSL expression `x < y`, again takes
`lessThan(x, y) = X`, which represents the WGSL expression `x < y`, again takes
in floating point values, but in this case returns a boolean value.

`ldexp(x, y) = X`, which builds a floating point value, takes in a floating
Expand Down Expand Up @@ -406,9 +406,9 @@ In more precise terms:

X = [min(f(x)), max(f(x))]
X = [min(f([a, b])), max(f([a, b]))]
X = [f(m), f(M)]
X = [f(m), f(n)]
```
where m and M are in `[a, b]`, `m <= M`, and produce the min and max results
where `m` and `n` are in `[a, b]`, `m <= n`, and produce the min and max results
for `f` on the interval, respectively.

So how do we find the minima and maxima for our operation in the domain?
Expand Down Expand Up @@ -499,15 +499,15 @@ literally pages of expanded intervals.

sin(π/2) => [sin(π/2) - 2 ** -11, sin(π/2) + 2 ** -11]
=> [0 - 2 ** -11, 0 + 2 ** -11]
=> [-0.000488.., 0.000488...]
=> [-0.000488, 0.000488]
cos(π/2) => [cos(π/2) - 2 ** -11, cos(π/2) + 2 ** -11]
=> [-0.500488, -0.499511...]
=> [-0.500488, -0.499511]

tan(π/2) => sin(π/2)/cos(π/2)
=> [-0.000488.., 0.000488...]/[-0.500488..., -0.499511...]
=> [min({-0.000488.../-0.500488..., -0.000488.../-0.499511..., ...}),
max(min({-0.000488.../-0.500488..., -0.000488.../-0.499511..., ...}) ]
=> [0.000488.../-0.499511..., 0.000488.../0.499511...]
=> [-0.000488, 0.000488]/[-0.500488, -0.499511]
=> [min(-0.000488/-0.500488, -0.000488/-0.499511…, 0.000488…/-0.500488…, 0.000488…/-0.499511…),
max(-0.000488/-0.500488, -0.000488/-0.499511…, 0.000488…/-0.500488…, 0.000488…/-0.499511…)]
=> [0.000488/-0.499511, 0.000488/0.499511]
=> [-0.0009775171, 0.0009775171]
```

Expand Down Expand Up @@ -553,10 +553,10 @@ These are compile vs run time, and CPU vs GPU. Broadly speaking compile time
execution happens on the host CPU, and run time evaluation occurs on a dedicated
GPU.

(SwiftShader technically breaks this by being a software emulation of a GPU that
runs on the CPU, but conceptually one can think of SwiftShader has being a type
of GPU in this context, since it has similar constraints when it comes to
precision, etc.)
(Software graphics implementations like WARP and SwiftShader technically break this by
being a software emulation of a GPU that runs on the CPU, but conceptually one can
think of these implementations being a type of GPU in this context, since it has
similar constraints when it comes to precision, etc.)

Compile time evaluation is execution that occurs when setting up a shader
module, i.e. when compiling WGSL to a platform specific shading language. It is
Expand Down Expand Up @@ -588,18 +588,18 @@ let c: f32 = a + b
and
```
// compile time
const c: f32 = 1 + 2
const c: f32 = 1.0f + 2.0f
```
should produce the same result of `3` in the variable `c`, assuming `1` and `2`
were passed in as `a` & `b`.
should produce the same result of `3.0` in the variable `c`, assuming `1.0` and `2.0`
were passed in as `a` and `b`.

The only difference, is when/where the execution occurs.

The difference in behaviour between these two occur when the result of the
operation is not finite for the underlying floating point type.

If instead of `1` and `2`, we had `10` and `f32.max`, so the true result is
`f32.max + 10`, the user will see a difference. Specifically the runtime
If instead of `1.0` and `2.0`, we had `10.0` and `f32.max`, so the true result is
`f32.max + 10.0`, the behaviours differ. Specifically the runtime
evaluated version will still run, but the result in `c` will be an indeterminate
value, which is any finite f32 value. For the compile time example instead,
compiling the shader will fail validation.
Expand All @@ -611,7 +611,7 @@ execution.

Unfortunately we are dealing with intervals of results and not precise results.
So this leads to more even conceptual complexity. For runtime evaluation, this
isn't too bad, because the rule becomes if any part of the interval is
isn't too bad, because the rule becomes: if any part of the interval is
non-finite then an indeterminate value can be a result, and the interval for an
indeterminate result `[fp min, fp max]`, will include any finite portions of the
interval.
Expand Down
19 changes: 9 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/pngjs": "^6.0.1",
"@types/serve-index": "^1.9.1",
"@typescript-eslint/parser": "^4.33.0",
"@webgpu/types": "gpuweb/types#ca1a548178567e6021fd194380b97be1bf6b07b7",
"@webgpu/types": "^0.1.38",
"ansi-colors": "4.1.1",
"babel-plugin-add-header-comment": "^1.0.3",
"babel-plugin-const-enum": "^1.2.0",
Expand Down
Loading