Skip to content

Commit

Permalink
Disable hoisting target-dependent ops to globals
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhanW committed Aug 28, 2023
1 parent 7c0775b commit ab27aef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ iree_compiler_cc_library(
"OpOracle.h",
],
deps = [
"//compiler/src/iree/compiler/Codegen/Dialect:IREECodegenDialect",
"//compiler/src/iree/compiler/Dialect/Util/Analysis",
"//compiler/src/iree/compiler/Dialect/Util/IR",
"//llvm-external-projects/iree-dialects:IREELinalgExtDialect",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:ArithDialect",
"@llvm-project//mlir:FuncDialect",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ iree_cc_library(
"ConstExpr.cpp"
"OpOracle.cpp"
DEPS
IREELinalgExtDialect
LLVMSupport
MLIRArithDialect
MLIRFuncDialect
MLIRIR
MLIRLinalgDialect
MLIRSupport
MLIRTensorDialect
iree::compiler::Codegen::Dialect::IREECodegenDialect
iree::compiler::Dialect::Util::Analysis
iree::compiler::Dialect::Util::IR
PUBLIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "iree/compiler/Dialect/Util/Analysis/Constant/OpOracle.h"

#include "iree-dialects/Dialect/LinalgExt/IR/LinalgExtOps.h"
#include "iree/compiler/Codegen/Dialect/IREECodegenOps.h"
#include "iree/compiler/Dialect/Util/IR/UtilDialect.h"
#include "iree/compiler/Dialect/Util/IR/UtilOps.h"
#include "llvm/ADT/SmallPtrSet.h"
Expand Down Expand Up @@ -100,6 +102,12 @@ ConstExprOpInfo ConstExprOpInfo::getForOp(Operation *op) {
return {};
}

// Target-dependent ops are not const-expr.
if (isa<IREE::LinalgExt::UpperBoundTileSizeOp, IREE::LinalgExt::SetEncodingOp,
IREE::Codegen::QueryTileSizesOp>(op)) {
return {};
}

// By default, ops without results are not const-expr.
if (op->getNumResults() == 0) {
return {};
Expand Down

0 comments on commit ab27aef

Please sign in to comment.