[mlir][Vector] Add UB conversions to different tests and pipelines (#125145)
This PR adds the UB to LLVM/SPIR-V conversion pass to some pipelines and tests. This is in preparation to introducing the generation of `ub.poison` in Vector dialect transformations (first one in https://github.com/llvm/llvm-project/pull/125613). It should effectively be NFC at this point.
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
#ifndef MLIR_DIALECT_SPARSETENSOR_TRANSFORMS_PASSES_H_
|
||||
#define MLIR_DIALECT_SPARSETENSOR_TRANSFORMS_PASSES_H_
|
||||
|
||||
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "mlir/Transforms/OneToNTypeConversion.h"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Include the generated pass header (which needs some early definitions).
|
||||
|
||||
@@ -6,23 +6,15 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/SparseTensor/Pipelines/Passes.h"
|
||||
|
||||
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
|
||||
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
|
||||
#include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h"
|
||||
#include "mlir/Conversion/Passes.h"
|
||||
#include "mlir/Dialect/Arith/Transforms/Passes.h"
|
||||
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
|
||||
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
|
||||
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
|
||||
#include "mlir/Dialect/Func/IR/FuncOps.h"
|
||||
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
|
||||
#include "mlir/Dialect/GPU/Transforms/Passes.h"
|
||||
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
|
||||
#include "mlir/Dialect/Linalg/Passes.h"
|
||||
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
|
||||
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
|
||||
#include "mlir/Dialect/SparseTensor/Pipelines/Passes.h"
|
||||
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
|
||||
#include "mlir/Pass/PassManager.h"
|
||||
#include "mlir/Transforms/Passes.h"
|
||||
@@ -107,6 +99,9 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
|
||||
pm.addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
|
||||
}
|
||||
|
||||
// Convert poison values.
|
||||
pm.addPass(createUBToLLVMConversionPass());
|
||||
|
||||
// Ensure all casts are realized.
|
||||
pm.addPass(createReconcileUnrealizedCastsPass());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// RUN: mlir-opt %s -convert-vector-to-scf -convert-scf-to-cf \
|
||||
// RUN: -transform-interpreter \
|
||||
// RUN: -test-transform-dialect-erase-schedule \
|
||||
// RUN: -convert-vector-to-llvm -convert-func-to-llvm -convert-arith-to-llvm -convert-cf-to-llvm -reconcile-unrealized-casts | \
|
||||
// RUN: -convert-vector-to-llvm -convert-func-to-llvm \
|
||||
// RUN: -convert-arith-to-llvm -convert-cf-to-llvm \
|
||||
// RUN: -convert-ub-to-llvm -reconcile-unrealized-casts | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,expand-strided-metadata,lower-affine,convert-arith-to-llvm,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,expand-strided-metadata,lower-affine,convert-arith-to-llvm,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-ub-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},expand-strided-metadata,lower-affine,convert-arith-to-llvm,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},expand-strided-metadata,lower-affine,convert-arith-to-llvm,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-ub-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e entry -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf,lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e main -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(convert-vector-to-scf{full-unroll=true},lower-affine,convert-scf-to-cf),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,convert-arith-to-llvm,convert-cf-to-llvm,convert-ub-to-llvm,reconcile-unrealized-casts)" | \
|
||||
// RUN: mlir-runner -e main -entry-point-result=void \
|
||||
// RUN: -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils | \
|
||||
// RUN: FileCheck %s
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
//
|
||||
//===-------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/Arith/IR/Arith.h"
|
||||
#include "mlir/Dialect/Func/IR/FuncOps.h"
|
||||
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
|
||||
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
|
||||
#include "mlir/Dialect/UB/IR/UBOps.h"
|
||||
#include "mlir/Dialect/Vector/IR/VectorOps.h"
|
||||
#include "mlir/Dialect/Vector/Transforms/LoweringPatterns.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Pass/PassManager.h"
|
||||
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace {
|
||||
@@ -30,7 +27,8 @@ struct TestSPIRVVectorUnrolling final
|
||||
}
|
||||
|
||||
void getDependentDialects(DialectRegistry ®istry) const override {
|
||||
registry.insert<spirv::SPIRVDialect, vector::VectorDialect>();
|
||||
registry
|
||||
.insert<spirv::SPIRVDialect, vector::VectorDialect, ub::UBDialect>();
|
||||
}
|
||||
|
||||
void runOnOperation() override {
|
||||
|
||||
@@ -20,14 +20,12 @@
|
||||
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
|
||||
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
|
||||
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
|
||||
#include "mlir/Conversion/UBToLLVM/UBToLLVM.h"
|
||||
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
|
||||
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
|
||||
#include "mlir/Dialect/Func/IR/FuncOps.h"
|
||||
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
||||
#include "mlir/Dialect/Linalg/Passes.h"
|
||||
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
|
||||
#include "mlir/IR/DialectRegistry.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Pass/PassManager.h"
|
||||
#include "mlir/Pass/PassOptions.h"
|
||||
#include "mlir/Transforms/Passes.h"
|
||||
@@ -81,6 +79,8 @@ void buildTestLowerToLLVM(OpPassManager &pm,
|
||||
pm.addPass(createConvertControlFlowToLLVMPass());
|
||||
// Convert Index to LLVM (always needed).
|
||||
pm.addPass(createConvertIndexToLLVMPass());
|
||||
// Convert UB to LLVM (always needed).
|
||||
pm.addPass(createUBToLLVMConversionPass());
|
||||
// Convert remaining unrealized_casts (always needed).
|
||||
pm.addPass(createReconcileUnrealizedCastsPass());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user