Closed IanWood1 closed 1 week ago
For more context, VectorReductionToGPU
works by putting all ops in the function body into vector.warp_execute_on_lane_0
op and then sinking/hoisting out distributable ops. However, the element-wise op at the end cant be distributed (see https://gist.github.com/IanWood1/8f145cc0d36ea118e84775c663aa6775) which causes a crash in WarpOpScfForOp
because it doesnt check to make sure the scf.for
op has distributable types.
https://gist.github.com/IanWood1/827aee042ff6968070d2d0c6beccae4a
iree-compile --output-format=vm-bytecode --compile-from=executable-sources ~/repro.mlir -o /tmp/a.vmfb
https://gist.github.com/IanWood1/f4bcb96c1f044a026fb33322e7e3fa99
@bangtianliu @Groverkss would you be able to take a look?
Another issue:
Download https://gist.github.com/IanWood1/ab88d6e2b8a4f4a2a2ab68c9ecdf22b1
Checkout https://github.com/IanWood1/iree/tree/collapse_softmax (or remove reduction check in isEligibleForCollapse
)
Run iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=vulkan-spirv /home/ianwood/iree/tests/e2e/regression/softmax.mlir
There are cases where
linalg.generic
ops inside of a dispatch region could have their dimensions collapsed. But, collapsing the dimensions of the rootelementwise
op for a dispatch containingelementwise -> reduction -> elementwise -> reduction -> elementwise
causes GPU compilation failures. Because of this, dims are not collapsed when the producer is aLinalgOp
Repro: Use this mlir and run
iree-compile --output-format=vm-bytecode --compile-from=executable-sources ~/repro.mlir -o /tmp/a.vmfb
A bit more context here: https://github.com/iree-org/iree/issues/17594