Merged
refactor(pass): Hide enable_slice from Python side #6516
zhaosenqiuAdd on Sep 20
refactor(pass): Hide enable_slice from Python side #6516
Merged
zhaosenqiuAdd on Sep 20
Total: 376 files changed+449-1904
@@ -64,21 +64,6 @@ def pytest_addoption(parser: pytest.Parser):
64 )64 )
65 65 
66 66 
67-def pytest_configure(config):
68- """Set enable_slice=true on root scope at pytest startup.
69- 
70- Overrides the false default in tile_fwk_config.json. The root scope is not affected by
71- config::Reset() / reset_options(), so Clear() in UT SetUp will not clear this setting.
72- Individual test cases can still override via @pypto.options(pass_options={"enable_slice": False}).
73- """
74- try:
75- import pypto.pypto_impl
76- 
77- pypto.pypto_impl.SetGlobalConfig({"pass.enable_slice": True})
78- except Exception:
79- pass
80- 
81- 
82def _is_case_match_cards(item, target_cards) -> bool:67def _is_case_match_cards(item, target_cards) -> bool:
83 """68 """
84 Check whether a test case matches the target number of cards69 Check whether a test case matches the target number of cards
@@ -313,7 +313,6 @@ def pipeline_demo_kernel(
313 313 
314 314 
315@pytest.mark.soc("950")315@pytest.mark.soc("950")
316-@pypto.options(pass_options={"enable_slice": False})
317def test_pipeline_demo_kernel():316def test_pipeline_demo_kernel():
318 device = ST_DEVICE317 device = ST_DEVICE
319 torch.npu.set_device(device)318 torch.npu.set_device(device)
@@ -33,7 +33,6 @@ def add_kernel(
33 out[:] = (a + b) * 2.033 out[:] = (a + b) * 2.0
34 34 
35 35 
36-@pypto.options(pass_options={"enable_slice": True})
37def test_add(device):36def test_add(device):
38 shape = (64, 64)37 shape = (64, 64)
39 38 
@@ -51,7 +50,6 @@ def erfc_kernel(x: pypto.Tensor[[...], pypto.DT_FP32], out: pypto.Tensor[[...],
51 out[:] = pypto.erfc(x)50 out[:] = pypto.erfc(x)
52 51 
53 52 
54-@pypto.options(pass_options={"enable_slice": True})
55def test_erfc(device):53def test_erfc(device):
56 shape = (64, 64)54 shape = (64, 64)
57 55 
@@ -72,7 +70,6 @@ def matmul_kernel(
72 out.move(pypto.matmul(a, b, a.dtype))70 out.move(pypto.matmul(a, b, a.dtype))
73 71 
74 72 
75-@pypto.options(pass_options={"enable_slice": True})
76def test_matmul(device):73def test_matmul(device):
77 m, k, n = 64, 128, 6474 m, k, n = 64, 128, 64
78 75 
@@ -90,7 +87,6 @@ def sum_kernel(a: pypto.Tensor[[...], pypto.DT_FP32], out: pypto.Tensor[[...], p
90 out[:] = pypto.sum(a, dim=-1, keepdim=False)87 out[:] = pypto.sum(a, dim=-1, keepdim=False)
91 88 
92 89 
93-@pypto.options(pass_options={"enable_slice": True})
94def test_sum(device):90def test_sum(device):
95 a = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.float32, device=device)91 a = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.float32, device=device)
96 out = torch.empty((2), dtype=torch.float32, device=device)92 out = torch.empty((2), dtype=torch.float32, device=device)
@@ -133,7 +129,6 @@ def dynamic_add_kernel(
133 pypto.assemble(tile, [m * block_m, n * block_n], output)129 pypto.assemble(tile, [m * block_m, n * block_n], output)
134 130 
135 131 
136-@pypto.options(pass_options={"enable_slice": True})
137def test_dynamic_add(device):132def test_dynamic_add(device):
138 m, n = 512, 512133 m, n = 512, 512
139 block_m, block_n = 128, 128134 block_m, block_n = 128, 128
@@ -80,7 +80,6 @@ def abs_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.D
80 out[:] = pypto.abs(x)80 out[:] = pypto.abs(x)
81 81 
82 82 
83-@pypto.options(pass_options={"enable_slice": True})
84def test_abs_basic(device_id: int = None):83def test_abs_basic(device_id: int = None):
85 """Test basic usage of abs function"""84 """Test basic usage of abs function"""
86 print("=" * 60)85 print("=" * 60)
@@ -115,7 +114,6 @@ def add_kernel(
115 out[:] = pypto.add(a, b)114 out[:] = pypto.add(a, b)
116 115 
117 116 
118-@pypto.options(pass_options={"enable_slice": True})
119def test_add_basic(device_id: int = None):117def test_add_basic(device_id: int = None):
120 """Test basic usage of add function"""118 """Test basic usage of add function"""
121 print("=" * 60)119 print("=" * 60)
@@ -146,7 +144,6 @@ def add_broadcast_kernel(
146 out[:] = pypto.add(a, b)144 out[:] = pypto.add(a, b)
147 145 
148 146 
149-@pypto.options(pass_options={"enable_slice": True})
150def test_add_broadcast(device_id: int = None):147def test_add_broadcast(device_id: int = None):
151 """Test broadcasting between tensors of different shapes"""148 """Test broadcasting between tensors of different shapes"""
152 print("=" * 60)149 print("=" * 60)
@@ -175,7 +172,6 @@ def add_scalar_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([],
175 out[:] = pypto.add(x, scalar)172 out[:] = pypto.add(x, scalar)
176 173 
177 174 
178-@pypto.options(pass_options={"enable_slice": True})
179def test_add_scalar(device_id: int = None):175def test_add_scalar(device_id: int = None):
180 """Test adding a scalar to a tensor"""176 """Test adding a scalar to a tensor"""
181 print("=" * 60)177 print("=" * 60)
@@ -214,7 +210,6 @@ def clip_kernel(
214 out[:] = pypto.clip(a, min_, max_)210 out[:] = pypto.clip(a, min_, max_)
215 211 
216 212 
217-@pypto.options(pass_options={"enable_slice": True})
218def test_clip_basic(device_id: int = None):213def test_clip_basic(device_id: int = None):
219 """Test basic usage of clip function"""214 """Test basic usage of clip function"""
220 print("=" * 60)215 print("=" * 60)
@@ -249,7 +244,6 @@ def clip_broadcast_kernel(
249 out[:] = pypto.clip(a, min_, max_)244 out[:] = pypto.clip(a, min_, max_)
250 245 
251 246 
252-@pypto.options(pass_options={"enable_slice": True})
253def test_clip_broadcast(device_id: int = None):247def test_clip_broadcast(device_id: int = None):
254 """Test broadcasting between tensors of different shapes"""248 """Test broadcasting between tensors of different shapes"""
255 print("=" * 60)249 print("=" * 60)
@@ -286,7 +280,6 @@ def div_kernel(
286 out[:] = pypto.div(a, b)280 out[:] = pypto.div(a, b)
287 281 
288 282 
289-@pypto.options(pass_options={"enable_slice": True})
290def test_div_basic(device_id: int = None):283def test_div_basic(device_id: int = None):
291 """Test basic usage of div function"""284 """Test basic usage of div function"""
292 print("=" * 60)285 print("=" * 60)
@@ -317,7 +310,6 @@ def div_broadcast_kernel(
317 out[:] = pypto.div(a, b)310 out[:] = pypto.div(a, b)
318 311 
319 312 
320-@pypto.options(pass_options={"enable_slice": True})
321def test_div_broadcast(device_id: int = None):313def test_div_broadcast(device_id: int = None):
322 """Test broadcasting between tensors of different shapes"""314 """Test broadcasting between tensors of different shapes"""
323 print("=" * 60)315 print("=" * 60)
@@ -346,7 +338,6 @@ def div_scalar_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([],
346 out[:] = pypto.div(a, scalar)338 out[:] = pypto.div(a, scalar)
347 339 
348 340 
349-@pypto.options(pass_options={"enable_slice": True})
350def test_div_scalar(device_id: int = None):341def test_div_scalar(device_id: int = None):
351 """Test diving a scalar to a tensor"""342 """Test diving a scalar to a tensor"""
352 print("=" * 60)343 print("=" * 60)
@@ -380,7 +371,6 @@ def exp_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.D
380 out[:] = pypto.exp(x)371 out[:] = pypto.exp(x)
381 372 
382 373 
383-@pypto.options(pass_options={"enable_slice": True})
384def test_exp_basic(device_id: int = None):374def test_exp_basic(device_id: int = None):
385 """Test basic usage of exp function"""375 """Test basic usage of exp function"""
386 print("=" * 60)376 print("=" * 60)
@@ -413,7 +403,6 @@ def exp2_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.
413 out[:] = pypto.exp2(x)403 out[:] = pypto.exp2(x)
414 404 
415 405 
416-@pypto.options(pass_options={"enable_slice": True})
417def test_exp2_basic(device_id: int = None):406def test_exp2_basic(device_id: int = None):
418 """Test basic usage of exp2 function"""407 """Test basic usage of exp2 function"""
419 print("=" * 60)408 print("=" * 60)
@@ -446,7 +435,6 @@ def expm1_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto
446 out[:] = pypto.expm1(x)435 out[:] = pypto.expm1(x)
447 436 
448 437 
449-@pypto.options(pass_options={"enable_slice": True})
450def test_expm1_basic(device_id: int = None):438def test_expm1_basic(device_id: int = None):
451 """Test basic usage of expm1 function"""439 """Test basic usage of expm1 function"""
452 print("=" * 60)440 print("=" * 60)
@@ -479,7 +467,6 @@ def log_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.D
479 out[:] = pypto.log(a)467 out[:] = pypto.log(a)
480 468 
481 469 
482-@pypto.options(pass_options={"enable_slice": True})
483def test_log_basic(device_id: int = None):470def test_log_basic(device_id: int = None):
484 """Test basic usage of log function"""471 """Test basic usage of log function"""
485 print("=" * 60)472 print("=" * 60)
@@ -514,7 +501,6 @@ def mul_kernel(
514 out[:] = pypto.mul(a, b)501 out[:] = pypto.mul(a, b)
515 502 
516 503 
517-@pypto.options(pass_options={"enable_slice": True})
518def test_mul_basic(device_id: int = None):504def test_mul_basic(device_id: int = None):
519 """Test basic usage of mul function"""505 """Test basic usage of mul function"""
520 print("=" * 60)506 print("=" * 60)
@@ -545,7 +531,6 @@ def mul_broadcast_kernel(
545 out[:] = pypto.mul(a, b)531 out[:] = pypto.mul(a, b)
546 532 
547 533 
548-@pypto.options(pass_options={"enable_slice": True})
549def test_mul_broadcast(device_id: int = None):534def test_mul_broadcast(device_id: int = None):
550 """Test broadcasting between tensors of different shapes"""535 """Test broadcasting between tensors of different shapes"""
551 print("=" * 60)536 print("=" * 60)
@@ -574,7 +559,6 @@ def mul_scalar_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([],
574 out[:] = pypto.mul(a, scalar)559 out[:] = pypto.mul(a, scalar)
575 560 
576 561 
577-@pypto.options(pass_options={"enable_slice": True})
578def test_mul_scalar(device_id: int = None):562def test_mul_scalar(device_id: int = None):
579 """Test muling a scalar to a tensor"""563 """Test muling a scalar to a tensor"""
580 print("=" * 60)564 print("=" * 60)
@@ -608,7 +592,6 @@ def neg_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.D
608 out[:] = pypto.neg(a)592 out[:] = pypto.neg(a)
609 593 
610 594 
611-@pypto.options(pass_options={"enable_slice": True})
612def test_neg_basic(device_id: int = None):595def test_neg_basic(device_id: int = None):
613 """Test basic usage of neg function"""596 """Test basic usage of neg function"""
614 print("=" * 60)597 print("=" * 60)
@@ -641,7 +624,6 @@ def pow_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.D
641 out[:] = pypto.pow(a, b)624 out[:] = pypto.pow(a, b)
642 625 
643 626 
644-@pypto.options(pass_options={"enable_slice": True})
645def test_pow_basic(device_id: int = None):627def test_pow_basic(device_id: int = None):
646 """Test basic usage of pow function"""628 """Test basic usage of pow function"""
647 print("=" * 60)629 print("=" * 60)
@@ -675,7 +657,6 @@ def round_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto
675 out[:] = pypto.round(a, decimals=decimals)657 out[:] = pypto.round(a, decimals=decimals)
676 658 
677 659 
678-@pypto.options(pass_options={"enable_slice": True})
679def test_round_basic(device_id: int = None):660def test_round_basic(device_id: int = None):
680 """Test basic usage of round function"""661 """Test basic usage of round function"""
681 print("=" * 60)662 print("=" * 60)
@@ -709,7 +690,6 @@ def rsqrt_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto
709 out[:] = pypto.rsqrt(a)690 out[:] = pypto.rsqrt(a)
710 691 
711 692 
712-@pypto.options(pass_options={"enable_slice": True})
713def test_rsqrt_basic(device_id: int = None):693def test_rsqrt_basic(device_id: int = None):
714 """Test basic usage of rsqrt function"""694 """Test basic usage of rsqrt function"""
715 print("=" * 60)695 print("=" * 60)
@@ -742,7 +722,6 @@ def ceil_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.
742 out[:] = pypto.ceil(a)722 out[:] = pypto.ceil(a)
743 723 
744 724 
745-@pypto.options(pass_options={"enable_slice": True})
746def test_ceil_basic(device_id: int = None):725def test_ceil_basic(device_id: int = None):
747 """Test basic usage of ceil function"""726 """Test basic usage of ceil function"""
748 print("=" * 60)727 print("=" * 60)
@@ -775,7 +754,6 @@ def floor_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto
775 out[:] = pypto.floor(a)754 out[:] = pypto.floor(a)
776 755 
777 756 
778-@pypto.options(pass_options={"enable_slice": True})
779def test_floor_basic(device_id: int = None):757def test_floor_basic(device_id: int = None):
780 """Test basic usage of floor function"""758 """Test basic usage of floor function"""
781 print("=" * 60)759 print("=" * 60)
@@ -808,7 +786,6 @@ def trunc_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto
808 out[:] = pypto.trunc(a)786 out[:] = pypto.trunc(a)
809 787 
810 788 
811-@pypto.options(pass_options={"enable_slice": True})
812def test_trunc_basic(device_id: int = None):789def test_trunc_basic(device_id: int = None):
813 """Test basic usage of trunc function"""790 """Test basic usage of trunc function"""
814 print("=" * 60)791 print("=" * 60)
@@ -841,7 +818,6 @@ def sqrt_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.
841 out[:] = pypto.sqrt(a)818 out[:] = pypto.sqrt(a)
842 819 
843 820 
844-@pypto.options(pass_options={"enable_slice": True})
845def test_sqrt_basic(device_id: int = None):821def test_sqrt_basic(device_id: int = None):
846 """Test basic usage of sqrt function"""822 """Test basic usage of sqrt function"""
847 print("=" * 60)823 print("=" * 60)
@@ -876,7 +852,6 @@ def sub_kernel(
876 out[:] = pypto.sub(a, b)852 out[:] = pypto.sub(a, b)
877 853 
878 854 
879-@pypto.options(pass_options={"enable_slice": True})
880def test_sub_basic(device_id: int = None):855def test_sub_basic(device_id: int = None):
881 """Test basic usage of sub function"""856 """Test basic usage of sub function"""
882 print("=" * 60)857 print("=" * 60)
@@ -907,7 +882,6 @@ def sub_broadcast_kernel(
907 out[:] = pypto.sub(a, b)882 out[:] = pypto.sub(a, b)
908 883 
909 884 
910-@pypto.options(pass_options={"enable_slice": True})
911def test_sub_broadcast(device_id: int = None):885def test_sub_broadcast(device_id: int = None):
912 """Test broadcasting between tensors of different shapes"""886 """Test broadcasting between tensors of different shapes"""
913 print("=" * 60)887 print("=" * 60)
@@ -936,7 +910,6 @@ def sub_scalar_kernel(a: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([],
936 out[:] = pypto.sub(a, scalar)910 out[:] = pypto.sub(a, scalar)
937 911 
938 912 
939-@pypto.options(pass_options={"enable_slice": True})
940def test_sub_scalar(device_id: int = None):913def test_sub_scalar(device_id: int = None):
941 """Test subing a scalar to a tensor"""914 """Test subing a scalar to a tensor"""
942 print("=" * 60)915 print("=" * 60)
@@ -82,7 +82,6 @@ def matmul_kernel(
82 out[:] = pypto.matmul(a, b, pypto.DT_FP32)82 out[:] = pypto.matmul(a, b, pypto.DT_FP32)
83 83 
84 84 
85-@pypto.options(pass_options={"enable_slice": True})
86def test_matmul_basic(device_id: int = None):85def test_matmul_basic(device_id: int = None):
87 """Test basic matrix multiplication"""86 """Test basic matrix multiplication"""
88 print("=" * 60)87 print("=" * 60)
@@ -113,7 +112,6 @@ def matmul_batch_kernel(
113 out[:] = pypto.matmul(a, b, pypto.DT_FP32)112 out[:] = pypto.matmul(a, b, pypto.DT_FP32)
114 113 
115 114 
116-@pypto.options(pass_options={"enable_slice": True})
117def test_matmul_batch(device_id: int = None):115def test_matmul_batch(device_id: int = None):
118 """Test batch matrix multiplication"""116 """Test batch matrix multiplication"""
119 print("=" * 60)117 print("=" * 60)
@@ -144,7 +142,6 @@ def matmul_broadcast_kernel(
144 out[:] = pypto.matmul(a, b, pypto.DT_FP32)142 out[:] = pypto.matmul(a, b, pypto.DT_FP32)
145 143 
146 144 
147-@pypto.options(pass_options={"enable_slice": True})
148def test_matmul_broadcast(device_id: int = None):145def test_matmul_broadcast(device_id: int = None):
149 """Test batch matrix multiplication with broadcasting"""146 """Test batch matrix multiplication with broadcasting"""
150 print("=" * 60)147 print("=" * 60)
@@ -183,7 +180,6 @@ def matmul_trans_left_kernel(
183 out[:] = pypto.matmul(a, b, pypto.DT_FP32, a_trans=True)180 out[:] = pypto.matmul(a, b, pypto.DT_FP32, a_trans=True)
184 181 
185 182 
186-@pypto.options(pass_options={"enable_slice": True})
187def test_matmul_trans(device_id: int = None):183def test_matmul_trans(device_id: int = None):
188 """Test matrix multiplication with transposition"""184 """Test matrix multiplication with transposition"""
189 print("=" * 60)185 print("=" * 60)
@@ -246,7 +242,6 @@ def matmul_bias_kernel(
246 out[:] = pypto.matmul(a, b, pypto.DT_FP32, extend_params=extend_params)242 out[:] = pypto.matmul(a, b, pypto.DT_FP32, extend_params=extend_params)
247 243 
248 244 
249-@pypto.options(pass_options={"enable_slice": True})
250def test_matmul_bias(device_id: int = None):245def test_matmul_bias(device_id: int = None):
251 """Test matrix multiplication with bias"""246 """Test matrix multiplication with bias"""
252 print("=" * 60)247 print("=" * 60)
@@ -99,7 +99,6 @@ def sum_op(a: torch.Tensor, dim: int, keepdim: bool = False) -> torch.Tensor:
99 return out99 return out
100 100 
101 101 
102-@pypto.options(pass_options={"enable_slice": True})
103def test_sum_basic(device_id: int = None):102def test_sum_basic(device_id: int = None):
104 """Test basic usage of sum function"""103 """Test basic usage of sum function"""
105 print("=" * 60)104 print("=" * 60)
@@ -133,7 +132,6 @@ def test_sum_basic(device_id: int = None):
133 print("✓ Basic usage of sum function completed successfully")132 print("✓ Basic usage of sum function completed successfully")
134 133 
135 134 
136-@pypto.options(pass_options={"enable_slice": True})
137def test_sum_different_dimensions(device_id: int = None):135def test_sum_different_dimensions(device_id: int = None):
138 """Test reducing along different dimensions"""136 """Test reducing along different dimensions"""
139 print("=" * 60)137 print("=" * 60)
@@ -206,7 +204,6 @@ def amax_op(a: torch.Tensor, dim: int, keepdim: bool = False) -> torch.Tensor:
206 return out204 return out
207 205 
208 206 
209-@pypto.options(pass_options={"enable_slice": True})
210def test_amax_basic(device_id: int = None):207def test_amax_basic(device_id: int = None):
211 """Test basic usage of amax function"""208 """Test basic usage of amax function"""
212 print("=" * 60)209 print("=" * 60)
@@ -244,7 +241,6 @@ def test_amax_basic(device_id: int = None):
244 print("✓ Basic usage of amax function completed successfully")241 print("✓ Basic usage of amax function completed successfully")
245 242 
246 243 
247-@pypto.options(pass_options={"enable_slice": True})
248def test_amax_different_dimensions(device_id: int = None):244def test_amax_different_dimensions(device_id: int = None):
249 """Test reducing along different dimensions"""245 """Test reducing along different dimensions"""
250 print("=" * 60)246 print("=" * 60)
@@ -317,7 +313,6 @@ def amin_op(a: torch.Tensor, dim: int, keepdim: bool = False) -> torch.Tensor:
317 return out313 return out
318 314 
319 315 
320-@pypto.options(pass_options={"enable_slice": True})
321def test_amin_basic(device_id: int = None):316def test_amin_basic(device_id: int = None):
322 """Test basic usage of amin function"""317 """Test basic usage of amin function"""
323 print("=" * 60)318 print("=" * 60)
@@ -355,7 +350,6 @@ def test_amin_basic(device_id: int = None):
355 print("✓ Basic usage of amin function completed successfully")350 print("✓ Basic usage of amin function completed successfully")
356 351 
357 352 
358-@pypto.options(pass_options={"enable_slice": True})
359def test_amin_different_dimensions(device_id: int = None):353def test_amin_different_dimensions(device_id: int = None):
360 """Test reducing along different dimensions"""354 """Test reducing along different dimensions"""
361 print("=" * 60)355 print("=" * 60)
@@ -427,7 +421,6 @@ def maximum_op(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
427 return out421 return out
428 422 
429 423 
430-@pypto.options(pass_options={"enable_slice": True})
431def test_maximum_basic(device_id: int = None):424def test_maximum_basic(device_id: int = None):
432 """Test basic usage of maximum function"""425 """Test basic usage of maximum function"""
433 print("=" * 60)426 print("=" * 60)
@@ -487,7 +480,6 @@ def minimum_op(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
487 return out480 return out
488 481 
489 482 
490-@pypto.options(pass_options={"enable_slice": True})
491def test_minimum_basic(device_id: int = None):483def test_minimum_basic(device_id: int = None):
492 """Test basic usage of minimum function"""484 """Test basic usage of minimum function"""
493 print("=" * 60)485 print("=" * 60)
@@ -83,7 +83,6 @@ def compute_with_cube_tile_shapes_kernel(
83 out.move(pypto.matmul(a, b, a.dtype))83 out.move(pypto.matmul(a, b, a.dtype))
84 84 
85 85 
86-@pypto.options(pass_options={"enable_slice": True})
87def test_set_cube_tile_shapes_basic(device_id: int = None):86def test_set_cube_tile_shapes_basic(device_id: int = None):
88 """Test basic usage of set_cube_tile_shapes function"""87 """Test basic usage of set_cube_tile_shapes function"""
89 print("=" * 60)88 print("=" * 60)
@@ -152,7 +151,6 @@ def create_different_tile_shapes_kernel(run_mode=global_run_mode):
152 return compute_with_different_tile_shapes151 return compute_with_different_tile_shapes
153 152 
154 153 
155-@pypto.options(pass_options={"enable_slice": True})
156def test_set_different_tile_shapes_result(device_id: int = None):154def test_set_different_tile_shapes_result(device_id: int = None):
157 """Test the impact of different tile shape settings on calculation results"""155 """Test the impact of different tile shape settings on calculation results"""
158 print("=" * 60)156 print("=" * 60)
@@ -202,7 +200,6 @@ def compute_with_tile_64_kernel(
202 out.move(pypto.matmul(a, b, a.dtype, b_trans=True))200 out.move(pypto.matmul(a, b, a.dtype, b_trans=True))
203 201 
204 202 
205-@pypto.options(pass_options={"enable_slice": True})
206def test_set_different_tile_shapes_runtime(device_id: int = None):203def test_set_different_tile_shapes_runtime(device_id: int = None):
207 """Test the impact of different tile shape settings on runtime"""204 """Test the impact of different tile shape settings on runtime"""
208 print("=" * 60)205 print("=" * 60)
@@ -249,7 +246,6 @@ def compute_with_vec_tile_shapes_kernel(
249 out.move(pypto.add(a, b))246 out.move(pypto.add(a, b))
250 247 
251 248 
252-@pypto.options(pass_options={"enable_slice": True})
253def test_set_vec_tile_shapes_basic(device_id: int = None):249def test_set_vec_tile_shapes_basic(device_id: int = None):
254 """Test basic usage of set_vec_tile_shapes function"""250 """Test basic usage of set_vec_tile_shapes function"""
255 print("=" * 60)251 print("=" * 60)
@@ -314,7 +310,6 @@ def compute_with_vec_different_tile_shapes_kernel(
314 out3.move(pypto.add(a, b))310 out3.move(pypto.add(a, b))
315 311 
316 312 
317-@pypto.options(pass_options={"enable_slice": True})
318def test_set_vec_different_tile_shapes_result(device_id: int = None):313def test_set_vec_different_tile_shapes_result(device_id: int = None):
319 """Test the impact of different tile shape settings on calculation results"""314 """Test the impact of different tile shape settings on calculation results"""
320 print("=" * 60)315 print("=" * 60)
@@ -349,7 +344,6 @@ def compute_with_vec_tile_kernel(a: pypto.Tensor(), b: pypto.Tensor(), out: pypt
349 out.move(pypto.add(a, b))344 out.move(pypto.add(a, b))
350 345 
351 346 
352-@pypto.options(pass_options={"enable_slice": True})
353def test_set_vec_different_tile_shapes_runtime(device_id: int = None):347def test_set_vec_different_tile_shapes_runtime(device_id: int = None):
354 """Test the impact of different tile shape settings on runtime"""348 """Test the impact of different tile shape settings on runtime"""
355 print("=" * 60)349 print("=" * 60)
@@ -94,7 +94,6 @@ def add_scalar_loop_view_assemble_kernel(
94 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)94 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)
95 95 
96 96 
97-@pypto.options(pass_options={"enable_slice": True})
98def test_add_scalar_loop_view_assemble(device_id=None, dynamic: bool = True) -> None:97def test_add_scalar_loop_view_assemble(device_id=None, dynamic: bool = True) -> None:
99 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'98 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'
100 99 
@@ -82,7 +82,6 @@ def assemble_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], py
82 pypto.assemble(x, offsets, out)82 pypto.assemble(x, offsets, out)
83 83 
84 84 
85-@pypto.options(pass_options={"enable_slice": True})
86def test_assemble_basic(device_id: int = None):85def test_assemble_basic(device_id: int = None):
87 """Test basic usage of assemble function"""86 """Test basic usage of assemble function"""
88 print("=" * 60)87 print("=" * 60)
@@ -108,7 +107,6 @@ def test_assemble_basic(device_id: int = None):
108 assert_allclose(out.cpu().numpy(), expected.cpu().numpy(), rtol=1e-3, atol=1e-3)107 assert_allclose(out.cpu().numpy(), expected.cpu().numpy(), rtol=1e-3, atol=1e-3)
109 108 
110 109 
111-@pypto.options(pass_options={"enable_slice": True})
112def test_assemble_different_offsets_shapes(device_id: int = None):110def test_assemble_different_offsets_shapes(device_id: int = None):
113 """Test basic usage of assemble function"""111 """Test basic usage of assemble function"""
114 print("=" * 60)112 print("=" * 60)
@@ -174,7 +172,6 @@ def gather_kernel(
174 out[:] = pypto.gather(input_tensor, dim, index_tensor)172 out[:] = pypto.gather(input_tensor, dim, index_tensor)
175 173 
176 174 
177-@pypto.options(pass_options={"enable_slice": True})
178def test_gather_basic(device_id: int = None):175def test_gather_basic(device_id: int = None):
179 """Test basic usage of gather function"""176 """Test basic usage of gather function"""
180 print("=" * 60)177 print("=" * 60)
@@ -201,7 +198,6 @@ def test_gather_basic(device_id: int = None):
201 print("✓ Basic usage of gather function completed successfully")198 print("✓ Basic usage of gather function completed successfully")
202 199 
203 200 
204-@pypto.options(pass_options={"enable_slice": True})
205def test_gather_different_dimensions(device_id: int = None):201def test_gather_different_dimensions(device_id: int = None):
206 """Test gathering tensors along different dimensions"""202 """Test gathering tensors along different dimensions"""
207 print("=" * 60)203 print("=" * 60)
@@ -236,7 +232,6 @@ def test_gather_different_dimensions(device_id: int = None):
236 print("✓ Test gatherenating tensors along different dimensions completed successfully")232 print("✓ Test gatherenating tensors along different dimensions completed successfully")
237 233 
238 234 
239-@pypto.options(pass_options={"enable_slice": True})
240def test_gather_negative_indexing(device_id: int = None):235def test_gather_negative_indexing(device_id: int = None):
241 """Test handling negative indexing"""236 """Test handling negative indexing"""
242 print("=" * 60)237 print("=" * 60)
@@ -281,7 +276,6 @@ def scatter_kernel(
281 out[:] = pypto.scatter(x, dim, y, src)276 out[:] = pypto.scatter(x, dim, y, src)
282 277 
283 278 
284-@pypto.options(pass_options={"enable_slice": True})
285def test_scatter(device_id: int = None):279def test_scatter(device_id: int = None):
286 """Test basic usage of scatter function"""280 """Test basic usage of scatter function"""
287 print("=" * 60)281 print("=" * 60)
@@ -325,7 +319,6 @@ def scatter_update_kernel(
325 out[:] = pypto.scatter(x, dim, y, src)319 out[:] = pypto.scatter(x, dim, y, src)
326 320 
327 321 
328-@pypto.options(pass_options={"enable_slice": True})
329def test_scatter_update(device_id: int = None) -> None:322def test_scatter_update(device_id: int = None) -> None:
330 """Test basic usage of scatter_update function"""323 """Test basic usage of scatter_update function"""
331 print("=" * 60)324 print("=" * 60)
@@ -392,7 +385,6 @@ def concat_multiple_op(a_shape: tuple, b_shape: tuple, c_shape: tuple, dim: int)
392 return concat_multiple_kernel385 return concat_multiple_kernel
393 386 
394 387 
395-@pypto.options(pass_options={"enable_slice": True})
396def test_concat_basic(device_id: int = None):388def test_concat_basic(device_id: int = None):
397 """Test basic usage of concat function"""389 """Test basic usage of concat function"""
398 print("=" * 60)390 print("=" * 60)
@@ -418,7 +410,6 @@ def test_concat_basic(device_id: int = None):
418 print("✓ Basic usage of concat function completed successfully")410 print("✓ Basic usage of concat function completed successfully")
419 411 
420 412 
421-@pypto.options(pass_options={"enable_slice": True})
422def test_concat_different_dimensions(device_id: int = None):413def test_concat_different_dimensions(device_id: int = None):
423 """Test concatenating tensors along different dimensions"""414 """Test concatenating tensors along different dimensions"""
424 print("=" * 60)415 print("=" * 60)
@@ -445,7 +436,6 @@ def test_concat_different_dimensions(device_id: int = None):
445 print("✓ Test concatenating tensors along different dimensions completed successfully")436 print("✓ Test concatenating tensors along different dimensions completed successfully")
446 437 
447 438 
448-@pypto.options(pass_options={"enable_slice": True})
449def test_concat_multiple_tensors(device_id: int = None):439def test_concat_multiple_tensors(device_id: int = None):
450 """Test concatenating multiple tensors"""440 """Test concatenating multiple tensors"""
451 print("=" * 60)441 print("=" * 60)
@@ -473,7 +463,6 @@ def test_concat_multiple_tensors(device_id: int = None):
473 print("✓ Test concatenating multiple tensors completed successfully")463 print("✓ Test concatenating multiple tensors completed successfully")
474 464 
475 465 
476-@pypto.options(pass_options={"enable_slice": True})
477def test_concat_different_shapes(device_id: int = None):466def test_concat_different_shapes(device_id: int = None):
478 """Test concatenating tensors of different shapes"""467 """Test concatenating tensors of different shapes"""
479 print("=" * 60)468 print("=" * 60)
@@ -511,7 +500,6 @@ def view_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.
511 out[:] = pypto.view(x, shape, offsets)500 out[:] = pypto.view(x, shape, offsets)
512 501 
513 502 
514-@pypto.options(pass_options={"enable_slice": True})
515def test_view_basic(device_id: int = None):503def test_view_basic(device_id: int = None):
516 """Test basic usage of view function"""504 """Test basic usage of view function"""
517 print("=" * 60)505 print("=" * 60)
@@ -555,7 +543,6 @@ def view_with_valid_shape_kernel(
555 out[:] = pypto.view(x, shape, offsets, valid_shape=valid_shape)543 out[:] = pypto.view(x, shape, offsets, valid_shape=valid_shape)
556 544 
557 545 
558-@pypto.options(pass_options={"enable_slice": True})
559def test_view_with_valid_shape(device_id: int = None):546def test_view_with_valid_shape(device_id: int = None):
560 """Test using the valid_shape parameter"""547 """Test using the valid_shape parameter"""
561 print("=" * 60)548 print("=" * 60)
@@ -599,7 +586,6 @@ def transpose_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], p
599 out[:] = pypto.transpose(x, dim0, dim1)586 out[:] = pypto.transpose(x, dim0, dim1)
600 587 
601 588 
602-@pypto.options(pass_options={"enable_slice": True})
603def test_transpose(device_id: int = None):589def test_transpose(device_id: int = None):
604 """Test basic usage of transpose function"""590 """Test basic usage of transpose function"""
605 print("=" * 60)591 print("=" * 60)
@@ -653,7 +639,6 @@ def cast_kernel(x: pypto.Tensor([], pypto.DT_FP32), out: pypto.Tensor([], pypto.
653 out[:] = pypto.cast(x, pypto.DT_FP16)639 out[:] = pypto.cast(x, pypto.DT_FP16)
654 640 
655 641 
656-@pypto.options(pass_options={"enable_slice": True})
657def test_cast(device_id: int = None):642def test_cast(device_id: int = None):
658 """Test basic usage of cast function"""643 """Test basic usage of cast function"""
659 print("=" * 60)644 print("=" * 60)
@@ -266,7 +266,6 @@ def ffn_activation_kernel(
266 pypto.assemble(result, [0, 0], output)266 pypto.assemble(result, [0, 0], output)
267 267 
268 268 
269-@pypto.options(pass_options={"enable_slice": True})
270def test_ffn_static_gelu(device_id=None):269def test_ffn_static_gelu(device_id=None):
271 """Test static FFN with GELU activation."""270 """Test static FFN with GELU activation."""
272 print("=" * 60)271 print("=" * 60)
@@ -322,7 +321,6 @@ def test_ffn_static_gelu(device_id=None):
322 print()321 print()
323 322 
324 323 
325-@pypto.options(pass_options={"enable_slice": True})
326def test_ffn_static_swiglu(device_id=None):324def test_ffn_static_swiglu(device_id=None):
327 """Test static FFN with SwiGLU activation."""325 """Test static FFN with SwiGLU activation."""
328 print("=" * 60)326 print("=" * 60)
@@ -380,7 +378,6 @@ def test_ffn_static_swiglu(device_id=None):
380 print()378 print()
381 379 
382 380 
383-@pypto.options(pass_options={"enable_slice": True})
384def test_ffn_dynamic_gelu(device_id: int = None, dynamic: bool = True):381def test_ffn_dynamic_gelu(device_id: int = None, dynamic: bool = True):
385 """Test dynamic FFN with GELU activation."""382 """Test dynamic FFN with GELU activation."""
386 print("=" * 60)383 print("=" * 60)
@@ -444,7 +441,6 @@ def test_ffn_dynamic_gelu(device_id: int = None, dynamic: bool = True):
444 print()441 print()
445 442 
446 443 
447-@pypto.options(pass_options={"enable_slice": True})
448def test_ffn_static_relu(device_id: int = None):444def test_ffn_static_relu(device_id: int = None):
449 """Test static FFN with ReLU activation."""445 """Test static FFN with ReLU activation."""
450 print("=" * 60)446 print("=" * 60)
@@ -120,7 +120,6 @@ def layer_norm_kernel(
120 pypto.assemble(out, [0, 0], output)120 pypto.assemble(out, [0, 0], output)
121 121 
122 122 
123-@pypto.options(pass_options={"enable_slice": True})
124def test_layer_norm(device_id=None, dynamic: bool = False):123def test_layer_norm(device_id=None, dynamic: bool = False):
125 """Test LayerNorm."""124 """Test LayerNorm."""
126 print("=" * 60)125 print("=" * 60)
@@ -176,7 +175,6 @@ def rms_norm_kernel(x: pypto.Tensor(), gamma: pypto.Tensor(), output: pypto.Tens
176 pypto.assemble(out, [0, 0], output)175 pypto.assemble(out, [0, 0], output)
177 176 
178 177 
179-@pypto.options(pass_options={"enable_slice": True})
180def test_rms_norm(device_id=None, dynamic: bool = False) -> None:178def test_rms_norm(device_id=None, dynamic: bool = False) -> None:
181 """Test RMSNorm."""179 """Test RMSNorm."""
182 print("=" * 60)180 print("=" * 60)
@@ -96,7 +96,6 @@ def nested_loops_with_conditions_kernel(
96 y[i:i + 1, j:j + 1] = a_view - b_view96 y[i:i + 1, j:j + 1] = a_view - b_view
97 97 
98 98 
99-@pypto.options(pass_options={"enable_slice": True})
100def test_nested_loops_with_conditions(device_id=None, dynamic: bool = True) -> None:99def test_nested_loops_with_conditions(device_id=None, dynamic: bool = True) -> None:
101 """Test nested loops with conditional statements."""100 """Test nested loops with conditional statements."""
102 print("=" * 60)101 print("=" * 60)
@@ -167,7 +166,6 @@ def add_scalar_loop_dyn_axis_static_cond_kernel_dynamic(
167 add_core(input0, input1, output, val, flag)166 add_core(input0, input1, output, val, flag)
168 167 
169 168 
170-@pypto.options(pass_options={"enable_slice": True})
171def test_add_scalar_loop_dyn_axis_static_cond(device_id=None) -> None:169def test_add_scalar_loop_dyn_axis_static_cond(device_id=None) -> None:
172 """Test dynamic axis with static (compile-time) condition."""170 """Test dynamic axis with static (compile-time) condition."""
173 print("=" * 60)171 print("=" * 60)
@@ -231,7 +229,6 @@ def add_scalar_loop_dyn_axis_dyn_cond_kernel(
231 output[b_offset:b_offset_end, ...] = t3_sub229 output[b_offset:b_offset_end, ...] = t3_sub
232 230 
233 231 
234-@pypto.options(pass_options={"enable_slice": True})
235def test_add_scalar_loop_dynamic_axis_dynamic_cond(device_id=None) -> None:232def test_add_scalar_loop_dynamic_axis_dynamic_cond(device_id=None) -> None:
236 """Test dynamic axis with dynamic (runtime) condition."""233 """Test dynamic axis with dynamic (runtime) condition."""
237 print("=" * 60)234 print("=" * 60)
@@ -291,7 +288,6 @@ def add_scalar_loop_dyn_axis_dyn_loop_cond_kernel(
291 output[b_offset:b_offset_end, ...] = t3_sub288 output[b_offset:b_offset_end, ...] = t3_sub
292 289 
293 290 
294-@pypto.options(pass_options={"enable_slice": True})
295def test_add_scalar_loop_dynamic_axis_dynamic_loop_cond(device_id=None) -> None:291def test_add_scalar_loop_dynamic_axis_dynamic_loop_cond(device_id=None) -> None:
296 """Test dynamic axis with loop boundary conditions (is_loop_begin / is_loop_end)."""292 """Test dynamic axis with loop boundary conditions (is_loop_begin / is_loop_end)."""
297 print("=" * 60)293 print("=" * 60)
@@ -95,7 +95,6 @@ def loop_basic_kernel(
95 out1[bs_idx * s:(bs_idx + new_step) * s, :] = pypto.add(t0s, t1s)95 out1[bs_idx * s:(bs_idx + new_step) * s, :] = pypto.add(t0s, t1s)
96 96 
97 97 
98-@pypto.options(pass_options={"enable_slice": True})
99def test_loop_basic(device_id: int = None, dynamic: bool = False) -> None:98def test_loop_basic(device_id: int = None, dynamic: bool = False) -> None:
100 """Test basic loop usage."""99 """Test basic loop usage."""
101 print("=" * 60)100 print("=" * 60)
@@ -167,7 +166,6 @@ def loop_compile_phase_print_kernel(
167 print(separator)166 print(separator)
168 167 
169 168 
170-@pypto.options(pass_options={"enable_slice": True})
171def test_loop_compile_phase_print(device_id: int = None, dynamic: bool = False) -> None:169def test_loop_compile_phase_print(device_id: int = None, dynamic: bool = False) -> None:
172 """Test loop compile phase print"""170 """Test loop compile phase print"""
173 print("=" * 60)171 print("=" * 60)
@@ -222,7 +220,6 @@ def add_kernel(
222 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)220 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)
223 221 
224 222 
225-@pypto.options(pass_options={"enable_slice": True})
226def test_add_scalar_loop(device_id=None, dynamic: bool = True) -> None:223def test_add_scalar_loop(device_id=None, dynamic: bool = True) -> None:
227 """Test loop-based scalar addition."""224 """Test loop-based scalar addition."""
228 print("=" * 60)225 print("=" * 60)
@@ -280,7 +277,6 @@ def add_scalar_loop_dynamic_axis_kernel(
280 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)277 pypto.assemble(t3_sub, [b_offset, 0, 0, 0], output)
281 278 
282 279 
283-@pypto.options(pass_options={"enable_slice": True})
284def test_add_scalar_loop_dyn_axis(device_id: int = None) -> None:280def test_add_scalar_loop_dyn_axis(device_id: int = None) -> None:
285 """Test loop with dynamic axis."""281 """Test loop with dynamic axis."""
286 print("=" * 60)282 print("=" * 60)
@@ -124,7 +124,6 @@ def dynamic_mul_kernel(
124 pypto.assemble(result, [b_offset, 0], output)124 pypto.assemble(result, [b_offset, 0], output)
125 125 
126 126 
127-@pypto.options(pass_options={"enable_slice": True})
128def test_dynamic_mul(device_id: int = None):127def test_dynamic_mul(device_id: int = None):
129 """Test dynamic mul with different batch sizes - same kernel, no recompilation."""128 """Test dynamic mul with different batch sizes - same kernel, no recompilation."""
130 print("=" * 60)129 print("=" * 60)
@@ -187,7 +186,6 @@ def softmax_kernel(
187 output_tensor[b_offset:b_offset_end, ...] = softmax_out186 output_tensor[b_offset:b_offset_end, ...] = softmax_out
188 187 
189 188 
190-@pypto.options(pass_options={"enable_slice": True})
191def test_dynamic_partial(device_id: int = None):189def test_dynamic_partial(device_id: int = None):
192 """Test softmax with partial dynamic dimensions (only batch is dynamic)."""190 """Test softmax with partial dynamic dimensions (only batch is dynamic)."""
193 print("=" * 60)191 print("=" * 60)
@@ -312,7 +310,6 @@ def attention_kernel(
312 pypto.assemble(res, [bs_offset, 0, 0, 0], output_tensor)310 pypto.assemble(res, [bs_offset, 0, 0, 0], output_tensor)
313 311 
314 312 
315-@pypto.options(pass_options={"enable_slice": True})
316def test_dynamic_attention(device_id: int = None):313def test_dynamic_attention(device_id: int = None):
317 """Test attention with dynamic batch sizes."""314 """Test attention with dynamic batch sizes."""
318 print("=" * 60)315 print("=" * 60)
@@ -396,7 +393,6 @@ def dynamic_add_kernel(
396 pypto.assemble(result, [b_offset, h_offset], output)393 pypto.assemble(result, [b_offset, h_offset], output)
397 394 
398 395 
399-@pypto.options(pass_options={"enable_slice": True})
400def test_dynamic_multi_dim(device_id: int = None):396def test_dynamic_multi_dim(device_id: int = None):
401 """Test kernel with multiple dynamic dimensions."""397 """Test kernel with multiple dynamic dimensions."""
402 print("=" * 60)398 print("=" * 60)
@@ -142,7 +142,6 @@ def scaled_dot_product_attention_kernel(
142 pypto.assemble(res, [b_offset, 0, 0, 0], output_tensor)142 pypto.assemble(res, [b_offset, 0, 0, 0], output_tensor)
143 143 
144 144 
145-@pypto.options(pass_options={"enable_slice": True})
146def test_unordered_input_attention(device_id: int = None, dynamic: bool = True) -> None:145def test_unordered_input_attention(device_id: int = None, dynamic: bool = True) -> None:
147 """Test attention with kenel_unordered_input."""146 """Test attention with kenel_unordered_input."""
148 print("=" * 60)147 print("=" * 60)
@@ -191,7 +190,6 @@ def op_unordered_input_kernel(
191 out2.move(a * b)190 out2.move(a * b)
192 191 
193 192 
194-@pypto.options(pass_options={"enable_slice": True})
195def test_unordered_input_op(device_id: int = None, dynamic: bool = False) -> None:193def test_unordered_input_op(device_id: int = None, dynamic: bool = False) -> None:
196 """Test op with kenel_unordered_input"""194 """Test op with kenel_unordered_input"""
197 print("=" * 60)195 print("=" * 60)
@@ -119,7 +119,6 @@ def silu_activation_kernel(x: pypto.Tensor(), out: pypto.Tensor()):
119 out[:] = x * pypto.sigmoid(x)119 out[:] = x * pypto.sigmoid(x)
120 120 
121 121 
122-@pypto.options(pass_options={"enable_slice": True})
123def test_silu(device_id: int = None, dynamic: bool = False) -> None:122def test_silu(device_id: int = None, dynamic: bool = False) -> None:
124 """Test SiLU activation."""123 """Test SiLU activation."""
125 print("=" * 60)124 print("=" * 60)
@@ -162,7 +161,6 @@ def gelu_activation_kernel(x: pypto.Tensor(), out: pypto.Tensor()):
162 out[:] = x * 0.5 * (erf_val + 1.0)161 out[:] = x * 0.5 * (erf_val + 1.0)
163 162 
164 163 
165-@pypto.options(pass_options={"enable_slice": True})
166def test_gelu(device_id: int = None, dynamic: bool = False) -> None:164def test_gelu(device_id: int = None, dynamic: bool = False) -> None:
167 """Test GELU activation."""165 """Test GELU activation."""
168 print("=" * 60)166 print("=" * 60)
@@ -207,7 +205,6 @@ def swiglu_activation_kernel(gate: pypto.Tensor(), up: pypto.Tensor(), out: pypt
207 out[:] = swish * up205 out[:] = swish * up
208 206 
209 207 
210-@pypto.options(pass_options={"enable_slice": True})
211def test_swiglu(device_id: int = None, dynamic: bool = False) -> None:208def test_swiglu(device_id: int = None, dynamic: bool = False) -> None:
212 """Test SwiGLU activation."""209 """Test SwiGLU activation."""
213 print("=" * 60)210 print("=" * 60)
@@ -254,7 +251,6 @@ def geglu_activation_kernel(gate: pypto.Tensor(), up: pypto.Tensor(), out: pypto
254 out[:] = gelu_gate * up251 out[:] = gelu_gate * up
255 252 
256 253 
257-@pypto.options(pass_options={"enable_slice": True})
258def test_geglu(device_id: int = None, dynamic: bool = False) -> None:254def test_geglu(device_id: int = None, dynamic: bool = False) -> None:
259 """Test GeGLU activation."""255 """Test GeGLU activation."""
260 print("=" * 60)256 print("=" * 60)
@@ -111,7 +111,6 @@ def softmax_kernel(
111 output_tensor[b_offset:b_offset_end, ...] = softmax_out111 output_tensor[b_offset:b_offset_end, ...] = softmax_out
112 112 
113 113 
114-@pypto.options(pass_options={"enable_slice": True})
115def test_softmax(device_id: int = None, dynamic: bool = True) -> None:114def test_softmax(device_id: int = None, dynamic: bool = True) -> None:
116 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'115 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'
117 116 
@@ -123,7 +123,6 @@ class MM(torch.nn.Module):
123 return out123 return out
124 124 
125 125 
126-@pypto.options(pass_options={"enable_slice": True})
127def test_softmax_capture(device_id=None, dynamic: bool = True) -> None:126def test_softmax_capture(device_id=None, dynamic: bool = True) -> None:
128 if not device_id:127 if not device_id:
129 device_id = torch.npu.current_device()128 device_id = torch.npu.current_device()
@@ -141,7 +141,6 @@ def scaled_dot_product_attention_kernel(
141 output.move(pypto.matmul(attn_weights, v, out_dtype=pypto.DT_BF16))141 output.move(pypto.matmul(attn_weights, v, out_dtype=pypto.DT_BF16))
142 142 
143 143 
144-@pypto.options(pass_options={"enable_slice": True})
145def test_scaled_dot_product_attention(device_id=None, dynamic: bool = False) -> None:144def test_scaled_dot_product_attention(device_id=None, dynamic: bool = False) -> None:
146 """Test attention function with dynamic shapes."""145 """Test attention function with dynamic shapes."""
147 print("=" * 60)146 print("=" * 60)
@@ -273,7 +272,6 @@ def attention_with_projection_golden(
273 return output272 return output
274 273 
275 274 
276-@pypto.options(pass_options={"enable_slice": True})
277def test_attention_with_projection(device_id=None, dynamic: bool = False) -> None:275def test_attention_with_projection(device_id=None, dynamic: bool = False) -> None:
278 """Test complete attention with input/output projections."""276 """Test complete attention with input/output projections."""
279 print("=" * 60)277 print("=" * 60)
@@ -116,7 +116,6 @@ def softmax(input_tensor: pypto.Tensor(), output_tensor: pypto.Tensor()):
116 pypto.assemble(softmax_out, [b_offset, 0, 0, 0], output_tensor)116 pypto.assemble(softmax_out, [b_offset, 0, 0, 0], output_tensor)
117 117 
118 118 
119-@pypto.options(pass_options={"enable_slice": True})
120def test_softmax(cost_model_enable=True):119def test_softmax(cost_model_enable=True):
121 """120 """
122 Run softmax with optional cost model.121 Run softmax with optional cost model.
@@ -178,7 +178,6 @@ def attention_kernel(q: pypto.tensor(), k: pypto.tensor(), v: pypto.tensor(), ou
178 out[:] = pypto.matmul(attn_weights, v, out_dtype=out.dtype)178 out[:] = pypto.matmul(attn_weights, v, out_dtype=out.dtype)
179 179 
180 180 
181-@pypto.options(pass_options={"enable_slice": True})
182def test_sequential_functions(device_id: int = None, dynamic: bool = False) -> None:181def test_sequential_functions(device_id: int = None, dynamic: bool = False) -> None:
183 """Test multiple functions in sequence."""182 """Test multiple functions in sequence."""
184 print("=" * 60)183 print("=" * 60)
@@ -222,7 +221,6 @@ def test_sequential_functions(device_id: int = None, dynamic: bool = False) -> N
222 print()221 print()
223 222 
224 223 
225-@pypto.options(pass_options={"enable_slice": True})
226def test_residual_connection(device_id: int = None, dynamic: bool = False) -> None:224def test_residual_connection(device_id: int = None, dynamic: bool = False) -> None:
227 """Test residual connection pattern."""225 """Test residual connection pattern."""
228 print("=" * 60)226 print("=" * 60)
@@ -256,7 +254,6 @@ def test_residual_connection(device_id: int = None, dynamic: bool = False) -> No
256 print()254 print()
257 255 
258 256 
259-@pypto.options(pass_options={"enable_slice": True})
260def test_transformer_block(device_id: int = None, dynamic: bool = False) -> None:257def test_transformer_block(device_id: int = None, dynamic: bool = False) -> None:
261 """Test a complete transformer block using multiple functions."""258 """Test a complete transformer block using multiple functions."""
262 print("=" * 60)259 print("=" * 60)
@@ -325,7 +322,6 @@ def test_transformer_block(device_id: int = None, dynamic: bool = False) -> None
325 print()322 print()
326 323 
327 324 
328-@pypto.options(pass_options={"enable_slice": True})
329def test_function_reuse(device_id: int = None, dynamic: bool = True) -> None:325def test_function_reuse(device_id: int = None, dynamic: bool = True) -> None:
330 """Test reusing the same function multiple times."""326 """Test reusing the same function multiple times."""
331 print("=" * 60)327 print("=" * 60)
@@ -89,7 +89,6 @@ def add_kernel(
89 out[:] = add_core(input0, input1, add1_flag)89 out[:] = add_core(input0, input1, add1_flag)
90 90 
91 91 
92-@pypto.options(pass_options={"enable_slice": True})
93def test_add_scalar_loop_multi_jit(device_id=None) -> None:92def test_add_scalar_loop_multi_jit(device_id=None) -> None:
94 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'93 device = f'npu:{device_id}' if global_run_mode == pypto.RunMode.NPU and device_id is not None else 'cpu'
95 94 
@@ -486,6 +486,9 @@ private:
486 486 
487 void LoadConf(const nlohmann::json& jData, const std::string& prefix)487 void LoadConf(const nlohmann::json& jData, const std::string& prefix)
488 {488 {
489+ if (prefix == "pass.enable_slice") {
490+ return;
491+ }
489 if (jData.is_string()) {492 if (jData.is_string()) {
490 root->AddValue(prefix, jData.get<std::string>());493 root->AddValue(prefix, jData.get<std::string>());
491 } else if (jData.is_number()) {494 } else if (jData.is_number()) {
@@ -478,7 +478,12 @@ inline T GetPassOption(const std::string& key)
478 return ConfigManagerNg::CurrentScope()->GetConfigAllType<T>("pass." + key);478 return ConfigManagerNg::CurrentScope()->GetConfigAllType<T>("pass." + key);
479}479}
480 480 
481-inline bool EnableSlice() { return GetPassOption<bool>(ENABLE_SLICE); }481+inline bool EnableSlice()
482+{
483+ const std::string key = "pass." + std::string(ENABLE_SLICE);
484+ auto scope = ConfigManagerNg::CurrentScope();
485+ return scope->HasConfig(key) ? scope->GetConfigAllType<bool>(key) : false;
486+}
482 487 
483/**488/**
484 * @brief Get the atomic scope id from pass config.489 * @brief Get the atomic scope id from pass config.
@@ -8,7 +8,6 @@
8 "copyout_resolve_coalescing": 0,8 "copyout_resolve_coalescing": 0,
9 "auto_mix_partition": 2,9 "auto_mix_partition": 2,
10 "sg_set_tunevf_mode": 0,10 "sg_set_tunevf_mode": 0,
11- "enable_slice": false,
12 "sg_set_scope": [-1, 0, 0],11 "sg_set_scope": [-1, 0, 0],
13 "sg_set_ooo_scope": [-1],12 "sg_set_ooo_scope": [-1],
14 "sg_set_atomic_scope": [-1],13 "sg_set_atomic_scope": [-1],
@@ -190,13 +190,6 @@
190 "minimum": 0,190 "minimum": 0,
191 "maximum": 2191 "maximum": 2
192 },192 },
193- "enable_slice": {
194- "type": "boolean",
195- "label": {
196- "zh": "是否启用 slice 相关处理。默认为 false。",
197- "en": "Whether to enable slice-related processing. Defaults to false."
198- }
199- },
200 "sg_set_scope": {193 "sg_set_scope": {
201 "type": "array",194 "type": "array",
202 "items": {195 "items": {
@@ -296,7 +296,6 @@ def set_pass_options(
296 ooo_sched_mode: Optional[str] = None,296 ooo_sched_mode: Optional[str] = None,
297 auto_mix_partition: Optional[Union[int, str]] = None,297 auto_mix_partition: Optional[Union[int, str]] = None,
298 sg_set_tunevf_mode: Optional[int] = None,298 sg_set_tunevf_mode: Optional[int] = None,
299- enable_slice: Optional[bool] = None,
300) -> None:299) -> None:
301 """300 """
302 Set pass options.301 Set pass options.
@@ -358,9 +357,6 @@ def set_pass_options(
358 - 1: bypass TuneTileOpSeqForVF and TuneSyncForVF passes357 - 1: bypass TuneTileOpSeqForVF and TuneSyncForVF passes
359 - 2: ignore performance modeling and maximize fusion in TuneSyncForVF358 - 2: ignore performance modeling and maximize fusion in TuneSyncForVF
360 359 
361- enable_slice : bool
362- Whether to enable slice-related processing. Defaults to False.
363- 
364 sg_set_ooo_scope : int360 sg_set_ooo_scope : int
365 Control OoO scheduling manual task grouping. Connected ops with the361 Control OoO scheduling manual task grouping. Connected ops with the
366 same ooo_scope will be merged into one task. Will be deprecated in a362 same ooo_scope will be merged into one task. Will be deprecated in a
@@ -421,10 +417,6 @@ def set_pass_options(
421 if ooo_sched_mode not in ("", "GAPMIN", "HLF"):417 if ooo_sched_mode not in ("", "GAPMIN", "HLF"):
422 raise ValueError(f"Invalid ooo_sched_mode: '{ooo_sched_mode}'. Expected '', 'GAPMIN' or 'HLF'.")418 raise ValueError(f"Invalid ooo_sched_mode: '{ooo_sched_mode}'. Expected '', 'GAPMIN' or 'HLF'.")
423 pass_options['ooo_sched_mode'] = ooo_sched_mode419 pass_options['ooo_sched_mode'] = ooo_sched_mode
424- if enable_slice is not None:
425- if not isinstance(enable_slice, bool):
426- raise ValueError(f"Invalid enable_slice: '{enable_slice}'. Expected bool.")
427- pass_options['enable_slice'] = enable_slice
428 420 
429 if pass_options:421 if pass_options:
430 set_options(pass_options=pass_options)422 set_options(pass_options=pass_options)
@@ -472,7 +464,6 @@ def get_pass_options() -> Dict[str, Union[str, int, bool, List[int], Dict[int, i
472 result['experimental'] = {'sg_set_atomic_scope': scope_val}464 result['experimental'] = {'sg_set_atomic_scope': scope_val}
473 result['ooo_sched_mode'] = rst.get('ooo_sched_mode', '')465 result['ooo_sched_mode'] = rst.get('ooo_sched_mode', '')
474 result['sg_set_tunevf_mode'] = rst.get('sg_set_tunevf_mode', 0)466 result['sg_set_tunevf_mode'] = rst.get('sg_set_tunevf_mode', 0)
475- result['enable_slice'] = rst.get('enable_slice', False)
476 return result467 return result
477 468 
478 469 
@@ -745,6 +736,8 @@ class _Options:
745 if isinstance(value, dict):736 if isinstance(value, dict):
746 opts.update({f"{prefix}{k}": v.value if isinstance(v, enum.Enum) else v for k, v in value.items()})737 opts.update({f"{prefix}{k}": v.value if isinstance(v, enum.Enum) else v for k, v in value.items()})
747 738 
739+ opts.pop("pass.enable_slice", None)
740+ 
748 if self.vec_tile_shapes is not None:741 if self.vec_tile_shapes is not None:
749 opts["vec_tile_shapes"] = self.vec_tile_shapes742 opts["vec_tile_shapes"] = self.vec_tile_shapes
750 743 
@@ -51,7 +51,6 @@ import tempfile
51import pytest51import pytest
52 52 
53from conftest import duration_estimate53from conftest import duration_estimate
54-import pypto
55 54 
56sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))55sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
57 56 
@@ -135,7 +134,6 @@ def _bundle_path():
135 134 
136 135 
137@duration_estimate(40)136@duration_estimate(40)
138-@pypto.options(pass_options={"enable_slice": True})
139def test_bundle_static_add(bundle_path):137def test_bundle_static_add(bundle_path):
140 """Non-value-dependent, static, zero-workspace op: the baseline pack -> load -> launch round trip.138 """Non-value-dependent, static, zero-workspace op: the baseline pack -> load -> launch round trip.
141 139 
@@ -158,7 +156,6 @@ def test_bundle_static_add(bundle_path):
158 156 
159 157 
160@duration_estimate(30)158@duration_estimate(30)
161-@pypto.options(pass_options={"enable_slice": True})
162def test_bundle_dynamic_cellmatch(bundle_path):159def test_bundle_dynamic_cellmatch(bundle_path):
163 """Dynamically shaped op: workspace is evaluated from the launch shapes, not read off a baked constant.160 """Dynamically shaped op: workspace is evaluated from the launch shapes, not read off a baked constant.
164 161 
@@ -185,7 +182,6 @@ def test_bundle_dynamic_cellmatch(bundle_path):
185 182 
186 183 
187@duration_estimate(28)184@duration_estimate(28)
188-@pypto.options(pass_options={"enable_slice": True})
189def test_bundle_standalone_delivery(bundle_path, tmp_path):185def test_bundle_standalone_delivery(bundle_path, tmp_path):
190 """The self-contained delivery form: ONE .so + ONE .pyptokb + configs/, with no pypto install in reach.186 """The self-contained delivery form: ONE .so + ONE .pyptokb + configs/, with no pypto install in reach.
191 187 
@@ -36,7 +36,6 @@ def create_compute_func(shape, dtype):
36 return compute_add36 return compute_add
37 37 
38 38 
39-@pypto.options(pass_options={"enable_slice": True})
40def test_correct_annotation():39def test_correct_annotation():
41 """Test that correct annotation causes no error."""40 """Test that correct annotation causes no error."""
42 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))41 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
@@ -53,7 +52,6 @@ def test_correct_annotation():
53 logging.info("✓ Verified: Correct annotation causes no error.")52 logging.info("✓ Verified: Correct annotation causes no error.")
54 53 
55 54 
56-@pypto.options(pass_options={"enable_slice": True})
57def test_number_of_input_not_match():55def test_number_of_input_not_match():
58 """Test that number of input not match causes an error."""56 """Test that number of input not match causes an error."""
59 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))57 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
@@ -72,7 +70,6 @@ def test_number_of_input_not_match():
72 raise RuntimeError("Number of input not match causes no error.")70 raise RuntimeError("Number of input not match causes no error.")
73 71 
74 72 
75-@pypto.options(pass_options={"enable_slice": True})
76def test_incorrect_number_of_dimensions_annotation():73def test_incorrect_number_of_dimensions_annotation():
77 """Test that incorrect number of dimensions annotation causes an error."""74 """Test that incorrect number of dimensions annotation causes an error."""
78 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))75 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
@@ -93,7 +90,6 @@ def test_incorrect_number_of_dimensions_annotation():
93 raise ValueError("Incorrect number of dimensions annotation causes no error.")90 raise ValueError("Incorrect number of dimensions annotation causes no error.")
94 91 
95 92 
96-@pypto.options(pass_options={"enable_slice": True})
97def test_incorrect_shape_annotation():93def test_incorrect_shape_annotation():
98 """Test that incorrect shape annotation causes an error."""94 """Test that incorrect shape annotation causes an error."""
99 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))95 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
@@ -113,7 +109,6 @@ def test_incorrect_shape_annotation():
113 raise ValueError("Incorrect shape annotation causes no error.")109 raise ValueError("Incorrect shape annotation causes no error.")
114 110 
115 111 
116-@pypto.options(pass_options={"enable_slice": True})
117def test_incorrect_dtype_annotation():112def test_incorrect_dtype_annotation():
118 """Test that incorrect annotation causes an error."""113 """Test that incorrect annotation causes an error."""
119 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))114 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
@@ -22,7 +22,6 @@ import pypto
22# @jit @function 场景验证22# @jit @function 场景验证
23# =============================================================================23# =============================================================================
24@pytest.mark.skip("Failed for sync")24@pytest.mark.skip("Failed for sync")
25-@pypto.options(pass_options={"enable_slice": True})
26def test_add_with_kwargs_run():25def test_add_with_kwargs_run():
27 @pypto.frontend.function26 @pypto.frontend.function
28 def sub_add_kernel(27 def sub_add_kernel(
@@ -62,7 +61,6 @@ def test_add_with_kwargs_run():
62# =============================================================================61# =============================================================================
63# @fucntion检验场景验证 固定轴62# @fucntion检验场景验证 固定轴
64# =============================================================================63# =============================================================================
65-@pypto.options(pass_options={"enable_slice": True})
66def test_add_with_kwargs_check_stable():64def test_add_with_kwargs_check_stable():
67 @pypto.frontend.function65 @pypto.frontend.function
68 def sub_add_kernel(66 def sub_add_kernel(
@@ -103,7 +101,6 @@ def test_add_with_kwargs_check_stable():
103# =============================================================================101# =============================================================================
104# @fucntion检验场景验证 dtype102# @fucntion检验场景验证 dtype
105# =============================================================================103# =============================================================================
106-@pypto.options(pass_options={"enable_slice": True})
107def test_add_with_kwargs_check_dtype():104def test_add_with_kwargs_check_dtype():
108 @pypto.frontend.function105 @pypto.frontend.function
109 def sub_add_kernel(106 def sub_add_kernel(
@@ -70,7 +70,6 @@ def test_kernel_reuse():
70 logging.info(f"✓ Cache reused, speedup {t1 / t2:.1f}x")70 logging.info(f"✓ Cache reused, speedup {t1 / t2:.1f}x")
71 71 
72 72 
73-@pypto.options(pass_options={"enable_slice": False})
74def test_kernel_recompile():73def test_kernel_recompile():
75 """STATIC axis change triggers recompile, both calls take similar time."""74 """STATIC axis change triggers recompile, both calls take similar time."""
76 torch.npu.set_device(DEVICE_ID)75 torch.npu.set_device(DEVICE_ID)
@@ -31,7 +31,6 @@ def add_kernel(
31# =============================================================================31# =============================================================================
32# 通过 kwargs 传入 non-tensor 参数32# 通过 kwargs 传入 non-tensor 参数
33# =============================================================================33# =============================================================================
34-@pypto.options(pass_options={"enable_slice": True})
35def test_add_with_kwargs():34def test_add_with_kwargs():
36 device_id = os.environ.get('TILE_FWK_DEVICE_ID', 0)35 device_id = os.environ.get('TILE_FWK_DEVICE_ID', 0)
37 torch.npu.set_device(int(device_id))36 torch.npu.set_device(int(device_id))
@@ -58,7 +57,6 @@ def add_npu_with_tiling(
58# # =============================================================================57# # =============================================================================
59# # 混合情况58# # 混合情况
60# # =============================================================================59# # =============================================================================
61-@pypto.options(pass_options={"enable_slice": True})
62def test_add_npu_with_tiling():60def test_add_npu_with_tiling():
63 device_id = os.environ.get("TILE_FWK_DEVICE_ID", 0)61 device_id = os.environ.get("TILE_FWK_DEVICE_ID", 0)
64 torch.npu.set_device(int(device_id))62 torch.npu.set_device(int(device_id))
@@ -19,7 +19,6 @@ import torch_npu
19import pypto19import pypto
20 20 
21 21 
22-@pypto.options(pass_options={"enable_slice": True})
23def test_attention_residuals_pypto():22def test_attention_residuals_pypto():
24 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))23 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
25 torch_npu.npu.set_device(device_id)24 torch_npu.npu.set_device(device_id)
@@ -45,7 +45,6 @@ def _reshape_matmul_only_torch(input_tensor_a, input_tensor_b):
45 return output45 return output
46 46 
47 47 
48-@pypto.options(pass_options={"enable_slice": False})
49def test_reshape_validshape_matmul_pypto():48def test_reshape_validshape_matmul_pypto():
50 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))49 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
51 torch_npu.npu.set_device(device_id)50 torch_npu.npu.set_device(device_id)
@@ -68,12 +68,10 @@ def run_kernel_test(kernel_func):
68 assert torch.allclose(result_cpu, expected, atol=0.0001, rtol=0.0078125)68 assert torch.allclose(result_cpu, expected, atol=0.0001, rtol=0.0078125)
69 69 
70 70 
71-@pypto.options(pass_options={"enable_slice": True})
72def test_if_variable_scope():71def test_if_variable_scope():
73 run_kernel_test(kernel_if)72 run_kernel_test(kernel_if)
74 73 
75 74 
76-@pypto.options(pass_options={"enable_slice": True})
77def test_range_unroll():75def test_range_unroll():
78 run_kernel_test(kernel_loop)76 run_kernel_test(kernel_loop)
79 77 
@@ -31,7 +31,6 @@ def test_comipile_stage(host_options=None):
31 return test_func31 return test_func
32 32 
33 33 
34-@pypto.options(pass_options={"enable_slice": True})
35def test_all_compile_stages():34def test_all_compile_stages():
36 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))35 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))
37 torch.npu.set_device(device_id)36 torch.npu.set_device(device_id)
@@ -44,7 +44,6 @@ def cust_hidden_loop_func(
44 out = t0 + out44 out = t0 + out
45 45 
46 46 
47-@pypto.options(pass_options={"enable_slice": True})
48def test_hidden_loop_with_if_jit_function():47def test_hidden_loop_with_if_jit_function():
49 """48 """
50 使用jit装饰器测试49 使用jit装饰器测试
@@ -69,7 +68,6 @@ def test_hidden_loop_with_if_jit_function():
69 assert torch.allclose(golden, res.cpu(), atol=1e-5)68 assert torch.allclose(golden, res.cpu(), atol=1e-5)
70 69 
71 70 
72-@pypto.options(pass_options={"enable_slice": True})
73def test_hidden_loop_with_if_multiple_shapes():71def test_hidden_loop_with_if_multiple_shapes():
74 """72 """
75 测试不同形状73 测试不同形状
@@ -133,7 +131,6 @@ def op_hidden_loop_mix_loops(
133 out[:] = pypto.add(out, t0_temp)131 out[:] = pypto.add(out, t0_temp)
134 132 
135 133 
136-@pypto.options(pass_options={"enable_slice": True})
137def test_hidden_loop_mix_loops_jit_function():134def test_hidden_loop_mix_loops_jit_function():
138 """135 """
139 使用jit装饰器测试136 使用jit装饰器测试
@@ -29,7 +29,6 @@ def subscript_assign_ok(
29 c[:] = a + b29 c[:] = a + b
30 30 
31 31 
32-@pypto.options(pass_options={"enable_slice": True})
33def test_subscript_assign_allowed():32def test_subscript_assign_allowed():
34 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))33 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
35 torch.npu.set_device(device_id)34 torch.npu.set_device(device_id)
@@ -54,7 +53,6 @@ def move_assign_ok(
54 c.move(a + b)53 c.move(a + b)
55 54 
56 55 
57-@pypto.options(pass_options={"enable_slice": True})
58def test_move_assign_allowed():56def test_move_assign_allowed():
59 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))57 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
60 torch.npu.set_device(device_id)58 torch.npu.set_device(device_id)
@@ -81,7 +79,6 @@ def var_reassign_ok(
81 c[:] = x79 c[:] = x
82 80 
83 81 
84-@pypto.options(pass_options={"enable_slice": True})
85def test_non_input_var_reassign_allowed():82def test_non_input_var_reassign_allowed():
86 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))83 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
87 torch.npu.set_device(device_id)84 torch.npu.set_device(device_id)
@@ -41,7 +41,6 @@ def dyn_loop_with_loop_begin(
41 pypto.assemble(a1, [b_idx, s_idx, 0, 0], out_tensor)41 pypto.assemble(a1, [b_idx, s_idx, 0, 0], out_tensor)
42 42 
43 43 
44-@pypto.options(pass_options={"enable_slice": True})
45def test_is_loop_begin():44def test_is_loop_begin():
46 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))45 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
47 torch.npu.set_device(device_id)46 torch.npu.set_device(device_id)
@@ -89,7 +88,6 @@ def dyn_loop_with_loop_end(
89 pypto.assemble(a1, [b_idx, s_idx, 0, 0], out_tensor)88 pypto.assemble(a1, [b_idx, s_idx, 0, 0], out_tensor)
90 89 
91 90 
92-@pypto.options(pass_options={"enable_slice": True})
93def test_is_loop_end():91def test_is_loop_end():
94 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))92 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
95 torch.npu.set_device(device_id)93 torch.npu.set_device(device_id)
@@ -36,7 +36,6 @@ def add_kernel_list(
36 c.move(pypto.add(c, b[i * 16:(i + 1) * 16, i * 16:(i + 1) * 16]))36 c.move(pypto.add(c, b[i * 16:(i + 1) * 16, i * 16:(i + 1) * 16]))
37 37 
38 38 
39-@pypto.options(pass_options={"enable_slice": True})
40def test_range_list_iterate():39def test_range_list_iterate():
41 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))40 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
42 torch.npu.set_device(device_id)41 torch.npu.set_device(device_id)
@@ -26,7 +26,6 @@ import torch
26import pypto26import pypto
27 27 
28 28 
29-@pypto.options(pass_options={"enable_slice": True})
30def test_loop_unroll_variable_scope():29def test_loop_unroll_variable_scope():
31 """Test that variables defined outside loop_unroll are accessible in all unroll blocks.30 """Test that variables defined outside loop_unroll are accessible in all unroll blocks.
32 31 
@@ -24,8 +24,6 @@ import textwrap
24 24 
25import pytest25import pytest
26 26 
27-import pypto
28- 
29_SUBPROCESS_SCRIPT = textwrap.dedent(27_SUBPROCESS_SCRIPT = textwrap.dedent(
30 """\28 """\
31 import os29 import os
@@ -95,7 +93,6 @@ _SUBPROCESS_SCRIPT = textwrap.dedent(
95)93)
96 94 
97 95 
98-@pypto.options(pass_options={"enable_slice": True})
99def test_onboard_dump():96def test_onboard_dump():
100 env = os.environ.copy()97 env = os.environ.copy()
101 with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:98 with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as f:
@@ -32,7 +32,6 @@ def cust_dyn_func(
32 b.move(pypto.add(a, b))32 b.move(pypto.add(a, b))
33 33 
34 34 
35-@pypto.options(pass_options={"enable_slice": True})
36def test_device_run_data_from_device():35def test_device_run_data_from_device():
37 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))36 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
38 torch.npu.set_device(device_id)37 torch.npu.set_device(device_id)
@@ -84,7 +83,6 @@ def matmul_add(
84 d.move(pypto.add(pypto.matmul(a0, b0, pypto.DT_INT32), c))83 d.move(pypto.add(pypto.matmul(a0, b0, pypto.DT_INT32), c))
85 84 
86 85 
87-@pypto.options(pass_options={"enable_slice": False})
88def test_device_run_data_from_device_mix_nodep():86def test_device_run_data_from_device_mix_nodep():
89 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))87 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
90 torch.npu.set_device(device_id)88 torch.npu.set_device(device_id)
@@ -22,7 +22,6 @@ def init_tensors():
22 return a, b, c22 return a, b, c
23 23 
24 24 
25-@pypto.options(pass_options={"enable_slice": True})
26def test_dynamic_loop_nomacro():25def test_dynamic_loop_nomacro():
27 a, b, c = init_tensors()26 a, b, c = init_tensors()
28 with pypto.function("MAIN", a, b, c):27 with pypto.function("MAIN", a, b, c):
@@ -50,7 +50,6 @@ def add_dyn_kernel(
50 del res, tile_tensor_0, tile_tensor_150 del res, tile_tensor_0, tile_tensor_1
51 51 
52 52 
53-@pypto.options(pass_options={"enable_slice": True})
54def test_verify_dyn():53def test_verify_dyn():
55 shape = [72, 144]54 shape = [72, 144]
56 55 
@@ -78,7 +77,6 @@ def cmp_where_kenrel(
78 out[:] = pypto.where(mask, 1.0, 0.0)77 out[:] = pypto.where(mask, 1.0, 0.0)
79 78 
80 79 
81-@pypto.options(pass_options={"enable_slice": True})
82def test_verify_where():80def test_verify_where():
83 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))81 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
84 torch.npu.set_device(device_id)82 torch.npu.set_device(device_id)
@@ -108,7 +106,6 @@ def cmp_where_kenrel2(
108 out[:] = pypto.where(mask, 1.0, 0.0)106 out[:] = pypto.where(mask, 1.0, 0.0)
109 107 
110 108 
111-@pypto.options(pass_options={"enable_slice": True})
112def test_verify_set_options():109def test_verify_set_options():
113 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))110 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
114 torch.npu.set_device(device_id)111 torch.npu.set_device(device_id)
@@ -29,7 +29,6 @@ def assemble_kernel(
29 pypto.assemble(aux_mat + a, [0, 0], out)29 pypto.assemble(aux_mat + a, [0, 0], out)
30 30 
31 31 
32-@pypto.options(pass_options={"enable_slice": True})
33def test_assemble_jit_compile():32def test_assemble_jit_compile():
34 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))33 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))
35 torch.npu.set_device(device_id)34 torch.npu.set_device(device_id)
@@ -68,7 +67,6 @@ def generate_f3_golden(a, b):
68 return z67 return z
69 68 
70 69 
71-@pypto.options(pass_options={"enable_slice": True})
72def test_verify_jit_compile():70def test_verify_jit_compile():
73 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))71 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))
74 torch.npu.set_device(device_id)72 torch.npu.set_device(device_id)
@@ -24,7 +24,6 @@ VALUE = 3.0
24 24 
25@pypto.frontend.jit(25@pypto.frontend.jit(
26 create_new_logical_tensor=True,26 create_new_logical_tensor=True,
27- pass_options={"enable_slice": True},
28)27)
29def index_put_write_after_read_kernel(28def index_put_write_after_read_kernel(
30 target: pypto.Tensor([pypto.STATIC, pypto.STATIC], pypto.DT_FP32),29 target: pypto.Tensor([pypto.STATIC, pypto.STATIC], pypto.DT_FP32),
@@ -380,7 +380,6 @@ def run_batch_matmul_test(case: dict):
380@pytest.mark.parametrize(380@pytest.mark.parametrize(
381 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BASIC_3D_TESTS]381 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BASIC_3D_TESTS]
382)382)
383-@pypto.options(pass_options={"enable_slice": False})
384def test_batch_matmul_3d_nd(case: dict):383def test_batch_matmul_3d_nd(case: dict):
385 run_batch_matmul_test(case)384 run_batch_matmul_test(case)
386 385 
@@ -388,7 +387,6 @@ def test_batch_matmul_3d_nd(case: dict):
388@pytest.mark.parametrize(387@pytest.mark.parametrize(
389 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BASIC_4D_TESTS]388 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BASIC_4D_TESTS]
390)389)
391-@pypto.options(pass_options={"enable_slice": False})
392def test_batch_matmul_4d_nd(case: dict):390def test_batch_matmul_4d_nd(case: dict):
393 run_batch_matmul_test(case)391 run_batch_matmul_test(case)
394 392 
@@ -414,7 +412,6 @@ def run_batch_matmul_dynamic_test(case: dict):
414@pytest.mark.parametrize(412@pytest.mark.parametrize(
415 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in DYNAMIC_3D_TESTS]413 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in DYNAMIC_3D_TESTS]
416)414)
417-@pypto.options(pass_options={"enable_slice": False})
418def test_batch_matmul_3d_all_dynamic_nd(case: dict):415def test_batch_matmul_3d_all_dynamic_nd(case: dict):
419 run_batch_matmul_dynamic_test(case)416 run_batch_matmul_dynamic_test(case)
420 417 
@@ -636,7 +636,6 @@ def run_fixpipe_bias_test(case: dict):
636@pytest.mark.parametrize(636@pytest.mark.parametrize(
637 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BIAS_FIXPIPE_TESTS]637 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in BIAS_FIXPIPE_TESTS]
638)638)
639-@pypto.options(pass_options={"enable_slice": True})
640def test_fixpipe_bias(case: dict):639def test_fixpipe_bias(case: dict):
641 run_fixpipe_bias_test(case)640 run_fixpipe_bias_test(case)
642 641 
@@ -103,7 +103,6 @@ def run_gather_in_l1_test(case: dict):
103@pytest.mark.parametrize(103@pytest.mark.parametrize(
104 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in GATHER_IN_L1_TESTS]104 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in GATHER_IN_L1_TESTS]
105)105)
106-@pypto.options(pass_options={"enable_slice": True})
107def test_gather_in_l1_basic(case: dict):106def test_gather_in_l1_basic(case: dict):
108 run_gather_in_l1_test(case)107 run_gather_in_l1_test(case)
109 108 
@@ -357,7 +357,6 @@ def run_scaled_mm_k_split_test(case: dict):
357@pytest.mark.parametrize(357@pytest.mark.parametrize(
358 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in K_SPLIT_2D_TESTS]358 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in K_SPLIT_2D_TESTS]
359)359)
360-@pypto.options(pass_options={"enable_slice": False})
361def test_2d_k_split(case: dict):360def test_2d_k_split(case: dict):
362 """Test 2D matmul with k-axis split."""361 """Test 2D matmul with k-axis split."""
363 run_2d_k_split_test(case)362 run_2d_k_split_test(case)
@@ -366,7 +365,6 @@ def test_2d_k_split(case: dict):
366@pytest.mark.parametrize(365@pytest.mark.parametrize(
367 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in K_SPLIT_3D_TESTS]366 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in K_SPLIT_3D_TESTS]
368)367)
369-@pypto.options(pass_options={"enable_slice": False})
370def test_3d_bmm_k_split(case: dict):368def test_3d_bmm_k_split(case: dict):
371 """Test 3D BMM with k-axis split."""369 """Test 3D BMM with k-axis split."""
372 run_3d_bmm_k_split_test(case)370 run_3d_bmm_k_split_test(case)
@@ -375,7 +373,6 @@ def test_3d_bmm_k_split(case: dict):
375@pytest.mark.parametrize(373@pytest.mark.parametrize(
376 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_K_SPLIT_TESTS]374 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_K_SPLIT_TESTS]
377)375)
378-@pypto.options(pass_options={"enable_slice": False})
379def test_scaled_mm_k_split(case: dict):376def test_scaled_mm_k_split(case: dict):
380 """Test 2D scaled_mm with k-axis split."""377 """Test 2D scaled_mm with k-axis split."""
381 run_scaled_mm_k_split_test(case)378 run_scaled_mm_k_split_test(case)
@@ -128,7 +128,6 @@ def test_matmul_basic(case: dict):
128@pytest.mark.parametrize(128@pytest.mark.parametrize(
129 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in NZ_FORMAT_TESTS]129 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in NZ_FORMAT_TESTS]
130)130)
131-@pypto.options(pass_options={"enable_slice": False})
132def test_matmul_basic(case: dict): # noqa: F811131def test_matmul_basic(case: dict): # noqa: F811
133 run_matmul_test(case)132 run_matmul_test(case)
134 133 
@@ -272,7 +272,6 @@ def run_matmul_l0c2ub_test(case: dict):
272@pytest.mark.parametrize(272@pytest.mark.parametrize(
273 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in L0C2UB_TESTS]273 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in L0C2UB_TESTS]
274)274)
275-@pypto.options(pass_options={"enable_slice": False})
276def test_matmul_l0c2ub(case: dict):275def test_matmul_l0c2ub(case: dict):
277 """pytest 参数化测试"""276 """pytest 参数化测试"""
278 run_matmul_l0c2ub_test(case)277 run_matmul_l0c2ub_test(case)
@@ -111,8 +111,7 @@ def test_matmul_l1_reuse_side(side):
111 if side != "left":111 if side != "left":
112 _run_side_matmul(side, _side_tiling_case(side))112 _run_side_matmul(side, _side_tiling_case(side))
113 return113 return
114- with pypto.options(pass_options={"enable_slice": False}):114+ _run_side_matmul(side, _side_tiling_case(side))
115- _run_side_matmul(side, _side_tiling_case(side))
116 115 
117 116 
118@pytest.mark.soc("950", "910")117@pytest.mark.soc("950", "910")
@@ -121,8 +120,7 @@ def test_matmul_l1_reuse_side_grid(side):
121 if side != "right":120 if side != "right":
122 _run_side_matmul(side, _GRID_CASE)121 _run_side_matmul(side, _GRID_CASE)
123 return122 return
124- with pypto.options(pass_options={"enable_slice": False}):123+ _run_side_matmul(side, _GRID_CASE)
125- _run_side_matmul(side, _GRID_CASE)
126 124 
127 125 
128if __name__ == "__main__":126if __name__ == "__main__":
@@ -228,8 +228,7 @@ def test_matmul_quant(case: dict):
228 if case["id"] not in {"PERTENSOR01", "PERTENSOR02", "PERCHANNEL01", "PERCHANNEL03"}:228 if case["id"] not in {"PERTENSOR01", "PERTENSOR02", "PERCHANNEL01", "PERCHANNEL03"}:
229 run_matmul_quant_test(case)229 run_matmul_quant_test(case)
230 return230 return
231- with pypto.options(pass_options={"enable_slice": False}):231+ run_matmul_quant_test(case)
232- run_matmul_quant_test(case)
233 232 
234 233 
235def run_matmul_quant_pertensor_demo():234def run_matmul_quant_pertensor_demo():
@@ -254,7 +254,6 @@ def run_cast_scaled_mm_ub2l1_test(case: dict):
254@pytest.mark.parametrize(254@pytest.mark.parametrize(
255 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_UB2L1_TESTS]255 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_UB2L1_TESTS]
256)256)
257-@pypto.options(pass_options={"enable_slice": False})
258def test_cast_scaled_mm_ub2l1(case: dict):257def test_cast_scaled_mm_ub2l1(case: dict):
259 run_cast_scaled_mm_ub2l1_test(case)258 run_cast_scaled_mm_ub2l1_test(case)
260 259 
@@ -262,7 +261,6 @@ def test_cast_scaled_mm_ub2l1(case: dict):
262@pytest.mark.parametrize(261@pytest.mark.parametrize(
263 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in ALL_CAST_MATMUL_TESTS]262 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in ALL_CAST_MATMUL_TESTS]
264)263)
265-@pypto.options(pass_options={"enable_slice": True})
266def test_cast_matmul(case: dict):264def test_cast_matmul(case: dict):
267 run_cast_matmul_test(case)265 run_cast_matmul_test(case)
268 266 
@@ -876,7 +876,6 @@ def run_scaled_bmm_test(case: dict):
876@pytest.mark.parametrize(876@pytest.mark.parametrize(
877 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_BMM_TESTS]877 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_BMM_TESTS]
878)878)
879-@pypto.options(pass_options={"enable_slice": False})
880def test_scaled_bmm(case: dict):879def test_scaled_bmm(case: dict):
881 run_scaled_bmm_test(case)880 run_scaled_bmm_test(case)
882 881 
@@ -488,7 +488,6 @@ def run_fp4_test(case: dict):
488 488 
489 489 
490@pytest.mark.parametrize("case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in MXFP4_TESTS])490@pytest.mark.parametrize("case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in MXFP4_TESTS])
491-@pypto.options(pass_options={"enable_slice": False})
492def test_fp4(case: dict):491def test_fp4(case: dict):
493 run_fp4_test(case)492 run_fp4_test(case)
494 493 
@@ -284,7 +284,6 @@ def run_scaled_mm_test(case: dict):
284@pytest.mark.parametrize(284@pytest.mark.parametrize(
285 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_TESTS]285 "case", [pytest.param(case, marks=pytest.mark.soc(*case["products"])) for case in SCALED_MM_TESTS]
286)286)
287-@pypto.options(pass_options={"enable_slice": False})
288def test_scaled_mm(case: dict):287def test_scaled_mm(case: dict):
289 run_scaled_mm_test(case)288 run_scaled_mm_test(case)
290 289 
@@ -48,6 +48,5 @@ def run_acos_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ACOS_TESTS, ids=[case["case_name"] for case in ACOS_TESTS])50@pytest.mark.parametrize("case", ACOS_TESTS, ids=[case["case_name"] for case in ACOS_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_acos(case: dict):51def test_acos(case: dict):
53 run_acos_test(case)52 run_acos_test(case)
@@ -48,6 +48,5 @@ def run_acosh_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ACOSH_ONBOARD_TESTS, ids=[case["case_name"] for case in ACOSH_ONBOARD_TESTS])50@pytest.mark.parametrize("case", ACOSH_ONBOARD_TESTS, ids=[case["case_name"] for case in ACOSH_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_acosh_onboard(case: dict):51def test_acosh_onboard(case: dict):
53 run_acosh_onboard_test(case)52 run_acosh_onboard_test(case)
@@ -61,6 +61,5 @@ def run_add_test(case: dict):
61 61 
62 62 
63@pytest.mark.parametrize("case", ADD_TESTS, ids=[case["case_name"] for case in ADD_TESTS])63@pytest.mark.parametrize("case", ADD_TESTS, ids=[case["case_name"] for case in ADD_TESTS])
64-@pypto.options(pass_options={"enable_slice": True})
65def test_add(case: dict):64def test_add(case: dict):
66 run_add_test(case)65 run_add_test(case)
@@ -75,6 +75,5 @@ def run_adds_onboard_test(case: dict):
75 75 
76 76 
77@pytest.mark.parametrize("case", ADDS_ONBOARD_TESTS, ids=[case["case_name"] for case in ADDS_ONBOARD_TESTS])77@pytest.mark.parametrize("case", ADDS_ONBOARD_TESTS, ids=[case["case_name"] for case in ADDS_ONBOARD_TESTS])
78-@pypto.options(pass_options={"enable_slice": True})
79def test_adds_onboard(case: dict):78def test_adds_onboard(case: dict):
80 run_adds_onboard_test(case)79 run_adds_onboard_test(case)
@@ -118,6 +118,5 @@ def run_amax_onboard_test(case: dict):
118 118 
119 119 
120@pytest.mark.parametrize("case", AMAX_ONBOARD_TESTS, ids=[case["case_name"] for case in AMAX_ONBOARD_TESTS])120@pytest.mark.parametrize("case", AMAX_ONBOARD_TESTS, ids=[case["case_name"] for case in AMAX_ONBOARD_TESTS])
121-@pypto.options(pass_options={"enable_slice": True})
122def test_amax_onboard(case: dict):121def test_amax_onboard(case: dict):
123 run_amax_onboard_test(case)122 run_amax_onboard_test(case)
@@ -74,6 +74,5 @@ def run_amin_onboard_test(case: dict):
74 74 
75 75 
76@pytest.mark.parametrize("case", AMIN_ONBOARD_TESTS, ids=[case["case_name"] for case in AMIN_ONBOARD_TESTS])76@pytest.mark.parametrize("case", AMIN_ONBOARD_TESTS, ids=[case["case_name"] for case in AMIN_ONBOARD_TESTS])
77-@pypto.options(pass_options={"enable_slice": True})
78def test_amin_onboard(case: dict):77def test_amin_onboard(case: dict):
79 run_amin_onboard_test(case)78 run_amin_onboard_test(case)
@@ -21,7 +21,6 @@ import torch
21import pypto21import pypto
22 22 
23 23 
24-@pypto.options(pass_options={"enable_slice": True})
25def test_argmax_block_onboard():24def test_argmax_block_onboard():
26 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))25 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
27 torch.npu.set_device(device_id)26 torch.npu.set_device(device_id)
@@ -21,7 +21,6 @@ import torch
21import pypto21import pypto
22 22 
23 23 
24-@pypto.options(pass_options={"enable_slice": True})
25def test_argmin_block_onboard():24def test_argmin_block_onboard():
26 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))25 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
27 torch.npu.set_device(device_id)26 torch.npu.set_device(device_id)
@@ -74,6 +74,5 @@ def run_argsort_onboard_test(case: dict):
74 74 
75 75 
76@pytest.mark.parametrize("case", ARGSORT_ONBOARD_TESTS, ids=[case["case_name"] for case in ARGSORT_ONBOARD_TESTS])76@pytest.mark.parametrize("case", ARGSORT_ONBOARD_TESTS, ids=[case["case_name"] for case in ARGSORT_ONBOARD_TESTS])
77-@pypto.options(pass_options={"enable_slice": True})
78def test_argsort_onboard(case: dict):77def test_argsort_onboard(case: dict):
79 run_argsort_onboard_test(case)78 run_argsort_onboard_test(case)
@@ -48,6 +48,5 @@ def run_asin_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ASIN_TESTS, ids=[case["case_name"] for case in ASIN_TESTS])50@pytest.mark.parametrize("case", ASIN_TESTS, ids=[case["case_name"] for case in ASIN_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_asin(case: dict):51def test_asin(case: dict):
53 run_asin_test(case)52 run_asin_test(case)
@@ -48,6 +48,5 @@ def run_asinh_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ASINH_ONBOARD_TESTS, ids=[case["case_name"] for case in ASINH_ONBOARD_TESTS])50@pytest.mark.parametrize("case", ASINH_ONBOARD_TESTS, ids=[case["case_name"] for case in ASINH_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_asinh_onboard(case: dict):51def test_asinh_onboard(case: dict):
53 run_asinh_onboard_test(case)52 run_asinh_onboard_test(case)
@@ -50,6 +50,5 @@ def run_atan2_test(case: dict):
50 50 
51 51 
52@pytest.mark.parametrize("case", ATAN2_TESTS, ids=[case["case_name"] for case in ATAN2_TESTS])52@pytest.mark.parametrize("case", ATAN2_TESTS, ids=[case["case_name"] for case in ATAN2_TESTS])
53-@pypto.options(pass_options={"enable_slice": True})
54def test_atan2(case: dict):53def test_atan2(case: dict):
55 run_atan2_test(case)54 run_atan2_test(case)
@@ -48,6 +48,5 @@ def run_atan_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ATAN_ONBOARD_TESTS, ids=[case["case_name"] for case in ATAN_ONBOARD_TESTS])50@pytest.mark.parametrize("case", ATAN_ONBOARD_TESTS, ids=[case["case_name"] for case in ATAN_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_atan_onboard(case: dict):51def test_atan_onboard(case: dict):
53 run_atan_onboard_test(case)52 run_atan_onboard_test(case)
@@ -67,6 +67,5 @@ def run_atanh_onboard_test(case: dict):
67 67 
68 68 
69@pytest.mark.parametrize("case", ATANH_ONBOARD_TESTS, ids=[case["case_name"] for case in ATANH_ONBOARD_TESTS])69@pytest.mark.parametrize("case", ATANH_ONBOARD_TESTS, ids=[case["case_name"] for case in ATANH_ONBOARD_TESTS])
70-@pypto.options(pass_options={"enable_slice": True})
71def test_atanh_onboard(case: dict):70def test_atanh_onboard(case: dict):
72 run_atanh_onboard_test(case)71 run_atanh_onboard_test(case)
@@ -89,7 +89,6 @@ def test_axpy_cpp_st_onboard(case_index, y_shape, x_shape, dtypes, view_shape, t
89 89 
90 90 
91@pytest.mark.skip(reason="冒烟跳过")91@pytest.mark.skip(reason="冒烟跳过")
92-@pypto.options(pass_options={"enable_slice": True})
93def test_axpy_onboard():92def test_axpy_onboard():
94 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))93 device_id = int(os.environ.get('TILE_FWK_DEVICE_ID', 0))
95 torch.npu.set_device(device_id)94 torch.npu.set_device(device_id)
@@ -52,6 +52,5 @@ def run_bitwiseand_onboard_test(case: dict):
52 52 
53 53 
54@pytest.mark.parametrize("case", BITWISEAND_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEAND_ONBOARD_TESTS])54@pytest.mark.parametrize("case", BITWISEAND_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEAND_ONBOARD_TESTS])
55-@pypto.options(pass_options={"enable_slice": True})
56def test_bitwiseand_onboard(case: dict):55def test_bitwiseand_onboard(case: dict):
57 run_bitwiseand_onboard_test(case)56 run_bitwiseand_onboard_test(case)
@@ -52,6 +52,5 @@ def run_bitwiseands_onboard_test(case: dict):
52@pytest.mark.parametrize(52@pytest.mark.parametrize(
53 "case", BITWISEANDS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEANDS_ONBOARD_TESTS]53 "case", BITWISEANDS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEANDS_ONBOARD_TESTS]
54)54)
55-@pypto.options(pass_options={"enable_slice": True})
56def test_bitwiseands_onboard(case: dict):55def test_bitwiseands_onboard(case: dict):
57 run_bitwiseands_onboard_test(case)56 run_bitwiseands_onboard_test(case)
@@ -57,6 +57,5 @@ def run_bitwiseleftshift_onboard_test(case: dict):
57@pytest.mark.parametrize(57@pytest.mark.parametrize(
58 "case", BITWISELEFTSHIFT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISELEFTSHIFT_ONBOARD_TESTS]58 "case", BITWISELEFTSHIFT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISELEFTSHIFT_ONBOARD_TESTS]
59)59)
60-@pypto.options(pass_options={"enable_slice": True})
61def test_bitwiseleftshift_onboard(case: dict):60def test_bitwiseleftshift_onboard(case: dict):
62 run_bitwiseleftshift_onboard_test(case)61 run_bitwiseleftshift_onboard_test(case)
@@ -55,6 +55,5 @@ def run_bitwiseleftshifts_onboard_test(case: dict):
55@pytest.mark.parametrize(55@pytest.mark.parametrize(
56 "case", BITWISELEFTSHIFTS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISELEFTSHIFTS_ONBOARD_TESTS]56 "case", BITWISELEFTSHIFTS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISELEFTSHIFTS_ONBOARD_TESTS]
57)57)
58-@pypto.options(pass_options={"enable_slice": True})
59def test_bitwiseleftshifts_onboard(case: dict):58def test_bitwiseleftshifts_onboard(case: dict):
60 run_bitwiseleftshifts_onboard_test(case)59 run_bitwiseleftshifts_onboard_test(case)
@@ -50,6 +50,5 @@ def run_bitwisenot_onboard_test(case: dict):
50 50 
51 51 
52@pytest.mark.parametrize("case", BITWISENOT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISENOT_ONBOARD_TESTS])52@pytest.mark.parametrize("case", BITWISENOT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISENOT_ONBOARD_TESTS])
53-@pypto.options(pass_options={"enable_slice": True})
54def test_bitwisenot_onboard(case: dict):53def test_bitwisenot_onboard(case: dict):
55 run_bitwisenot_onboard_test(case)54 run_bitwisenot_onboard_test(case)
@@ -52,6 +52,5 @@ def run_bitwiseor_onboard_test(case: dict):
52 52 
53 53 
54@pytest.mark.parametrize("case", BITWISEOR_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEOR_ONBOARD_TESTS])54@pytest.mark.parametrize("case", BITWISEOR_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEOR_ONBOARD_TESTS])
55-@pypto.options(pass_options={"enable_slice": True})
56def test_bitwiseor_onboard(case: dict):55def test_bitwiseor_onboard(case: dict):
57 run_bitwiseor_onboard_test(case)56 run_bitwiseor_onboard_test(case)
@@ -50,6 +50,5 @@ def run_bitwiseors_onboard_test(case: dict):
50 50 
51 51 
52@pytest.mark.parametrize("case", BITWISEORS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEORS_ONBOARD_TESTS])52@pytest.mark.parametrize("case", BITWISEORS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEORS_ONBOARD_TESTS])
53-@pypto.options(pass_options={"enable_slice": True})
54def test_bitwiseors_onboard(case: dict):53def test_bitwiseors_onboard(case: dict):
55 run_bitwiseors_onboard_test(case)54 run_bitwiseors_onboard_test(case)
@@ -57,6 +57,5 @@ def run_bitwiserightshift_onboard_test(case: dict):
57@pytest.mark.parametrize(57@pytest.mark.parametrize(
58 "case", BITWISERIGHTSHIFT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISERIGHTSHIFT_ONBOARD_TESTS]58 "case", BITWISERIGHTSHIFT_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISERIGHTSHIFT_ONBOARD_TESTS]
59)59)
60-@pypto.options(pass_options={"enable_slice": True})
61def test_bitwiserightshift_onboard(case: dict):60def test_bitwiserightshift_onboard(case: dict):
62 run_bitwiserightshift_onboard_test(case)61 run_bitwiserightshift_onboard_test(case)
@@ -55,6 +55,5 @@ def run_bitwiserightshifts_onboard_test(case: dict):
55@pytest.mark.parametrize(55@pytest.mark.parametrize(
56 "case", BITWISERIGHTSHIFTS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISERIGHTSHIFTS_ONBOARD_TESTS]56 "case", BITWISERIGHTSHIFTS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISERIGHTSHIFTS_ONBOARD_TESTS]
57)57)
58-@pypto.options(pass_options={"enable_slice": True})
59def test_bitwiserightshifts_onboard(case: dict):58def test_bitwiserightshifts_onboard(case: dict):
60 run_bitwiserightshifts_onboard_test(case)59 run_bitwiserightshifts_onboard_test(case)
@@ -52,6 +52,5 @@ def run_bitwisexor_onboard_test(case: dict):
52 52 
53 53 
54@pytest.mark.parametrize("case", BITWISEXOR_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEXOR_ONBOARD_TESTS])54@pytest.mark.parametrize("case", BITWISEXOR_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEXOR_ONBOARD_TESTS])
55-@pypto.options(pass_options={"enable_slice": True})
56def test_bitwisexor_onboard(case: dict):55def test_bitwisexor_onboard(case: dict):
57 run_bitwisexor_onboard_test(case)56 run_bitwisexor_onboard_test(case)
@@ -52,6 +52,5 @@ def run_bitwisexors_onboard_test(case: dict):
52@pytest.mark.parametrize(52@pytest.mark.parametrize(
53 "case", BITWISEXORS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEXORS_ONBOARD_TESTS]53 "case", BITWISEXORS_ONBOARD_TESTS, ids=[case["case_name"] for case in BITWISEXORS_ONBOARD_TESTS]
54)54)
55-@pypto.options(pass_options={"enable_slice": True})
56def test_bitwisexors_onboard(case: dict):55def test_bitwisexors_onboard(case: dict):
57 run_bitwisexors_onboard_test(case)56 run_bitwisexors_onboard_test(case)
@@ -101,6 +101,5 @@ def run_cast_test(case: dict):
101 101 
102 102 
103@pytest.mark.parametrize("case", CAST_TESTS, ids=[case["case_name"] for case in CAST_TESTS])103@pytest.mark.parametrize("case", CAST_TESTS, ids=[case["case_name"] for case in CAST_TESTS])
104-@pypto.options(pass_options={"enable_slice": True})
105def test_cast(case: dict):104def test_cast(case: dict):
106 run_cast_test(case)105 run_cast_test(case)
@@ -48,6 +48,5 @@ def run_ceil_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", CEIL_TESTS, ids=[case["case_name"] for case in CEIL_TESTS])50@pytest.mark.parametrize("case", CEIL_TESTS, ids=[case["case_name"] for case in CEIL_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_ceil(case: dict):51def test_ceil(case: dict):
53 run_ceil_test(case)52 run_ceil_test(case)
@@ -41,7 +41,6 @@ def ceil_div_2d(
41 del tile_x, tile_y41 del tile_x, tile_y
42 42 
43 43 
44-@pypto.options(pass_options={"enable_slice": True})
45def test_ceil_div():44def test_ceil_div():
46 view_shape = [32, 128]45 view_shape = [32, 128]
47 tile_shape = [32, 32]46 tile_shape = [32, 32]
@@ -59,6 +59,5 @@ def run_clip_test(case: dict):
59 59 
60 60 
61@pytest.mark.parametrize("case", CLIP_TESTS, ids=[case["case_name"] for case in CLIP_TESTS])61@pytest.mark.parametrize("case", CLIP_TESTS, ids=[case["case_name"] for case in CLIP_TESTS])
62-@pypto.options(pass_options={"enable_slice": True})
63def test_clip(case: dict):62def test_clip(case: dict):
64 run_clip_test(case)63 run_clip_test(case)
@@ -83,6 +83,5 @@ def run_compare_test(case: dict):
83 83 
84 84 
85@pytest.mark.parametrize("case", COMPARE_TESTS, ids=[case["case_name"] for case in COMPARE_TESTS])85@pytest.mark.parametrize("case", COMPARE_TESTS, ids=[case["case_name"] for case in COMPARE_TESTS])
86-@pypto.options(pass_options={"enable_slice": True})
87def test_compare(case: dict):86def test_compare(case: dict):
88 run_compare_test(case)87 run_compare_test(case)
@@ -54,6 +54,5 @@ def run_concat_test(case: dict):
54 54 
55 55 
56@pytest.mark.parametrize("case", CONCAT_TESTS, ids=[case["case_name"] for case in CONCAT_TESTS])56@pytest.mark.parametrize("case", CONCAT_TESTS, ids=[case["case_name"] for case in CONCAT_TESTS])
57-@pypto.options(pass_options={"enable_slice": True})
58def test_concat(case: dict):57def test_concat(case: dict):
59 run_concat_test(case)58 run_concat_test(case)
@@ -52,6 +52,5 @@ def run_copysign_test(case: dict):
52 52 
53 53 
54@pytest.mark.parametrize("case", COPYSIGN_TESTS, ids=[case["case_name"] for case in COPYSIGN_TESTS])54@pytest.mark.parametrize("case", COPYSIGN_TESTS, ids=[case["case_name"] for case in COPYSIGN_TESTS])
55-@pypto.options(pass_options={"enable_slice": True})
56def test_copysign(case: dict):55def test_copysign(case: dict):
57 run_copysign_test(case)56 run_copysign_test(case)
@@ -48,6 +48,5 @@ def run_cos_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", COS_ONBOARD_TESTS, ids=[case["case_name"] for case in COS_ONBOARD_TESTS])50@pytest.mark.parametrize("case", COS_ONBOARD_TESTS, ids=[case["case_name"] for case in COS_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_cos_onboard(case: dict):51def test_cos_onboard(case: dict):
53 run_cos_onboard_test(case)52 run_cos_onboard_test(case)
@@ -48,6 +48,5 @@ def run_cosh_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", COSH_ONBOARD_TESTS, ids=[case["case_name"] for case in COSH_ONBOARD_TESTS])50@pytest.mark.parametrize("case", COSH_ONBOARD_TESTS, ids=[case["case_name"] for case in COSH_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_cosh_onboard(case: dict):51def test_cosh_onboard(case: dict):
53 run_cosh_onboard_test(case)52 run_cosh_onboard_test(case)
@@ -50,6 +50,5 @@ def run_cumprod_test(case: dict):
50 50 
51 51 
52@pytest.mark.parametrize("case", CUMPROD_TESTS, ids=[case["case_name"] for case in CUMPROD_TESTS])52@pytest.mark.parametrize("case", CUMPROD_TESTS, ids=[case["case_name"] for case in CUMPROD_TESTS])
53-@pypto.options(pass_options={"enable_slice": True})
54def test_cumprod(case: dict):53def test_cumprod(case: dict):
55 run_cumprod_test(case)54 run_cumprod_test(case)
@@ -52,6 +52,5 @@ def run_cumsum_onboard_test(case: dict):
52 52 
53 53 
54@pytest.mark.parametrize("case", CUMSUM_ONBOARD_TESTS, ids=[case["case_name"] for case in CUMSUM_ONBOARD_TESTS])54@pytest.mark.parametrize("case", CUMSUM_ONBOARD_TESTS, ids=[case["case_name"] for case in CUMSUM_ONBOARD_TESTS])
55-@pypto.options(pass_options={"enable_slice": True})
56def test_cumsum_onboard(case: dict):55def test_cumsum_onboard(case: dict):
57 run_cumsum_onboard_test(case)56 run_cumsum_onboard_test(case)
@@ -21,7 +21,6 @@ import pypto
21 21 
22 22 
23@pytest.mark.soc("950")23@pytest.mark.soc("950")
24-@pypto.options(pass_options={"enable_slice": False})
25def test_tensor_deinterleave():24def test_tensor_deinterleave():
26 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))25 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))
27 torch.npu.set_device(device_id)26 torch.npu.set_device(device_id)
@@ -82,7 +81,6 @@ def test_tensor_deinterleave():
82 81 
83 82 
84@pytest.mark.soc("950")83@pytest.mark.soc("950")
85-@pypto.options(pass_options={"enable_slice": False})
86def test_tensor_deinterleave_single_input():84def test_tensor_deinterleave_single_input():
87 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))85 device_id = int(os.environ.get("TILE_FWK_DEVICE_ID", 0))
88 torch.npu.set_device(device_id)86 torch.npu.set_device(device_id)
@@ -98,6 +98,5 @@ def run_dequantize_onboard_test(case: dict):
98 98 
99 99 
100@pytest.mark.parametrize("case", DEQUANTIZE_ONBOARD_TESTS, ids=[case["case_name"] for case in DEQUANTIZE_ONBOARD_TESTS])100@pytest.mark.parametrize("case", DEQUANTIZE_ONBOARD_TESTS, ids=[case["case_name"] for case in DEQUANTIZE_ONBOARD_TESTS])
101-@pypto.options(pass_options={"enable_slice": True})
102def test_dequantize_onboard(case: dict):101def test_dequantize_onboard(case: dict):
103 run_dequantize_onboard_test(case)102 run_dequantize_onboard_test(case)
@@ -77,6 +77,5 @@ def run_div_test(case: dict):
77 77 
78 78 
79@pytest.mark.parametrize("case", DIV_TESTS, ids=[case["case_name"] for case in DIV_TESTS])79@pytest.mark.parametrize("case", DIV_TESTS, ids=[case["case_name"] for case in DIV_TESTS])
80-@pypto.options(pass_options={"enable_slice": True})
81def test_div(case: dict):80def test_div(case: dict):
82 run_div_test(case)81 run_div_test(case)
@@ -100,6 +100,5 @@ def run_divs_onboard_test(case: dict):
100 100 
101 101 
102@pytest.mark.parametrize("case", DIVS_ONBOARD_TESTS, ids=[case["case_name"] for case in DIVS_ONBOARD_TESTS])102@pytest.mark.parametrize("case", DIVS_ONBOARD_TESTS, ids=[case["case_name"] for case in DIVS_ONBOARD_TESTS])
103-@pypto.options(pass_options={"enable_slice": True})
104def test_divs_onboard(case: dict):103def test_divs_onboard(case: dict):
105 run_divs_onboard_test(case)104 run_divs_onboard_test(case)
@@ -48,6 +48,5 @@ def run_erf_onboard_test(case: dict):
48 48 
49 49 
50@pytest.mark.parametrize("case", ERF_ONBOARD_TESTS, ids=[case["case_name"] for case in ERF_ONBOARD_TESTS])50@pytest.mark.parametrize("case", ERF_ONBOARD_TESTS, ids=[case["case_name"] for case in ERF_ONBOARD_TESTS])
51-@pypto.options(pass_options={"enable_slice": True})
52def test_erf_onboard(case: dict):51def test_erf_onboard(case: dict):
53 run_erf_onboard_test(case)52 run_erf_onboard_test(case)