Fix setting of workgroup size for `tile_to_foreach_thread_and_workgroup_count_region` (#10673)
`tile_to_foreach_thread_and_workgroup_count_region` explicitly maps
dimensions to GPU thread blocks via attribute. This PR assigns workgroup
size according to given dimensions of `scf.foreach_thread`
Take a look at a 2D vectoradd example with 'linalg.generic' and
transform dialect.
```
linalg.generic {...} ins(%x: tensor<512x4xf32>) outs(%y: tensor<512x4xf32>) {...}
```
here is the transform dialect
```
transform.iree.tile_to_foreach_thread_and_workgroup_count_region %generic tile_sizes [4, 2] (
mapping = [#gpu.block<z>, #gpu.block<y>] )
```
Current iree launches the following which is wrong.
```
CUDA kernel <<< (gridDim.x=2, gridDim.y=128, gridDim.z=1), ...>>> -> Wrong!
```
This PR changes the kernel launch as below:
```
CUDA kernel <<< (gridDim.x=1, gridDim.y=2, gridDim.z=128), ...>>> -> Correct
```IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.
See our website for project details, user guides, and instructions on building from source.
IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels!
See our website for more information.
IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.