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

Dynamic opt script #457

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion core/shark_turbine/aot/builtins/jittable.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@

"""Tracing builtins."""

from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Union
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Sequence,
Set,
Tuple,
Union,
)

import torch
from torch._decomp import get_decompositions
Expand Down Expand Up @@ -206,6 +216,12 @@ def flat_wrapped_f(*args):
if "functorch_functionalize" in self._passes:
transformed_f = functorch_functionalize(transformed_f, *flat_pytorch_args)

for node in transformed_f.graph.nodes:
if node.op == "call_function":
if node.target == torch._ops.ops.aten.lift_fresh_copy.default:
node.target = torch._ops.ops.aten.clone.default
transformed_f.recompile()

# Ask dynamo to give us an aten graph.
# TODO: Cache this for repeated calls.
logger.debug("Performing dynamo.export(constraints=%r)", constraints)
Expand Down
Loading