Skip to content

Commit 8723e9e

Browse files
SigureMopull[bot]
authored andcommitted
[SOT][3.12] Filter out duplicate store vars (#62411)
1 parent 23a6ca2 commit 8723e9e

19 files changed

Lines changed: 23 additions & 25 deletions

python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
import opcode
2929

30+
from paddle.jit.utils import OrderedSet
31+
3032
from ...profiler import EventGuard, event_register
3133
from ...psdb import NO_BREAKGRAPH_CODES
3234
from ...utils import (
@@ -1748,7 +1750,7 @@ def get_compute_fn_and_update_changed_vars(
17481750
end_idx: instruction index where simulation get break.
17491751
stack: current stack
17501752
"""
1751-
store_vars = list(stack)
1753+
store_vars = list(OrderedSet(stack))
17521754
store_var_info = {var.id: None for var in stack}
17531755

17541756
for name in restore_names:

test/sot/skip_files_py312

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/sot/test_01_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def foo(x: int, y: paddle.Tensor):
2424
return x + y
2525

2626

27-
class TestExecutor(TestCaseBase):
27+
class TestBasic(TestCaseBase):
2828
def test_simple(self):
2929
self.assert_results(foo, 1, paddle.to_tensor(2))
3030

test/sot/test_08_rot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def rot_four_return_d(
7474
return d + 1
7575

7676

77-
class TestExecutor(TestCaseBase):
77+
class TestRot(TestCaseBase):
7878
def test_simple(self):
7979
a = paddle.to_tensor(1)
8080
b = paddle.to_tensor(2)

test/sot/test_10_build_unpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def build_map_unpack_with_call(
7575
return z["a"] + 1
7676

7777

78-
class TestExecutor(TestCaseBase):
78+
class TestBuildUnpack(TestCaseBase):
7979
def test_simple(self):
8080
a = paddle.to_tensor(1)
8181
b = paddle.to_tensor(2)

test/sot/test_11_jumps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def pop_jump_if_not_none(x: bool, y: paddle.Tensor):
8181
false_tensor = paddle.to_tensor(False)
8282

8383

84-
class TestExecutor(TestCaseBase):
84+
class TestJump(TestCaseBase):
8585
def test_simple(self):
8686
self.assert_results(jump_absolute, 5, a)
8787

test/sot/test_13_make_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def fn(a, b=2, c=3, d=4):
3030
return fn(1) + fn(2, c=5) + x
3131

3232

33-
class TestExecutor(TestCaseBase):
33+
class TestMakeFunction(TestCaseBase):
3434
def test_simple(self):
3535
self.assert_results(make_fn, paddle.to_tensor(1))
3636

test/sot/test_14_operators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def operator_pos(y: int):
285285
return operator.pos(+y)
286286

287287

288-
class TestExecutor(TestCaseBase):
288+
class TestOperators(TestCaseBase):
289289
def test_simple(self):
290290
a = paddle.to_tensor(1)
291291
b = paddle.to_tensor(True)

test/sot/test_19_closure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def closure():
170170
return closure
171171

172172

173-
class TestExecutor(TestCaseBase):
173+
class TestClosure(TestCaseBase):
174174
def test_closure(self):
175175
self.assert_results(foo, 1, paddle.to_tensor(2))
176176
self.assert_results(foo2, paddle.to_tensor(2))
@@ -187,7 +187,7 @@ def test_closure(self):
187187
)
188188

189189

190-
class TestExecutor2(TestCaseBase):
190+
class TestClosure2(TestCaseBase):
191191
def test_closure(self):
192192
self.assert_results(foo7)
193193

@@ -210,7 +210,7 @@ def test_slice_in_for_loop(x, iter_num=3):
210210
return out
211211

212212

213-
class TestExecutor3(TestCaseBase):
213+
class TestClosure3(TestCaseBase):
214214
def test_closure(self):
215215
tx = paddle.to_tensor([1.0, 2.0, 3.0])
216216
# need side effect of list.
@@ -237,7 +237,7 @@ def func2():
237237
return t
238238

239239

240-
class TestExecutor4(TestCaseBase):
240+
class TestClosure4(TestCaseBase):
241241
def test_closure(self):
242242
tx = paddle.to_tensor([1.0])
243243
self.assert_results(non_local_test, tx)

test/sot/test_20_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def str_endswith():
6565
return (a1, a2, a3, a4, a5, a6, a7)
6666

6767

68-
class TestExecutor(TestCaseBase):
68+
class TestString(TestCaseBase):
6969
def test_string_format(self):
7070
self.assert_results(string_format, paddle.to_tensor(1))
7171

0 commit comments

Comments
 (0)