Skip to content

Commit

Permalink
[mlir][gpu] Replace MLIR_GPU_TO_HSACO_PASS_ENABLE by more generic one. (
Browse files Browse the repository at this point in the history
#84001)

This is another follow-up of #83004. The PR replaces the macro
`MLIR_GPU_TO_HSACO_PASS_ENABLE` with the more generic macro
`MLIR_ENABLE_ROCM_CONVERSIONS`. Until now, the former has been defined
if and only if the latter evaluated to true in CMake. However, the
former was not defined when the latter evaluated to false, in which case
a warning was raised if compiled with `-Wundef`. Using a single macro
relies on the `#cmakedefine01` mechanism that ensures the macro is
always set to either 0 or 1.
  • Loading branch information
ingomueller-net authored Mar 6, 2024
1 parent aced81c commit 6e27dd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion mlir/lib/Dialect/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ if(MLIR_ENABLE_ROCM_CONVERSIONS)
target_compile_definitions(obj.MLIRGPUTransforms
PRIVATE
__DEFAULT_ROCM_PATH__="${DEFAULT_ROCM_PATH}"
MLIR_GPU_TO_HSACO_PASS_ENABLE=1
)

target_link_libraries(MLIRGPUTransforms
Expand Down
7 changes: 4 additions & 3 deletions mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
//
//===----------------------------------------------------------------------===//

#include "mlir/Config/mlir-config.h"
#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"

#if MLIR_GPU_TO_HSACO_PASS_ENABLE
#if MLIR_ENABLE_ROCM_CONVERSIONS
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/FileUtilities.h"
Expand Down Expand Up @@ -454,6 +455,6 @@ std::unique_ptr<Pass> mlir::createGpuSerializeToHsacoPass(StringRef triple,
optLevel);
}

#else // MLIR_GPU_TO_HSACO_PASS_ENABLE
#else // MLIR_ENABLE_ROCM_CONVERSIONS
void mlir::registerGpuSerializeToHsacoPass() {}
#endif // MLIR_GPU_TO_HSACO_PASS_ENABLE
#endif // MLIR_ENABLE_ROCM_CONVERSIONS

0 comments on commit 6e27dd4

Please sign in to comment.