================
@@ -219,44 +348,49 @@ examined at `Y`.
```c++
void bar() {
- asyncmark(); // B
- asyncmark(); // C
- ... // no asyncmark()
- wait.asyncmark(0); // Y
+ asyncmark(0); // B
+ asyncmark(0); // C
+ ... // no asyncmark()
+ wait.asyncmark(0, 0); // Y
...
- wait.asyncmark(1); // D
+ wait.asyncmark(1, 0); // D
}
```
After inlining, both `B` and `C` are *completed-at* `Y`.
### Optimization
-The implementation may eliminate asyncmark/wait intrinsics in the following
-cases. These are just examples and not meant to be an exhaustive list.
+The implementation may eliminate/modify asyncmark/wait intrinsics in the
+following cases. These are just examples and not meant to be an exhaustive
list.
-1. An `asyncmark` operation which remains in the current sequence along every
+1. An `asyncmark` operation which remains in a current sequence along every
path that reaches the function exit.
```c++
void foo() {
...
- asyncmark(); // X
- ... // no wait.asyncmark()
+ asyncmark(0); // X
+ ... // no wait.asyncmark()
}
```
- Here, `X` can be eliminated.
+ Here, the zero mask names every stage, and each independent mark remains, so
+ the entire mark `X` can be eliminated. If only some sequences qualified,
then
+ the `asyncmark` operation could be modified to remove just those stages from
+ its mask.
2. A `wait.asyncmark` which sees an empty sequence of asyncmarks along every
path that reaches it.
```c++
void foo() {
- ... // no asyncmark()
- wait.asyncmark(0); // Y
+ ... // no asyncmark()
+ wait.asyncmark(0, 0); // Y
...
}
```
- Here, `Y` can be eliminated.
+ Here, as with `X` above, every sequence qualifies, so `Y` can be eliminated.
+ If only some sequences qualified, the `wait.asyncmark` could be modified to
+ only wait for the relevant stages.
----------------
RyanRio wrote:
3. An `asyncmark` operation that has mask bits that don't refer to any
instruction.
```c++
void foo() {
...
global_load_async_to_lds
asyncmark(0)
...
}
```
Here, the program can be refined to -
```c++
void foo() {
...
global_load_async_to_lds
asyncmark(ASYNC_LOAD_LDS)
...
}
```
Since only that particular stage is actually relevant to ensuring the
completion of async operations.
---
Btw I was just saying that I didn't think it was necessary, not that I was
asking you to implement it yourself @krzysz00 😂 but anyway, I relent.
https://github.com/llvm/llvm-project/pull/220442
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits