memory planner to allocate element-wise output buffer in place of input (#19067)#19067
memory planner to allocate element-wise output buffer in place of input (#19067)#19067rezaasjd wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19067
Note: Links to docs will display an error until the docs builds have been completed.
|
|
@rezaasjd has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100371295. |
This PR needs a
|
| # EdgeProgramManager or can be defined per program. | ||
| memory_planning_pass: Union[PassType, Dict[str, PassType]] = MemoryPlanningPass() | ||
| to_out_var_pass: PassType = ToOutVarPass(ignore_to_out_var_failure=False) | ||
| inplace_elem_wise_like_ops_pass: Optional[PassType] = None |
There was a problem hiding this comment.
Can you just use a custom memory plan that does this rather then updating the config?
There was a problem hiding this comment.
Yes that would be better. Fix is coming.
| """ | ||
|
|
||
| def __init__( | ||
| self, eligible_ops: Optional[Set[Callable[..., Any]]] = None |
There was a problem hiding this comment.
Hmm its a bit strange the pass itself doesnt define this set. The main concern would be if this exposes/relies on implementation details on read before write but for elementwise I think it should be fine.
There was a problem hiding this comment.
added a default set, but left the option to be overridden by the user
|
@claude review this PR |
|
Claude finished @JacobSzwejbka's task in 2m 46s —— View job Review of PR #19067: In-place element-wise memory allocation
OverviewThis PR adds in-place buffer reuse for element-wise ops: an Issues1. No testsThis is the most significant gap. There are zero tests for any of the new functionality:
The existing 2.
|
30c6c9e to
3878611
Compare
…ut (pytorch#19067) Summary: Adds a pass namely `InPlaceElemWiseLikeOpsPass` which checks for possible elem-wise ops in the graph w/o skip conection from input. The pass then annotate the output as a new alloc type called `memory.alloc_inplace`. In memory planning, the nodes with output spec type of `alloc_inplace` get output allocation in place of the same node's input. Differential Revision: D100371295
…ut (pytorch#19067) Summary: Adds a pass namely `InPlaceElemWiseLikeOpsPass` which checks for possible elem-wise ops in the graph w/o skip conection from input. The pass then annotate the output as a new alloc type called `memory.alloc_inplace`. In memory planning, the nodes with output spec type of `alloc_inplace` get output allocation in place of the same node's input. Differential Revision: D100371295
3878611 to
7ffba86
Compare
…ut (pytorch#19067) Summary: Adds a pass namely `InPlaceElemWiseLikeOpsPass` which checks for possible elem-wise ops in the graph w/o skip conection from input. The pass then annotate the output as a new alloc type called `memory.alloc_inplace`. In memory planning, the nodes with output spec type of `alloc_inplace` get output allocation in place of the same node's input. Differential Revision: D100371295
e9f3546 to
7eac5d4
Compare
…ut (pytorch#19067) Summary: Adds a pass namely `InPlaceElemWiseLikeOpsPass` which checks for possible elem-wise ops in the graph w/o skip conection from input. The pass then annotate the output as a new alloc type called `memory.alloc_inplace`. In memory planning, the nodes with output spec type of `alloc_inplace` get output allocation in place of the same node's input. Differential Revision: D100371295
|
@JacobSzwejbka I have a new rev now. |
…ut (pytorch#19067) Summary: Adds a pass namely `InPlaceElemWiseLikeOpsPass` which checks for possible elem-wise ops in the graph w/o skip conection from input. The pass then annotate the output as a new alloc type called `memory.alloc_inplace`. In memory planning, the nodes with output spec type of `alloc_inplace` get output allocation in place of the same node's input. Differential Revision: D100371295
7eac5d4 to
f1fa6fc
Compare
Summary:
Adds a pass namely
InPlaceElemWiseLikeOpsPasswhich checks for possible elem-wise ops in the graph w/o skip conection from input.The pass then annotate the output as a new alloc type called
memory.alloc_inplace.In memory planning, the nodes with output spec type of
alloc_inplaceget output allocation in place of the same node's input.Differential Revision: D100371295