Skip to content

Commit

Permalink
Integrate llvm-project and bump dependencies. (#8464)
Browse files Browse the repository at this point in the history
* Integrate llvm-project and bump dependencies.

* llvm-project: 7c65d2288bfd03ca3c3e829c7746b5e4e495357f
* mlir-hlo: a2c37922d79b4204e690c4815f92363de1ae0739
* tensorflow: e4c2068ee960f1f3a886af89a17c74b9b2c477c8

-Update StandardToSPIRV uses
-Update linalg ext test due to new folding patterns
  • Loading branch information
ThomasRaoux authored Mar 5, 2022
1 parent 3e6955c commit cfddeb6
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 48 deletions.
2 changes: 1 addition & 1 deletion integrations/tensorflow/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

TENSORFLOW_COMMIT = "fddb6c72caa6a63ec86263a4d4230812c861cd10"
TENSORFLOW_COMMIT = "e4c2068ee960f1f3a886af89a17c74b9b2c477c8"

git_repository(
name = "org_tensorflow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,16 @@ func @fft_1D(%real: memref<16xf32>, %imag: memref<16xf32>) {
// CHECK-SAME: %[[IMAG:[a-zA-Z0-9]+]]
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[C2:.+]] = arith.constant 2 : index
// CHECK-DAG: %[[C16:.+]] = arith.constant 16 : index
// CHECK-DAG: %[[SCALE:.+]] = arith.constant -6.28318548 : f32
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK-DAG: %[[COEFF:.+]] = arith.constant -3.14159274 : f32
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C2]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C2]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[K]]] [%[[HM]]] [1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[K]]] [%[[HM]]] [1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
// CHECK: %[[R_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[R_OFFSET]]] [%[[HM]]] [1]
// CHECK: %[[R_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[R_OFFSET]]] [%[[HM]]] [1]
// CHECK: %[[M_I32:.+]] = arith.index_cast %[[M]] : index to i32
// CHECK: %[[M_F32:.+]] = arith.sitofp %[[M_I32]] : i32 to f32
// CHECK: %[[COEFF:.+]] = arith.divf %[[SCALE]], %[[M_F32]]
// CHECK: linalg.generic
// CHECK-SAME: indexing_maps = [#[[MAP1]], #[[MAP1]], #[[MAP1]], #[[MAP1]]]
// CHECK-SAME: iterator_types = ["parallel"]
Expand All @@ -402,7 +398,7 @@ func @fft_1D(%real: memref<16xf32>, %imag: memref<16xf32>) {
// CHECK: %[[J_IDX:.+]] = linalg.index 0 : index
// CHECK: %[[J_I32:.+]] = arith.index_cast %[[J_IDX]] : index to i32
// CHECK: %[[J_F32:.+]] = arith.sitofp %[[J_I32]] : i32 to f32
// CHECK: %[[EXP_COEF:.+]] = arith.mulf %[[COEFF]], %[[J_F32]] : f32
// CHECK: %[[EXP_COEF:.+]] = arith.mulf %[[J_F32]], %[[COEFF]] : f32
// CHECK: %[[W_REAL:.+]] = math.cos %[[EXP_COEF]]
// CHECK: %[[W_IMAG:.+]] = math.sin %[[EXP_COEF]]
//
Expand Down Expand Up @@ -436,18 +432,16 @@ func @fft_2D(%real: memref<?x16xf32>, %imag: memref<?x16xf32>) {
}
// CHECK-DAG: #[[MAP0:.+]] = affine_map<(d0, d1)[s0] -> (d0 * 16 + s0 + d1)>
// CHECK-DAG: #[[MAP1:.+]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: func @fft_2D
// CHECK: func @fft_2D(
// CHECK-SAME: %[[REAL:[a-zA-Z0-9]+]]
// CHECK-SAME: %[[IMAG:[a-zA-Z0-9]+]]
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[C2:.+]] = arith.constant 2 : index
// CHECK-DAG: %[[C4:.+]] = arith.constant 4 : index
// CHECK-DAG: %[[D0:.+]] = memref.dim %[[REAL]], %[[C0]] : memref<?x16xf32>
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C2]] : index
// CHECK: scf.for %[[I:.+]] = %[[C0]] to %[[D0]] step %[[C1]]
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C2]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C4]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C4]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
Expand Down Expand Up @@ -483,11 +477,9 @@ func @fft_2D_coef_buf(%real: memref<?x16xf32>, %imag: memref<?x16xf32>,
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[D0:.+]] = memref.dim %[[REAL]], %[[C0]] : memref<?x16xf32>
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK: scf.for %[[I:.+]] = %[[C0]] to %[[D0]] step %[[C1]]
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C2]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C2]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
Expand Down
4 changes: 3 additions & 1 deletion iree/compiler/Codegen/SPIRV/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ cc_library(
"@llvm-project//mlir:ArithmeticToSPIRV",
"@llvm-project//mlir:ArithmeticTransforms",
"@llvm-project//mlir:BufferizationDialect",
"@llvm-project//mlir:ControlFlowToSPIRV",
"@llvm-project//mlir:DialectUtils",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:FuncToSPIRV",
"@llvm-project//mlir:FuncTransforms",
"@llvm-project//mlir:GPUDialect",
"@llvm-project//mlir:GPUToSPIRV",
Expand All @@ -79,8 +81,8 @@ cc_library(
"@llvm-project//mlir:SPIRVDialect",
"@llvm-project//mlir:SPIRVTransforms",
"@llvm-project//mlir:SideEffectInterfaces",
"@llvm-project//mlir:StandardToSPIRV",
"@llvm-project//mlir:Support",
"@llvm-project//mlir:TensorToSPIRV",
"@llvm-project//mlir:TosaDialect",
"@llvm-project//mlir:TosaToStandard",
"@llvm-project//mlir:Transforms",
Expand Down
4 changes: 3 additions & 1 deletion iree/compiler/Codegen/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ iree_cc_library(
MLIRArithmeticToSPIRV
MLIRArithmeticTransforms
MLIRBufferization
MLIRControlFlowToSPIRV
MLIRFunc
MLIRFuncToSPIRV
MLIRFuncTransforms
MLIRGPUOps
MLIRGPUToSPIRV
Expand All @@ -68,8 +70,8 @@ iree_cc_library(
MLIRSPIRVConversion
MLIRSPIRVTransforms
MLIRSideEffectInterfaces
MLIRStandardToSPIRV
MLIRSupport
MLIRTensorToSPIRV
MLIRTosa
MLIRTosaToStandard
MLIRTransforms
Expand Down
6 changes: 4 additions & 2 deletions iree/compiler/Codegen/SPIRV/ConvertToSPIRVPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
#include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
#include "mlir/Conversion/MathToSPIRV/MathToSPIRV.h"
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
#include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h"
#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h"
#include "mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h"
#include "mlir/Conversion/TosaToStandard/TosaToStandard.h"
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
Expand Down Expand Up @@ -348,7 +350,7 @@ void ConvertToSPIRVPass::runOnOperation() {

// Pull in standard/math patterns to convert arithmetic ops and others.
arith::populateArithmeticToSPIRVPatterns(typeConverter, patterns);
populateStandardToSPIRVPatterns(typeConverter, patterns);
populateFuncToSPIRVPatterns(typeConverter, patterns);
populateMathToSPIRVPatterns(typeConverter, patterns);

// Pull in standard patterns to convert tensor operations to SPIR-V. These are
Expand Down
2 changes: 1 addition & 1 deletion iree/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ cc_library(
"@llvm-project//mlir:ConversionPasses",
"@llvm-project//mlir:EmitC",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:FuncToSPIRV",
"@llvm-project//mlir:GPUDialect",
"@llvm-project//mlir:GPUToSPIRV",
"@llvm-project//mlir:GPUTransforms",
Expand All @@ -164,7 +165,6 @@ cc_library(
"@llvm-project//mlir:SPIRVDialect",
"@llvm-project//mlir:SPIRVTransforms",
"@llvm-project//mlir:Shape",
"@llvm-project//mlir:StandardToSPIRV",
"@llvm-project//mlir:TensorInferTypeOpInterfaceImpl",
"@llvm-project//mlir:Transforms",
"@llvm-project//mlir:VectorOps",
Expand Down
2 changes: 1 addition & 1 deletion iree/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ if(${IREE_BUILD_COMPILER})
MLIRSPIRVTransforms
MLIRShape
MLIRFunc
MLIRStandardToSPIRV
MLIRFuncToSPIRV
MLIRTensorInferTypeOpInterfaceImpl
MLIRTosa
MLIRTosaTransforms
Expand Down
3 changes: 2 additions & 1 deletion iree/tools/init_mlir_passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ inline void registerMlirPasses() {
// SPIR-V
spirv::registerSPIRVLowerABIAttributesPass();
registerConvertGPUToSPIRVPass();
registerConvertStandardToSPIRVPass();
registerConvertControlFlowToSPIRVPass();
registerConvertFuncToSPIRVPass();
registerConvertLinalgToSPIRVPass();

// TOSA.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,16 @@ func @fft_1D(%real: memref<16xf32>, %imag: memref<16xf32>) {
// CHECK-SAME: %[[IMAG:[a-zA-Z0-9]+]]
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[C2:.+]] = arith.constant 2 : index
// CHECK-DAG: %[[C16:.+]] = arith.constant 16 : index
// CHECK-DAG: %[[SCALE:.+]] = arith.constant -6.28318548 : f32
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK-DAG: %[[COEFF:.+]] = arith.constant -3.14159274 : f32
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C2]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C2]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[K]]] [%[[HM]]] [1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[K]]] [%[[HM]]] [1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
// CHECK: %[[R_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[R_OFFSET]]] [%[[HM]]] [1]
// CHECK: %[[R_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[R_OFFSET]]] [%[[HM]]] [1]
// CHECK: %[[M_I32:.+]] = arith.index_cast %[[M]] : index to i32
// CHECK: %[[M_F32:.+]] = arith.sitofp %[[M_I32]] : i32 to f32
// CHECK: %[[COEFF:.+]] = arith.divf %[[SCALE]], %[[M_F32]]
// CHECK: linalg.generic
// CHECK-SAME: indexing_maps = [#[[MAP1]], #[[MAP1]], #[[MAP1]], #[[MAP1]]]
// CHECK-SAME: iterator_types = ["parallel"]
Expand All @@ -402,7 +398,7 @@ func @fft_1D(%real: memref<16xf32>, %imag: memref<16xf32>) {
// CHECK: %[[J_IDX:.+]] = linalg.index 0 : index
// CHECK: %[[J_I32:.+]] = arith.index_cast %[[J_IDX]] : index to i32
// CHECK: %[[J_F32:.+]] = arith.sitofp %[[J_I32]] : i32 to f32
// CHECK: %[[EXP_COEF:.+]] = arith.mulf %[[COEFF]], %[[J_F32]] : f32
// CHECK: %[[EXP_COEF:.+]] = arith.mulf %[[J_F32]], %[[COEFF]] : f32
// CHECK: %[[W_REAL:.+]] = math.cos %[[EXP_COEF]]
// CHECK: %[[W_IMAG:.+]] = math.sin %[[EXP_COEF]]
//
Expand Down Expand Up @@ -436,18 +432,16 @@ func @fft_2D(%real: memref<?x16xf32>, %imag: memref<?x16xf32>) {
}
// CHECK-DAG: #[[MAP0:.+]] = affine_map<(d0, d1)[s0] -> (d0 * 16 + s0 + d1)>
// CHECK-DAG: #[[MAP1:.+]] = affine_map<(d0, d1) -> (d0, d1)>
// CHECK: func @fft_2D
// CHECK: func @fft_2D(
// CHECK-SAME: %[[REAL:[a-zA-Z0-9]+]]
// CHECK-SAME: %[[IMAG:[a-zA-Z0-9]+]]
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[C2:.+]] = arith.constant 2 : index
// CHECK-DAG: %[[C4:.+]] = arith.constant 4 : index
// CHECK-DAG: %[[D0:.+]] = memref.dim %[[REAL]], %[[C0]] : memref<?x16xf32>
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C2]] : index
// CHECK: scf.for %[[I:.+]] = %[[C0]] to %[[D0]] step %[[C1]]
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C2]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C4]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C4]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
Expand Down Expand Up @@ -483,11 +477,9 @@ func @fft_2D_coef_buf(%real: memref<?x16xf32>, %imag: memref<?x16xf32>,
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
// CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
// CHECK-DAG: %[[D0:.+]] = memref.dim %[[REAL]], %[[C0]] : memref<?x16xf32>
// CHECK-DAG: %[[NODE_RNG:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK: scf.for %[[I:.+]] = %[[C0]] to %[[D0]] step %[[C1]]
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[NODE_RNG]]
// CHECK-DAG: %[[M:.+]] = arith.shli %[[C1]], %[[C1]] : index
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[M]], %[[C1]] : index
// CHECK: scf.for %[[K:.+]] = %[[C0]] to %[[C16]] step %[[C2]]
// CHECK-DAG: %[[HM:.+]] = arith.shrsi %[[C2]], %[[C1]] : index
// CHECK: %[[L_REAL_SLICE:.+]] = memref.subview %[[REAL]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[L_IMAG_SLICE:.+]] = memref.subview %[[IMAG]][%[[I]], %[[K]]] [1, %[[HM]]] [1, 1]
// CHECK: %[[R_OFFSET:.+]] = arith.addi %[[K]], %[[HM]] : index
Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project
2 changes: 1 addition & 1 deletion third_party/mlir-hlo

0 comments on commit cfddeb6

Please sign in to comment.