File tree 5 files changed +46
-0
lines changed
compiler/src/iree/compiler/GlobalOptimization
5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ iree_compiler_cc_library(
59
59
"InferNumericNarrowing.cpp" ,
60
60
"MaterializeHomogeneousEncodings.cpp" ,
61
61
"OptimizeNumerics.cpp" ,
62
+ "PackedStorage.cpp" ,
62
63
"Passes.cpp" ,
63
64
"PropagateLinalgTranspose.cpp" ,
64
65
"QuantizedConvToConv.cpp" ,
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ iree_cc_library(
55
55
"InferNumericNarrowing.cpp"
56
56
"MaterializeHomogeneousEncodings.cpp"
57
57
"OptimizeNumerics.cpp"
58
+ "PackedStorage.cpp"
58
59
"Passes.cpp"
59
60
"PropagateLinalgTranspose.cpp"
60
61
"QuantizedConvToConv.cpp"
Original file line number Diff line number Diff line change
1
+ // Copyright 2024 The IREE Authors
2
+ //
3
+ // Licensed under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+
7
+ #include " iree/compiler/GlobalOptimization/Passes.h"
8
+ #include " mlir/Dialect/Tensor/Transforms/Transforms.h"
9
+ #include " mlir/Pass/Pass.h"
10
+ #include " mlir/Transforms/GreedyPatternRewriteDriver.h"
11
+
12
+ namespace mlir ::iree_compiler::GlobalOptimization {
13
+
14
+ #define GEN_PASS_DEF_PACKSTORAGEPASS
15
+ #include " iree/compiler/GlobalOptimization/Passes.h.inc"
16
+
17
+ namespace {
18
+ struct PackStoragePass
19
+ : public impl::PackStoragePassBase<PackStoragePass> {
20
+
21
+ void runOnOperation () override ;
22
+ };
23
+ } // namespace
24
+
25
+ void PackStoragePass::runOnOperation () {
26
+ MLIRContext *context = &getContext ();
27
+ RewritePatternSet patterns (context);
28
+ return signalPassFailure ();
29
+ }
30
+
31
+ } // namespace mlir::iree_compiler::GlobalOptimization
Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ static llvm::cl::opt<int> clPadFactor(
63
63
" encodings." ),
64
64
llvm::cl::init(32 ));
65
65
66
+ static llvm::cl::opt<bool > clEnablePackStorageForI1 (
67
+ " iree-global-opt-enable-pack-storage" ,
68
+ llvm::cl::desc (" Enables packed storage for i1 tensors." ),
69
+ llvm::cl::init(true ));
70
+
66
71
void buildGlobalOptExprHoistingPassPipeline (
67
72
OpPassManager &passManager, const TransformOptions &transformOptions) {
68
73
IREE::Util::ExprHoistingOptions options;
@@ -249,6 +254,10 @@ void buildGlobalOptimizationPassPipeline(
249
254
IREE::IO::Parameters::createGenerateSplatParameterArchivePass (
250
255
generateSplatOptions));
251
256
}
257
+
258
+ if (clEnablePackStorageForI1) {
259
+ mainPassManager.addPass (createPackStoragePass ());
260
+ }
252
261
}
253
262
254
263
namespace {
Original file line number Diff line number Diff line change @@ -146,4 +146,8 @@ def DataLayoutPropagationPass : InterfacePass<"iree-global-opt-data-layout-propa
146
146
let summary = "Propagate pack/unpack ops across other ops to improve fusion";
147
147
}
148
148
149
+ def PackStoragePass : Pass<"iree-global-opt-pack-storage", ""> {
150
+ let summary = "Pack sub-byte tensor ops to improve memory access patterns";
151
+ }
152
+
149
153
#endif // IREE_COMPILER_GLOBALOPTIMIZATION_PASSES
You can’t perform that action at this time.
0 commit comments