Skip to content

Commit 615e7ff

Browse files
authored
[Codegen][NFC] Remove the HAL dependency from the Codegen dialect. (#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]>
1 parent 41115bb commit 615e7ff

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ iree_compiler_cc_library(
8383
":LoweringConfigInterfaceGen",
8484
":UKernelOpsGen",
8585
"//compiler/src/iree/compiler/Codegen/Interfaces:UKernelOpInterface",
86-
"//compiler/src/iree/compiler/Dialect/HAL/IR",
8786
"@llvm-project//llvm:Support",
8887
"@llvm-project//mlir:ArithDialect",
8988
"@llvm-project//mlir:ArithUtils",

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ iree_cc_library(
6363
MLIRTransformDialectTransforms
6464
MLIRViewLikeInterface
6565
iree::compiler::Codegen::Interfaces::UKernelOpInterface
66-
iree::compiler::Dialect::HAL::IR
6766
PUBLIC
6867
)
6968

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ void IREECodegenDialect::initializeCodegenAttrs() {
476476
namespace mlir::iree_compiler {
477477

478478
//===----------------------------------------------------------------------===//
479-
// Helpers for getting/setting iree_codegen.translation_info attribute on the
480-
// `hal.executable.export`
479+
// Helpers for getting/setting iree_codegen.translation_info attribute on a
480+
// FunctionOpInterface op.
481481
// ===----------------------------------------------------------------------===//
482482

483483
IREE::Codegen::TranslationInfoAttr

compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
#define IREE_COMPILER_CODEGEN_DIALECT_LOWERINGCONFIG_H_
1212

1313
#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenInterfaces.h"
14-
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
14+
#include "llvm/ADT/TypeSwitch.h"
1515
#include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h"
1616
#include "mlir/IR/Builders.h"
1717
#include "mlir/IR/BuiltinAttributes.h"
1818
#include "mlir/IR/BuiltinOps.h"
1919
#include "mlir/IR/BuiltinTypes.h"
20+
#include "mlir/Interfaces/FunctionInterfaces.h"
2021

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

4546
//===----------------------------------------------------------------------===//
46-
// Helpers for getting/setting iree_codegen.translation_info attribute on the
47-
// `hal.executable.export`
47+
// Helpers for getting/setting iree_codegen.translation_info attribute on a
48+
// FunctionOpInterface op.
4849
//===----------------------------------------------------------------------===//
4950

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

6162
/// Sets and overwites the translate executable info for the given entry point.
62-
/// Returns failure if the given entry point is not exported via
63-
/// hal.executable.export.
63+
/// Returns success() at the end. It is convenient when a caller need to
64+
/// propagate the state.
6465
LogicalResult
6566
setTranslationInfo(mlir::FunctionOpInterface entryPoint,
6667
IREE::Codegen::TranslationInfoAttr translationInfo);

compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <optional>
1616

1717
#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h"
18+
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
1819
#include "mlir/Pass/Pass.h"
1920

2021
namespace mlir::iree_compiler {

compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "iree/compiler/Codegen/Common/GPU/Passes.h"
1818
#include "iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h"
1919
#include "iree/compiler/Codegen/Dialect/GPU/TargetUtils/ConfigUtils.h"
20+
#include "iree/compiler/Dialect/HAL/IR/HALOps.h"
2021
#include "mlir/Pass/Pass.h"
2122

2223
namespace mlir::iree_compiler {

0 commit comments

Comments
 (0)