Skip to content

AOTAutograd has_same_metadata call in collect_metadata_analysis.py is quadratic #136852

@ezyang

Description

@ezyang

🐛 Describe the bug

Repro:

TORCH_COMPILE_CPROFILE=1 PYTHONPATH=benchmarks/dynamo/pr_time_benchmarks/ python benchmarks/dynamo/pr_time_benchmarks/benchmarks/update_hint_benchmark.py /tmp/b.csv

with N in the benchmark set to 1000

Quadratic case is here:

            outs_with_identical_metadata_that_require_grad = (
                []
                if not isinstance(o, Tensor)
                else [
                    curr
                    for curr in out_storage_to_tensors[curr_storage]
                    if has_same_metadata(o, curr)
                    and curr.requires_grad
                    and o is not curr
                ]
            )

Here's the profile:

image

Versions

main

cc @chauhang @penguinwu @oulgen @jamesjwu @aorenste @anijain2305 @laithsakka @zou3519 @bdhirsh @yf225

Metadata

Metadata

Assignees

Labels

module: aotdispatchumbrella label for AOTAutograd issuesmodule: compile-timeCompilation mechanism or time spent in (re)compilation, tracing, startupmodule: pt2-dispatcherPT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op,oncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions