[mlir][xegpu] Add SIMT distribution patterns for UpdateNdOffset and PrefetchNd ops. (#138033)
This PR adds support for SIMT distribution of UpdateNdOffset and
PrefetchNd ops.
For both these ops distribution will remove the layout attribute from
the tensor descriptor type. Everything else remains unchanged.
Example 1:
```
#lo0 = #xegpu.layout<wi_layout = [1, 8], wi_data = [1, 1]>
gpu.warp_execute_on_lane_0(%laneid) -> () {
...
xegpu.prefetch_nd %arg0 : !xegpu.tensor_desc<4x8xf32, #lo0>
}
```
To
```
%r:2 = gpu.warp_execute_on_lane_0(%laneid) -> (
!xegpu.tensor_desc<4x8xf32, #lo0>) {
gpu.yield %arg0: !xegpu.tensor_desc<4x8xf32, #lo0>
}
%1 = unrealized_conversion_cast %r#0: !xegpu.tensor_desc<4x8xf32,
#lo0> -> !xegpu.tensor_desc<4x8xf32>
xegpu.prefetch_nd %0 : !xegpu.tensor_desc<4x8xf32>
```
Example 2:
```
#lo0 = #xegpu.layout<wi_layout = [1, 8], wi_data = [1, 1]>
%r = gpu.warp_execute_on_lane_0(%laneid) ->
(!xegpu.tensor_desc<4x8xf32, #lo0>) {
...
%update = xegpu.update_nd_offset %arg0, [%c32, %c16]:
!xegpu.tensor_desc<4x8xf32, #lo0>
gpu.yield %update
}
...
```
To
```
%r:2 = gpu.warp_execute_on_lane_0(%laneid) -> (vector<4x1xf32>,
!xegpu.tensor_desc<4x8xf32, #lo0>) {
...
%dead = xegpu.update_nd_offset %arg0, [%c32, %c16]:
!xegpu.tensor_desc<4x8xf32, #lo0> gpu.yield %dead, %arg0
gup.yield %dead, %arg0, %c32, %c16
}
%0 = xegpu.unrealized_conversion_cast %r#1: !xegpu.tensor_desc<4x8xf32,
#lo0> -> !xegpu.tensor_desc<4x8xf32>
%1 = xegpu.update_nd_offset %0, [%c32, %c16]:
!xegpu.tensor_desc<4x8xf32>
...
```Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.