From: Nicolas Vasilache Date: Mon, 17 Jul 2023 16:08:00 +0000 (+0200) Subject: [mlir][test] Fix linking error post test-lower-to-nvvm X-Git-Tag: upstream/17.0.6~1496 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=582e1d58bd43af138033b98b736d97cc89c7b228;p=platform%2Fupstream%2Fllvm.git [mlir][test] Fix linking error post test-lower-to-nvvm This fixes builds for 7e78ecfe10ea9071234de8d385b87d338d280266 (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. --- diff --git a/mlir/test/lib/Dialect/GPU/CMakeLists.txt b/mlir/test/lib/Dialect/GPU/CMakeLists.txt index 02db079..c972a8a 100644 --- a/mlir/test/lib/Dialect/GPU/CMakeLists.txt +++ b/mlir/test/lib/Dialect/GPU/CMakeLists.txt @@ -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() diff --git a/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp index 57f328d..5db6f56 100644 --- a/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp +++ b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp @@ -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(createStripDebugInfoPass()); pm.addNestedPass(createConvertVectorToSCFPass()); - // Blanket-convert any remaining linalg ops to loops if any remain. - pm.addNestedPass(createConvertLinalgToLoopsPass()); // Convert SCF to CF (always needed). pm.addNestedPass(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(createConvertVectorToSCFPass()); - // Blanket-convert any remaining linalg ops to loops if any remain. - pm.addNestedPass(createConvertLinalgToLoopsPass()); // Convert SCF to CF (always needed). pm.addNestedPass(createConvertSCFToCFPass()); // Convert Math to LLVM (always needed). diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 12ee7db..df1e948 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -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 diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index 3387854..e058b89 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -5259,6 +5259,7 @@ cc_library( ":LLVMDialect", ":NVVMOpsIncGen", ":SideEffectInterfaces", + ":Support", "//llvm:AsmParser", "//llvm:Core", "//llvm:Support", diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel index 52bf79c..ac811b2 100644 --- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel @@ -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", ], )