Skip to content

Commit

Permalink
fix patch for unique mylib in torchinductor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Feb 2, 2025
1 parent 1c23e13 commit 138456c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
From 79ee5dcac30f2eba891af961f7649d15dfc6ce63 Mon Sep 17 00:00:00 2001
From 39041f5a78068d2cf58d99f76938aee95a3c7bb5 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Thu, 30 Jan 2025 13:23:14 +1100
Subject: [PATCH 20/21] make library name in
`test_mutable_custom_op_fixed_layout{,2}` unique

Suggested-By: Daniel Petry <dpetry@anaconda.com>
---
test/inductor/test_torchinductor.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
test/inductor/test_torchinductor.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/inductor/test_torchinductor.py b/test/inductor/test_torchinductor.py
index 610f5d27332..28f85e228d2 100644
index 610f5d27332..99e2169febb 100644
--- a/test/inductor/test_torchinductor.py
+++ b/test/inductor/test_torchinductor.py
@@ -10628,7 +10628,8 @@ class CommonTemplate:
Expand All @@ -23,7 +23,19 @@ index 610f5d27332..28f85e228d2 100644
mod = nn.Conv2d(3, 128, 1, stride=1, bias=False).to(device=GPU_TYPE)
inp = torch.rand(2, 3, 128, 128, device=GPU_TYPE)
expected_stride = mod(inp).clone().stride()
@@ -10681,7 +10682,8 @@ class CommonTemplate:
@@ -10664,8 +10665,9 @@ class CommonTemplate:
def fn(x):
# Inductor changes the conv to be channels-last
z = mod(x)
- output = torch.ops.mylib.bar(z, torch._dynamo.is_compiling())
- torch.ops.mylib.add_one(output)
+ mylib = importlib.import_module(f"torch.ops.{unique_lib_name}")
+ output = mylib.bar(z, torch._dynamo.is_compiling())
+ mylib.add_one(output)
return output**2

with torch.no_grad():
@@ -10681,7 +10683,8 @@ class CommonTemplate:

@config.patch(implicit_fallbacks=True)
def test_mutable_custom_op_fixed_layout(self):
Expand All @@ -33,3 +45,13 @@ index 610f5d27332..28f85e228d2 100644
lib.define(
"copy_(Tensor(a!) dst, Tensor src) -> ()",
tags=torch.Tag.needs_fixed_stride_order,
@@ -10697,7 +10700,8 @@ class CommonTemplate:

def f(x):
full_default_3 = torch.full([3], 7.0, device="cpu")
- chunk_cat_default_1 = torch.ops.mylib.copy_.default(full_default_3, x)
+ mylib = importlib.import_module(f"torch.ops.{unique_lib_name}")
+ chunk_cat_default_1 = mylib.copy_.default(full_default_3, x)
mul_out = torch.mul(full_default_3, full_default_3)
return mul_out

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3f643096358ed552ef5e97ad50d7a48d1c970e73 Mon Sep 17 00:00:00 2001
From 1780879024ea952f8591aa175a9787f93e697368 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Thu, 30 Jan 2025 08:33:44 +1100
Subject: [PATCH 21/21] avoid deprecated `find_package(CUDA)` in caffe2 CMake
Expand Down

0 comments on commit 138456c

Please sign in to comment.