[mlir] Split up VectorToLLVM pass

Currently, the VectorToLLVM patterns are built into a library along
with the corresponding pass, which also pulls in all the
platform-specific vector dialects (like AMXDialect) to apply all the
vector to LLVM conversions.

This causes dependency bloat when writing libraries - for example the
GPU to LLVM passes, which use the vector to LLVM patterns, don't need
the X86Vector dialect to be present at all.

This commit partitions the library into VectorToLLVM and
VectorToLLVMPass, where the latter pulls in all the other vector
transformations.

Reviewed By: nicolasvasilache, mehdi_amini

Differential Revision: https://reviews.llvm.org/D158287
This commit is contained in:
Krzysztof Drewniak 2023-07-18 19:23:01 +00:00
parent b4b4d8bd61
commit df852599f3
13 changed files with 51 additions and 24 deletions

View File

@ -63,7 +63,7 @@
#include "mlir/Conversion/UBToSPIRV/UBToSPIRV.h"
#include "mlir/Conversion/VectorToArmSME/VectorToArmSME.h"
#include "mlir/Conversion/VectorToGPU/VectorToGPU.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h"

View File

@ -12,10 +12,6 @@
namespace mlir {
class LLVMTypeConverter;
class Pass;
#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS
#include "mlir/Conversion/Passes.h.inc"
/// Collect a set of patterns to convert from Vector contractions to LLVM Matrix
/// Intrinsics. To lower to assembly, the LLVM flag -lower-matrix-intrinsics

View File

@ -0,0 +1,19 @@
//===- ConvertVectorToLLVMPass.h - Pass to check Vector->LLVM --- --===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_
#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
namespace mlir {
class Pass;
#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS
#include "mlir/Conversion/Passes.h.inc"
} // namespace mlir
#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLLVMPASS_H_

View File

@ -13,7 +13,7 @@
#ifndef MLIR_DIALECT_SPARSETENSOR_PIPELINES_PASSES_H_
#define MLIR_DIALECT_SPARSETENSOR_PIPELINES_PASSES_H_
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
#include "mlir/Pass/PassOptions.h"

View File

@ -1,6 +1,6 @@
add_mlir_conversion_library(MLIRVectorToLLVM
PARTIAL_SOURCES_INTENDED
ConvertVectorToLLVM.cpp
ConvertVectorToLLVMPass.cpp
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
@ -14,14 +14,6 @@ add_mlir_conversion_library(MLIRVectorToLLVM
LINK_LIBS PUBLIC
MLIRArithDialect
MLIRArmNeonDialect
MLIRArmSMEDialect
MLIRArmSMETransforms
MLIRVectorToArmSME
MLIRArmSVEDialect
MLIRArmSVETransforms
MLIRAMXDialect
MLIRAMXTransforms
MLIRLLVMCommonConversion
MLIRLLVMDialect
MLIRMemRefDialect
@ -29,6 +21,26 @@ add_mlir_conversion_library(MLIRVectorToLLVM
MLIRTransforms
MLIRVectorDialect
MLIRVectorTransforms
)
add_mlir_conversion_library(MLIRVectorToLLVMPass
PARTIAL_SOURCES_INTENDED
ConvertVectorToLLVMPass.cpp
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLLVM
LINK_LIBS PUBLIC
MLIRVectorToLLVM
MLIRArmNeonDialect
MLIRArmSMEDialect
MLIRArmSMETransforms
MLIRArmSVEDialect
MLIRArmSVETransforms
MLIRVectorToArmSME
MLIRAMXDialect
MLIRAMXTransforms
MLIRX86VectorDialect
MLIRX86VectorTransforms
)
)

View File

@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"

View File

@ -24,6 +24,6 @@ add_mlir_dialect_library(MLIRSparseTensorPipelines
MLIRSparseTensorDialect
MLIRSparseTensorTransforms
MLIRTensorTransforms
MLIRVectorToLLVM
MLIRVectorToLLVMPass
MLIRVectorTransforms
)

View File

@ -27,7 +27,7 @@ set(LIBS
MLIRTransforms
MLIRTransformUtils
MLIRTranslateLib
MLIRVectorToLLVM
MLIRVectorToLLVMPass
)
add_mlir_library(MLIRGPUTestPasses

View File

@ -22,7 +22,7 @@
#include "mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h"
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"

View File

@ -19,6 +19,6 @@ add_mlir_library(MLIRLLVMTestPasses
MLIRReconcileUnrealizedCasts
MLIRSCFToControlFlow
MLIRTransforms
MLIRVectorToLLVM
MLIRVectorToLLVMPass
MLIRVectorToSCF
)

View File

@ -18,7 +18,7 @@
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.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"

View File

@ -72,7 +72,7 @@ if (MLIR_ENABLE_VULKAN_RUNNER)
MLIRTransforms
MLIRTranslateLib
MLIRVectorDialect
MLIRVectorToLLVM
MLIRVectorToLLVMPass
${Vulkan_LIBRARY}
)

View File

@ -18,7 +18,7 @@
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"