Skip to content
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

[Experimental] Add a path to fallback more nodes to CPUs #19875

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

wschin
Copy link
Contributor

@wschin wschin commented Mar 13, 2024

The same code as #19769. I can't update that PR anymore since I force-push a change.

wschin added 7 commits March 12, 2024 17:10
Shape-related nodes don't only start with `Shape` or `Size`.
In dynamo-captured ONNX model, it can starts with a graph input.
A new transform is added to fallback `all` nodes which can be
reversely traversed from a `shape-like` variable. Some
`shape-like` variables are list below.
- all inputs of Range
- 2nd input of Reshape
- 2nd input of Unsqueeze
- 1st input of ConstantOfShape
- 2nd-to-last inputs of Slice.

Fix header

Remove unused variable

Versioning shape inputs

Fix
Fix typo

Write to fixed place

Remove unused import's

run it

Fix

Change test location
@wschin wschin requested a review from a team as a code owner March 13, 2024 00:43
@wschin wschin requested a review from yuslepukhin March 13, 2024 00:43
@wschin wschin changed the title The same as #19769 [Experimental] Add a path to fallback more nodes to CPUs Mar 13, 2024
@wschin wschin force-pushed the wechi/more-cpu-fallback-for-shape branch from cc64a2e to 526b166 Compare March 13, 2024 01:50
// checking shapes will make the algorithm more unstable now.
LOGS_DEFAULT(VERBOSE) << "Call GetShapeRelatedNodes to identify extra CPU nodes." << std::endl;

const static InlinedHashMap<std::string_view, InlinedHashMap<int64_t, std::vector<size_t>>> shape_related_inputs_in_nodes = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//
// The traversal should stop when
// 1. hitting Shape, Size nodes, graph inputs, or graph initializers.
// 2. [TODO] hitting nodes with some large inputs or outputs. Before that,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more TODO documentation suggestions- #19769 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants