EnzymeAD / EnzymeAD/Enzyme-JAX
conj optimization patterns
- Dominant language
- MLIR
- Stars
- 131
- Forks
- 53
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 193
Description
- [x] conj(complex(a, constant))
- [x] conj(conj(x)) -> x
- [ ] conj(elementwise) -> move conj up will cancel out (for some elementwise)
- [x] real(conj(x)) -> real(x)
- [x] const prop
```mlir
func.func @conj(%arg0: tensor<5x3x4xf32>) -> tensor<5x3x4xf32> {
%cst = stablehlo.constant dense<1.000000e+00> : tensor<4x5x3xf32>
%cst_0 = stablehlo.constant dense<0.000000e+00> : tensor<4x5x3xf32>
%cst_1 = stablehlo.constant dense<(0.000000e+00,0.000000e+00)> : tensor<4x5x3xcomplex>
%0 = stablehlo.transpose %arg0, dims = [2, 0, 1] : (tensor<5x3x4xf32>) -> tensor<4x5x3xf32>
%1 = stablehlo.complex %0, %cst_0 : tensor<4x5x3xcomplex>
%2 = stablehlo.fft %1, type = FFT, length = [5, 3] : (tensor<4x5x3xcomplex>) -> tensor<4x5x3xcomplex>
%3 = chlo.conj %2 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%4 = stablehlo.complex %cst, %cst_0 : tensor<4x5x3xcomplex>
%5 = chlo.conj %4 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%6 = stablehlo.add %cst_1, %5 : tensor<4x5x3xcomplex>
%7 = chlo.conj %6 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%8 = stablehlo.multiply %7, %3 : tensor<4x5x3xcomplex>
%9 = chlo.conj %8 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%10 = stablehlo.add %cst_1, %9 : tensor<4x5x3xcomplex>
%11 = stablehlo.multiply %7, %2 : tensor<4x5x3xcomplex>
%12 = chlo.conj %11 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%13 = stablehlo.add %cst_1, %12 : tensor<4x5x3xcomplex>
%14 = chlo.conj %13 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%15 = chlo.conj %14 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%16 = chlo.conj %15 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%17 = stablehlo.add %10, %16 : tensor<4x5x3xcomplex>
%18 = chlo.conj %17 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%19 = chlo.conj %18 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%20 = stablehlo.add %cst_1, %19 : tensor<4x5x3xcomplex>
%21 = chlo.conj %20 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%22 = stablehlo.fft %21, type = FFT, length = [5, 3] : (tensor<4x5x3xcomplex>) -> tensor<4x5x3xcomplex>
%23 = chlo.conj %22 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%24 = stablehlo.add %cst_1, %23 : tensor<4x5x3xcomplex>
%25 = chlo.conj %24 : tensor<4x5x3xcomplex> -> tensor<4x5x3xcomplex>
%26 = stablehlo.real %25 : (tensor<4x5x3xcomplex>) -> tensor<4x5x3xf32>
%27 = stablehlo.transpose %26, dims = [1, 2, 0] : (tensor<4x5x3xf32>) -> tensor<5x3x4xf32>
return %27 : tensor<5x3x4xf32>
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.