[mlir][test] Fix linking error post test-lower-to-nvvm

This fixes builds for 7e78ecfe10 (both cmake and bazel) as well as trim unnecessary dependencies.

This is achieved by moving the functionality to test/lib/GPU which is a more natural landing pad.
This commit is contained in:
Nicolas Vasilache 2023-07-17 18:08:00 +02:00
parent d661b4b575
commit 582e1d58bd
5 changed files with 27 additions and 25 deletions

View File

@ -47,3 +47,13 @@ add_mlir_library(MLIRGPUTestPasses
LINK_LIBS PUBLIC
${LIBS}
)
# This is how it is defined in mlir/lib/Dialect/GPU/CMakeLists.txt
# We probably want something better project-wide
if(MLIR_ENABLE_CUDA_RUNNER)
# Enable gpu-to-cubin pass.
target_compile_definitions(MLIRGPUTestPasses
PRIVATE
MLIR_GPU_TO_CUBIN_PASS_ENABLE=1
)
endif()

View File

@ -16,11 +16,7 @@
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
#include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
#include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h"
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
#include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
#include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h"
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h"
@ -28,25 +24,13 @@
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
#include "mlir/Dialect/Arith/IR/Arith.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/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/ExecutionEngine/JitRunner.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Pass/PassOptions.h"
#include "mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h"
#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"
using namespace mlir;
@ -96,8 +80,6 @@ void buildGpuPassPipeline(OpPassManager &pm,
pm.addNestedPass<gpu::GPUModuleOp>(createStripDebugInfoPass());
pm.addNestedPass<gpu::GPUModuleOp>(createConvertVectorToSCFPass());
// Blanket-convert any remaining linalg ops to loops if any remain.
pm.addNestedPass<gpu::GPUModuleOp>(createConvertLinalgToLoopsPass());
// Convert SCF to CF (always needed).
pm.addNestedPass<gpu::GPUModuleOp>(createConvertSCFToCFPass());
// Convert Math to LLVM (always needed).
@ -210,8 +192,6 @@ void buildLowerToNVVMPassPipeline(OpPassManager &pm,
// gpu::LaunchOp and gpu::HostRegisterOp.
// TODO: fix GPU layering.
pm.addNestedPass<func::FuncOp>(createConvertVectorToSCFPass());
// Blanket-convert any remaining linalg ops to loops if any remain.
pm.addNestedPass<func::FuncOp>(createConvertLinalgToLoopsPass());
// Convert SCF to CF (always needed).
pm.addNestedPass<func::FuncOp>(createConvertSCFToCFPass());
// Convert Math to LLVM (always needed).

View File

@ -12,11 +12,6 @@ set(LLVM_LINK_COMPONENTS
)
if(MLIR_INCLUDE_TESTS)
if(MLIR_ENABLE_CUDA_RUNNER)
set(cuda_test_libs
MLIRNVVMTestPasses
)
endif()
set(test_libs
${cuda_test_libs}
MLIRTestFuncToLLVM

View File

@ -5259,6 +5259,7 @@ cc_library(
":LLVMDialect",
":NVVMOpsIncGen",
":SideEffectInterfaces",
":Support",
"//llvm:AsmParser",
"//llvm:Core",
"//llvm:Support",

View File

@ -599,20 +599,36 @@ cc_library(
"//llvm:NVPTXCodeGen",
"//llvm:Support",
"//mlir:AffineDialect",
"//mlir:AffineToStandard",
"//mlir:ArithDialect",
"//mlir:ArithToLLVM",
"//mlir:FuncDialect",
"//mlir:FuncToLLVM",
"//mlir:GPUDialect",
"//mlir:GPUToGPURuntimeTransforms",
"//mlir:GPUToNVVMTransforms",
"//mlir:GPUTransforms",
"//mlir:IR",
"//mlir:IndexDialect",
"//mlir:IndexToLLVM",
"//mlir:MathToLLVM",
"//mlir:MemRefDialect",
"//mlir:MemRefTransforms",
"//mlir:MemRefToLLVM",
"//mlir:NVGPUToNVVM",
"//mlir:NVVMToLLVMIRTranslation",
"//mlir:Pass",
"//mlir:ReconcileUnrealizedCasts",
"//mlir:ROCDLToLLVMIRTranslation",
"//mlir:SCFDialect",
"//mlir:SCFToControlFlow",
"//mlir:SPIRVDialect",
"//mlir:ToLLVMIRTranslation",
"//mlir:Transforms",
"//mlir:TransformUtils",
"//mlir:VectorDialect",
"//mlir:VectorToLLVM",
"//mlir:VectorToSCF",
],
)