Skip to content

[mlir][gpu] Remove old GPU serialization passes #94998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions mlir/docs/Dialects/GPU.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ complex lifetime analysis following the principles of MLIR that promote
structure and representing analysis results in the IR.

## GPU Compilation
### Deprecation notice
The `--gpu-to-(cubin|hsaco)` passes will be deprecated in a future release.

### Compilation overview
The compilation process in the GPU dialect has two main stages: GPU module
serialization and offloading operations translation. Together these stages can
Expand Down
3 changes: 0 additions & 3 deletions mlir/include/mlir/Config/mlir-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#ifndef MLIR_CONFIG_H
#define MLIR_CONFIG_H

/* If set, enable deprecated serialization passes. */
#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE

/* Enable expensive checks to detect invalid pattern API usage. Failed checks
manifest as fatal errors or invalid memory accesses (e.g., accessing
deallocated memory) that cause a crash. Running with ASAN is recommended for
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def GpuToLLVMConversionPass : Pass<"gpu-to-llvm", "ModuleOp"> {
/*default=*/"false",
"Use bare pointers to pass memref arguments to kernels. "
"The kernel must use the same setting for this option."
>
>
];

let dependentDialects = [
Expand Down
63 changes: 0 additions & 63 deletions mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,75 +91,12 @@ namespace gpu {
LogicalResult transformGpuModulesToBinaries(
Operation *op, OffloadingLLVMTranslationAttrInterface handler = nullptr,
const gpu::TargetOptions &options = {});

/// Base pass class to serialize kernel functions through LLVM into
/// user-specified IR and add the resulting blob as module attribute.
class SerializeToBlobPass : public OperationPass<gpu::GPUModuleOp> {
public:
SerializeToBlobPass(TypeID passID);
SerializeToBlobPass(const SerializeToBlobPass &other);

void runOnOperation() final;

protected:
/// Hook allowing the application of optimizations before codegen
/// By default, does nothing
virtual LogicalResult optimizeLlvm(llvm::Module &llvmModule,
llvm::TargetMachine &targetMachine);

/// Translates the 'getOperation()' result to an LLVM module.
virtual std::unique_ptr<llvm::Module>
translateToLLVMIR(llvm::LLVMContext &llvmContext);

private:
/// Creates the LLVM target machine to generate the ISA.
std::unique_ptr<llvm::TargetMachine> createTargetMachine();

/// Translates the module to ISA
std::optional<std::string> translateToISA(llvm::Module &llvmModule,
llvm::TargetMachine &targetMachine);

/// Serializes the target ISA to binary form.
virtual std::unique_ptr<std::vector<char>>
serializeISA(const std::string &isa) = 0;

protected:
Option<std::string> triple{*this, "triple",
::llvm::cl::desc("Target triple")};
Option<std::string> chip{*this, "chip",
::llvm::cl::desc("Target architecture")};
Option<std::string> features{*this, "features",
::llvm::cl::desc("Target features")};
Option<int> optLevel{*this, "opt-level",
llvm::cl::desc("Optimization level for compilation"),
llvm::cl::init(2)};
Option<std::string> gpuBinaryAnnotation{
*this, "gpu-binary-annotation",
llvm::cl::desc("Annotation attribute string for GPU binary"),
llvm::cl::init(getDefaultGpuBinaryAnnotation())};
Option<bool> dumpPtx{*this, "dump-ptx",
::llvm::cl::desc("Dump generated PTX"),
llvm::cl::init(false)};
};
} // namespace gpu

//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//

/// Register pass to serialize GPU kernel functions to a HSAco binary
/// annotation.
LLVM_DEPRECATED("use Target attributes instead", "")
void registerGpuSerializeToHsacoPass();

/// Create an instance of the GPU kernel function to HSAco binary serialization
/// pass.
LLVM_DEPRECATED("use Target attributes instead", "")
std::unique_ptr<Pass> createGpuSerializeToHsacoPass(StringRef triple,
StringRef arch,
StringRef features,
int optLevel);

/// Collect a set of patterns to decompose memrefs ops.
void populateGpuDecomposeMemrefsPatterns(RewritePatternSet &patterns);

Expand Down
3 changes: 0 additions & 3 deletions mlir/include/mlir/Dialect/GPU/Transforms/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ namespace gpu {
class GPUFuncOp;
class LaunchOp;

/// Returns the default annotation name for GPU binary blobs.
std::string getDefaultGpuBinaryAnnotation();

/// Returns the matching vector combining kind.
vector::CombiningKind convertReductionKind(gpu::AllReduceOperation mode);
} // namespace gpu
Expand Down
43 changes: 0 additions & 43 deletions mlir/lib/Dialect/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
if (MLIR_ENABLE_ROCM_CONVERSIONS)
set(AMDGPU_LIBS
IRReader
IPO
linker
MCParser
AMDGPUAsmParser
AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
target
)
endif()

add_mlir_dialect_library(MLIRGPUDialect
IR/GPUDialect.cpp
IR/InferIntRangeInterfaceImpls.cpp
Expand Down Expand Up @@ -51,8 +37,6 @@ add_mlir_dialect_library(MLIRGPUTransforms
Transforms/NVVMAttachTarget.cpp
Transforms/ParallelLoopMapper.cpp
Transforms/ROCDLAttachTarget.cpp
Transforms/SerializeToBlob.cpp
Transforms/SerializeToHsaco.cpp
Transforms/ShuffleRewriter.cpp
Transforms/SPIRVAttachTarget.cpp
Transforms/SubgroupReduceLowering.cpp
Expand All @@ -61,12 +45,6 @@ add_mlir_dialect_library(MLIRGPUTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU

LINK_COMPONENTS
Core
MC
Target
${AMDGPU_LIBS}

DEPENDS
MLIRGPUPassIncGen
MLIRParallelLoopMapperEnumsGen
Expand All @@ -76,15 +54,12 @@ add_mlir_dialect_library(MLIRGPUTransforms
MLIRArithDialect
MLIRAsyncDialect
MLIRBufferizationDialect
MLIRBuiltinToLLVMIRTranslation
MLIRDataLayoutInterfaces
MLIRExecutionEngineUtils
MLIRGPUDialect
MLIRIR
MLIRIndexDialect
MLIRLLVMDialect
MLIRGPUToLLVMIRTranslation
MLIRLLVMToLLVMIRTranslation
MLIRMemRefDialect
MLIRNVVMTarget
MLIRPass
Expand All @@ -99,21 +74,3 @@ add_mlir_dialect_library(MLIRGPUTransforms

add_subdirectory(TransformOps)
add_subdirectory(Pipelines)

if(MLIR_ENABLE_ROCM_CONVERSIONS)
if (NOT ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD))
message(SEND_ERROR
"Building mlir with ROCm support requires the AMDGPU backend")
endif()

set(DEFAULT_ROCM_PATH "/opt/rocm" CACHE PATH "Fallback path to search for ROCm installs")
target_compile_definitions(obj.MLIRGPUTransforms
PRIVATE
__DEFAULT_ROCM_PATH__="${DEFAULT_ROCM_PATH}"
)

target_link_libraries(MLIRGPUTransforms
PRIVATE
MLIRROCDLToLLVMIRTranslation
)
endif()
153 changes: 0 additions & 153 deletions mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp

This file was deleted.

Loading
Loading