-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[TIR][USMP] Integrating USMP to AoT Executor #9565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9308a3f
USMP integration with AoT executor codegen
manupak 2e945c2
USMP integration with AoT executor codegen
manupak 13afe19
USMP integration with AoT executor codegen
manupak 6aa927c
USMP integration with AoT executor codegen
manupak 6e1d305
USMP integration with AoT executor codegen
manupak 82ba5fb
USMP integration with AoT executor codegen
manupak ee9f839
USMP integration with AoT executor codegen
manupak 3d7aaa4
USMP integration with AoT executor codegen
manupak e23fe52
USMP integration with AoT executor codegen
manupak 439d1ef
USMP integration with AoT executor codegen
manupak 7558345
USMP integration with AoT executor codegen
manupak 48d25c6
USMP integration with AoT executor codegen
manupak 8235183
USMP integration with AoT executor codegen
manupak 526f307
USMP integration with AoT executor codegen
manupak 4a7c907
USMP integration with AoT executor codegen
manupak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file tir/usmp/algorithms.h | ||
| * \brief The memory planning algorithm for USMP | ||
| */ | ||
|
|
||
| #ifndef TVM_TIR_USMP_ALGORITHMS_H_ | ||
| #define TVM_TIR_USMP_ALGORITHMS_H_ | ||
|
|
||
| #include <tvm/tir/usmp/utils.h> | ||
|
|
||
| namespace tvm { | ||
| namespace tir { | ||
| namespace usmp { | ||
| namespace algo { | ||
|
|
||
| /*! | ||
| * \brief The Greedy-by-Size algorithm to plan memory | ||
| * | ||
| * This will perform a greedy algorithm in deciding the offsets | ||
| * within provided Pools, using the size of the buffer. | ||
| * | ||
| * \return A Map of BufferInfo objects and their associated PoolAllocation | ||
| */ | ||
| Map<BufferInfo, PoolAllocation> GreedyBySize(const Array<BufferInfo>& buffer_info_arr, | ||
| const Integer& memory_pressure); | ||
|
|
||
| /*! | ||
| * \brief The Greedy-by-Conflicts algorithm to plan memory | ||
| * | ||
| * This will perform a greedy algorithm in deciding the offsets | ||
| * within provided Pools, using the number of liveness conflicts of the buffer. | ||
| * | ||
| * \return A Map of BufferInfo objects and their associated PoolAllocation | ||
| */ | ||
| Map<BufferInfo, PoolAllocation> GreedyByConflicts(const Array<BufferInfo>& buffer_info_arr, | ||
| const Integer& memory_pressure); | ||
|
|
||
| } // namespace algo | ||
| } // namespace usmp | ||
| } // namespace tir | ||
| } // namespace tvm | ||
|
|
||
| #endif // TVM_TIR_USMP_ALGORITHMS_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file tir/usmp/analysis.h | ||
| * \brief The analysis passes for TIR-based Unified Static Memory Planner | ||
| */ | ||
|
|
||
| #ifndef TVM_TIR_USMP_ANALYSIS_H_ | ||
| #define TVM_TIR_USMP_ANALYSIS_H_ | ||
|
|
||
| #include <tvm/tir/function.h> | ||
| #include <tvm/tir/usmp/utils.h> | ||
|
|
||
| namespace tvm { | ||
| namespace tir { | ||
| namespace usmp { | ||
|
|
||
| /*! | ||
| * \brief Extract BufferInfo objects from a TIR IRModule | ||
| * | ||
| * This pass would extract the buffer information of allocate nodes | ||
| * including liveness conflict with other buffer info objects. | ||
| * | ||
| * \return A Map of BufferInfo objects and their associated Stmts | ||
| */ | ||
| BufferInfoAnalysis ExtractBufferInfo(const PrimFunc& main_func, const IRModule& mod); | ||
|
|
||
| } // namespace usmp | ||
| } // namespace tir | ||
| } // namespace tvm | ||
|
|
||
| #endif // TVM_TIR_USMP_ANALYSIS_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file tir/usmp/transform.h | ||
| * \brief The transform passes for TIR-based Unified Static Memory Planner | ||
| */ | ||
|
|
||
| #ifndef TVM_TIR_USMP_TRANSFORM_H_ | ||
| #define TVM_TIR_USMP_TRANSFORM_H_ | ||
|
|
||
| #include <tvm/tir/usmp/utils.h> | ||
|
|
||
| namespace tvm { | ||
| namespace tir { | ||
| namespace usmp { | ||
| namespace transform { | ||
|
|
||
| using Pass = tvm::transform::Pass; | ||
|
|
||
| /*! | ||
| * \brief Convert the analyzed PoolAllocation to offsets from pool variables | ||
| * | ||
| * This pass would convert the main function to accept pool variables as an input | ||
| * that get passed onto the operator PrimFuncs. Furthermore, the static allocations | ||
| * will be converted to offsets within the pool variable. | ||
| * | ||
| * \return the pass | ||
| */ | ||
| TVM_DLL Pass ConvertPoolAllocationsToOffsets(const Map<tir::Stmt, PoolAllocation>& pool_allocations, | ||
| Bool emit_tvmscript_printable = Bool(false)); | ||
|
|
||
| /*! | ||
| * \brief Assign PoolInfo objects to tir.allocate nodes depending on the PrimFunc's target | ||
| * | ||
| * This pass would assign default PoolInfo objects to allocate nodes that are not otherwise | ||
| * annotated, depending on pool info supplied for each target. | ||
| * | ||
| * \return the pass | ||
| */ | ||
| TVM_DLL Pass AssignPoolInfo(); | ||
|
|
||
| } // namespace transform | ||
| } // namespace usmp | ||
| } // namespace tir | ||
| } // namespace tvm | ||
|
|
||
| #endif // TVM_TIR_USMP_TRANSFORM_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.