[mlir][linalg] Split elementwise ops with concat inputs (#213630)
Close https://github.com/llvm/llvm-project/issues/213216
This patch tries to reorder patterns like elementwise(concat(x0, x1),
concat(y0, y1)) into concat(elementwise(x0, y0), elementwise(x1, y1)).
The transformation itself is not an optimization. But it will make the
elementwise op to be closer with the data so that the optimizer may find
more optimization oppotunities. See the above patch for an example.
For simplicity, this patch only handle cases for all concats have the
same number of inputs and the size of inputs in the concat dimension to
be the same. We also don't handle linalg.index. And if the inputs of the
elementwise op has other inputs than concat, which is not a scalar, may
be rejected too. We can relax these limitations in the future.
To make the implementation more uniform, we only handles elementwise
like linalg.generic. The elementwise op will be transoformed into
linalg.generic after -convert-elementwise-to-linalg. So the
[7 lines not shown]
[DWARFLinker] Walk each shared subtree's dependencies once (#218072)
cdc31cfa66f0 made every root that references an already-marked subtree
re-walk that subtree to record the completeness dependencies it
contributes, which is what makes the recorded dependency set complete
and independent of thread interleaving. That walk replaced the
isAlreadyMarked short-circuit which had kept marking linear, so a widely
shared subtree is re-parsed and re-resolved once per referencing root.
Linking a RelWithDebInfo clang went from 27s to 67s of wall time and
from 242s to 1447s of CPU, peak memory grew from 35GB to 63GB, and 7.0
billion dependencies were recorded for an unchanged dSYM.
Record only that a root carries the subtree's dependencies and walk each
distinct subtree once. All of a subtree's dependencies demote the same
root, so the expansion stops at the first one that does.
A subtree contributes two kinds of dependency. One kind is recorded
under the root referencing the subtree, varies with that root, and is
[22 lines not shown]
[Clang] Fix -Wunused-parameter for implicit coroutine uses (#217518)
Clang's coroutine semantic analysis builds references to coroutine
parameters
while looking up a class-specific allocation function. When overload
resolution
falls back to a size-only `operator new`, these speculative references
currently
suppress `-Wunused-parameter`.
Preserve each parameter's referenced state while collecting placement
arguments, then mark the parameters referenced only when those arguments
are
included in the selected allocation call. Keep this distinction when
placement
arguments are replaced by `std::nothrow`.
Apply the same rule to promise initialization: when initialization using
the
[14 lines not shown]
[mlir] [vector] try promoting scalar when reordering broadcast/elementwise (#212180)
Inspired by https://github.com/llvm/llvm-project/pull/211208
The thread discussed the case:
```
%0 = vector.broadcast %arg0 : vector<4xf32> to vector<3x4xf32>
%1 = vector.broadcast %arg1 : f32 to vector<3x4xf32>
%2 = vector.broadcast %arg2 : vector<4xf32> to vector<3x4xf32>
%3 = vector.fma %0, %1, %2 : vector<3x4xf32>
```
The reviewer suggests "broadcasts on %arg0 and %arg2 are removed but
%arg1 is broadcasted to <4xf32>. Then FMA would happen on <4xf32>,
%followed by the broadcast to <3x4xf32>". Now this is solved and we can
see the test case at @fma_mixed_scalar_and_vector_broadcast_source in
the attached test case.
AI assisted.