Skip to content

Commit

Permalink
[Codegen][NFC] Remove the HAL dependency from the Codegen dialect. (#…
Browse files Browse the repository at this point in the history
…19311)

We used to set translation_info attribute on hal ops. Now they are set
on the function, so the Codegen dialect no longer need to depend on the
HAL dialect. The revision also updates the comments for those functions.

---------

Signed-off-by: hanhanW <[email protected]>
  • Loading branch information
hanhanW authored Nov 27, 2024
1 parent 41115bb commit 615e7ff
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ iree_compiler_cc_library(
":LoweringConfigInterfaceGen",
":UKernelOpsGen",
"//compiler/src/iree/compiler/Codegen/Interfaces:UKernelOpInterface",
"//compiler/src/iree/compiler/Dialect/HAL/IR",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:ArithDialect",
"@llvm-project//mlir:ArithUtils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ iree_cc_library(
MLIRTransformDialectTransforms
MLIRViewLikeInterface
iree::compiler::Codegen::Interfaces::UKernelOpInterface
iree::compiler::Dialect::HAL::IR
PUBLIC
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ void IREECodegenDialect::initializeCodegenAttrs() {
namespace mlir::iree_compiler {

//===----------------------------------------------------------------------===//
// Helpers for getting/setting iree_codegen.translation_info attribute on the
// `hal.executable.export`
// Helpers for getting/setting iree_codegen.translation_info attribute on a
// FunctionOpInterface op.
// ===----------------------------------------------------------------------===//

IREE::Codegen::TranslationInfoAttr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
#define IREE_COMPILER_CODEGEN_DIALECT_LOWERINGCONFIG_H_

#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenInterfaces.h"
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Interfaces/FunctionInterfaces.h"

namespace mlir::iree_compiler {
/// Typedef for tile sizes to use at different levels of tiling.
Expand All @@ -43,8 +44,8 @@ constexpr StringLiteral kTuningSpecAttrName =
constexpr StringLiteral kKernelConfigSpecName = "__kernel_config";

//===----------------------------------------------------------------------===//
// Helpers for getting/setting iree_codegen.translation_info attribute on the
// `hal.executable.export`
// Helpers for getting/setting iree_codegen.translation_info attribute on a
// FunctionOpInterface op.
//===----------------------------------------------------------------------===//

/// Returns the translation info for the `funcOp`. Returns `nullptr` on failure.
Expand All @@ -59,8 +60,8 @@ getWorkgroupSize(mlir::FunctionOpInterface funcOp);
std::optional<int64_t> getSubgroupSize(mlir::FunctionOpInterface funcOp);

/// Sets and overwites the translate executable info for the given entry point.
/// Returns failure if the given entry point is not exported via
/// hal.executable.export.
/// Returns success() at the end. It is convenient when a caller need to
/// propagate the state.
LogicalResult
setTranslationInfo(mlir::FunctionOpInterface entryPoint,
IREE::Codegen::TranslationInfoAttr translationInfo);
Expand Down
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <optional>

#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h"
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir::iree_compiler {
Expand Down
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "iree/compiler/Codegen/Common/GPU/Passes.h"
#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h"
#include "iree/compiler/Codegen/Dialect/GPU/TargetUtils/ConfigUtils.h"
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir::iree_compiler {
Expand Down

0 comments on commit 615e7ff

Please sign in to comment.