Replies: 4 comments
This comment has been hidden.
This comment has been hidden.
-
MVP should be dynamic batch |
Beta Was this translation helpful? Give feedback.
0 replies
-
Don't use a set, there should already be support for the 3 fields. Also I think the run through shape analysis then clear results and run again is simpler. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@dheerajperi I'm assuming FX (extension 2) has been absorbed in the aten::size RFC, correct? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dynamic Shapes with fallback
Goal(s)
Currently our partitioning system supports fallback to torch only for ops with static shapes. The goal is to enable automatic fallback for dynamic shape models.
Usecases
This is required in scenarios where customer has dynamic shapes in the model and
Proposed APIs / UX
Example Workflow
Today here is the current workflow in a high level
For every block
Generate random inputs based on user provided input shapes.
Segment the graph
Resolve Non Tensor inputs for TRT blocks
Register input and output for segmented blocks
Run shape analysis
The only stages that will be affected are 1) and 5).
Limitations
This will not address cases where the output shape of the subgraph is dependent on the input tensor data (a.k.a Data-Dependant shapes).
Internal Implementation
Design
The return value is a map which maps input tensor pointer to data tensor (with specified shapes).
Proposal :
Return type can be
std::unordered_map<const torch::jit::Value*, std::set< torch::jit::IValue>
The set of IValues will contain min, opt and max shaped data tensors.
Run shape analysis
In the
getSegmentsOutputByRunning
, we hold input data for a subgraph viastd::vector<torch::jit::IValue> jit_inputs_ivalues;
Simple extension is wrapping this and running it for (min, opt, max) shapes for a set of inputs. So the pseudo code would look like
Extensions Required to Core API implementations
The changes required would be the ones mentioned above
Data Structures
< Figure out if > Since each input
ir::Input
usage is now replaced with a set of three variants std::set< ir::Input >, we could typedef MinOptMaxInput = std::set< ir::Input >Implementation Phases
Prototype
There's an existing prototype based on the above design. #1111
Implement the above design with the new centralized partititoning changes.
MVP
(1.3)
The feature can be shipped if it passes the following
Extension Phase 1
(<TARGET RELEASE VERSION>)
Figure out how aten::size plays with this dynamic shapes.
Extension Phase 2
(<TARGET RELEASE VERSION>)
Explore how FX currently handles dynamic shapes + fallback. Is it easier to switch to FX for dynamic shapes + fallback ?
Beta Was this translation helpful? Give feedback.
All reactions