Skip to content

Commit

Permalink
Added current buck target as minifier dep (pytorch#97183)
Browse files Browse the repository at this point in the history
Summary: Have minifier include the current buck target as a dependency to make sure all deps are included.

Test Plan: TORCH_COMPILE_DEBUG_DIR=”.” buck2 run mode/dev-nosan //caffe2/test/inductor:minifier_smoke

Differential Revision: D44231209

Pull Request resolved: pytorch#97183
Approved by: https://github.com/anijain2305
  • Loading branch information
mlazos authored and pytorchmergebot committed Mar 22, 2023
1 parent a6d8c70 commit f6bafcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/inductor/minifier_smoke.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Owner(s): ["module: inductor"]
import os

os.environ["TORCHDYNAMO_REPRO_AFTER"] = "dynamo"
import torch
import torch._dynamo as torchdynamo
Expand Down
5 changes: 5 additions & 0 deletions torch/_dynamo/debug_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
inductor_config = import_module("torch._inductor.config")
use_buck = inductor_config.is_fbcode()

if use_buck:
import libfb.py.build_info


extra_deps = []
extra_imports = ""
Expand All @@ -36,6 +39,7 @@
"//deeplearning/fbgemm/fbgemm_gpu:sparse_ops_cpu",
"//deeplearning/fbgemm/fbgemm_gpu:sparse_ops",
]
cur_target = libfb.py.build_info.BuildInfo.get_build_rule().replace("fbcode:", "//")
extra_imports = "\n".join([f'torch.ops.load_library("{x}")' for x in extra_deps])


Expand Down Expand Up @@ -71,6 +75,7 @@ def build(self):
"//caffe2:torch",
"//caffe2/functorch:functorch",
"//triton:triton",
"{cur_target}",
],
cpp_deps = [
{extra_cpp_deps}
Expand Down

0 comments on commit f6bafcd

Please sign in to comment.