Skip to content

Commit e1164dd

Browse files
committed
address comments
1 parent 68e002b commit e1164dd

File tree

1 file changed

+54
-14
lines changed

1 file changed

+54
-14
lines changed

proposals/0039-testing-maximal-reconvergence.md

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: "0039 - Testing Maximal Reconvergence"
3-
- draft: true
2+
title: "0041 - Testing Maximal Reconvergence"
43
params:
54
authors:
65
- luciechoi: Lucie Choi
76
sponsors:
87
- s-perron: Steven Perron
98
- Keenuts: Nathan Gauër
9+
- bogner: Justin Bogner
1010
status: Under Consideration
1111
---
1212

@@ -49,9 +49,27 @@ This is the place that needs extensive testing. In the example below, a compiler
4949
may reorder the code (e.g SimplifyCFG pass) so that statements are moved
5050
inside the branches, producing incorrect results.
5151

52-
| Before Optmization | After Optimization |
53-
| --- | --- |
54-
| <pre><code>if (non_uniform_cond) {<br> doA(); <br> Out[...] = waveOperations();<br>} else {<br> doB(); <br> Out[...] = waveOperations(); <br>}<br></code></pre> | <pre><code>if (non_uniform_cond) {<br> doA(); <br>} else {<br> doB(); <br>} <br> // Invalid transformation. <br> Out[...] = waveOperations(); </code></pre> |
52+
##### Before Optimization
53+
```cpp
54+
if (non_uniform_cond) {
55+
doA();
56+
Out[...] = waveOperations();
57+
} else {
58+
doB();
59+
Out[...] = waveOperations();
60+
}
61+
```
62+
63+
##### After Optimization
64+
```cpp
65+
if (non_uniform_cond) {
66+
doA();
67+
} else {
68+
doB();
69+
}
70+
// Invalid transformation.
71+
Out[...] = waveOperations();
72+
```
5573

5674
This kind of optimization should be prevented. In DXC, spirv-opt is used to
5775
optimize when targeting Vulkan. It is aware of HLSL's
@@ -113,13 +131,13 @@ This is an [example](https://github.com/llvm/offload-test-suite/pull/685) of the
113131
test generator and the generated
114132
[tests](https://github.com/llvm/offload-test-suite/pull/620).
115133

116-
#### 1. Random shaders
134+
#### 1. (Pseudo) Random shaders
117135

118136
Random control flow will be produced by a fixed-seed RNG and hard-coded
119137
probabilities. For example, they will determine whether the next instruction
120-
will be a loop, if, switch, etc, and with what conditions. For the random number
121-
generator, we will port one from
122-
[llvm::RandomNumberGenerator](https://github.com/llvm/llvm-project/blob/8e335d533682b46289058958456c521df0c8fe32/llvm/include/llvm/Support/RandomNumberGenerator.h#L33C1-L38C42),
138+
will be a loop, if, switch, etc, and with what conditions. For the pseudo-random
139+
number generator, we will port one from
140+
[llvm::RandomNumberGenerator](https://github.com/llvm/llvm-project/blob/8e335d533682b46289058958456c521df0c8fe32/llvm/include/llvm/Support/RandomNumberGenerator.h#L33C1-L38C42),
123141
which is deterministic and operating system independent.
124142

125143
These random instructions are represented in a custom intermediate
@@ -178,9 +196,10 @@ pipeline.
178196

179197
#### CMake Target
180198

181-
We will implement a cmake target `check-hlsl-{platform}-reconvergence`, similar
182-
to the existing targets. Running this will generate the physical tests and run
183-
them.
199+
We will implement cmake targets `check-hlsl-{platform}-reconvergence`, similar
200+
to the existing targets. Running this command will generate the physical tests
201+
and execute them. We will separate cmake targets for writing the tests so that
202+
the tests will not be regenerated every time the tests are run.
184203

185204
#### Github Workflow
186205

@@ -193,7 +212,7 @@ New steps will be added to the existing workflow at the end:
193212
- **Run Reconvergence Tests**
194213

195214
This way, the execution of existing HLSL tests and the reconvergence tests are
196-
separated.
215+
separated so that it will be easiser to report and investigate issues.
197216

198217
We don't plan to store the physical test files in the repo. Developers can still
199218
save, run, and inspect the tests locally by running the target in their machine.
@@ -205,7 +224,28 @@ We will segment the output buffer and verification into multiple buffers and
205224
checks or implment an environment variable to filter out some logs.
206225

207226
If any test fails, it will fail the workflow, so it's noticeable in the badge.
208-
`XFail` instructions will be added appropriately to suppress failures.
227+
228+
`XFail` instructions will be added appropriately to suppress failures. Since it
229+
is undesirable to change the code of the C++ random test generator every time
230+
failure happens, the test generator may read a structured text file that
231+
contains a list of failing tests and their environments. This way, only this
232+
single file will be updated upon any changes in the compilers, and the algorithm
233+
for generating the tests remains intact.
234+
235+
*reconvergence-failing-tests.txt*
236+
```yaml
237+
reconvergence-test_2_16_7_13_3.test
238+
# Some comment
239+
# XFAIL: Clang && Vulkan
240+
241+
# Some comment
242+
# XFAIL: ...
243+
244+
reconvergence-test_5_32_7_13_1.test
245+
# Some comment
246+
# XFAIL: ...
247+
248+
```
209249

210250
### Latency
211251

0 commit comments

Comments
 (0)