Skip to content

Commit

Permalink
Adding conv filter layout fhwc to preprocessing pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: jerryyin <[email protected]>
  • Loading branch information
jerryyin committed Feb 12, 2025
1 parent d3cfe11 commit 0be3371
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ class ConvertConvFilterToChannelsLastPass
LDBG("convert-filter-to-channels-last pass didn't apply since an "
"unsupported layout is given. Please use hwfc or fhwc as pass "
"filter-layout option.");
// TODO add default fallback to filter layout once we have more data
// about models with the two layouts
return signalPassFailure();
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Preprocessing/Common/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def ConvertConvFilterToChannelsLastPass:
let summary = "Convert linalg convolutions filter from hwcf to channel last layout.";
let options = [
Option<"filterLayout", "filter-layout", "std::string",
/*default=*/"", "Filter layout of convolution.">,
/*default=*/"\"fhwc\"", "Filter layout of convolution.">,
];
let dependentDialects = [
"mlir::linalg::LinalgDialect",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(util.func(iree-preprocessing-convert-conv-filter-to-channels-last{filter-layout=hwfc}))" %s | FileCheck --check-prefixes=CHECK-HWFC,CHECK-ALL %s
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(util.func(iree-preprocessing-convert-conv-filter-to-channels-last{filter-layout=fhwc}))" %s | FileCheck --check-prefixes=CHECK-FHWC,CHECK-ALL %s
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(util.func(iree-preprocessing-convert-conv-filter-to-channels-last))" %s | FileCheck --check-prefixes=CHECK-FHWC,CHECK-ALL %s

// CHECK-HWFC: #[[$MAP:.+]] = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d4, d5, d3, d6)>
// CHECK-FHWC: #[[$MAP:.+]] = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d3, d4, d5, d6)>
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/iree/compiler/Preprocessing/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ buildTransposeConvolutionPassPipeline(OpPassManager &passManager,
.addPass(GlobalOptimization::createDetachElementwiseFromNamedOpsPass)
.addPass(mlir::createLinalgNamedOpConversionPass)
.addPass(GlobalOptimization::createConvert1X1FilterConv2DToMatmulPass)
.addPass(createConvertConvToChannelsLastPass);
.addPass(createConvertConvToChannelsLastPass)
.addPass(createConvertConvFilterToChannelsLastPass);
passManager.addPass(DispatchCreation::createFoldUnitExtentDimsPass());
passManager.addPass(createCanonicalizerPass());
passManager.addPass(createCSEPass());
Expand Down

0 comments on commit 0be3371

Please sign in to comment.