Skip to content

Commit a39868c

Browse files
committed
Reenable transfer tuning tests
1 parent 139aa79 commit a39868c

3 files changed

Lines changed: 38 additions & 45 deletions

File tree

.github/workflows/integration_tests_transfertuning.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@ jobs:
7575
docc -g -O3 -docc-tune=sequential -docc-transfer-tune -docc-save-temps matmul.c -o matmul.out
7676
./matmul.out
7777
cd ../../../../
78+
79+
cd llvm/integration/
80+
pytest -v -rx polybench_transfertuning_test.py

llvm/integration/polybench_transfertuning_test.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ def test_correlation(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
109109

110110
transformation_verification = TransformationVerification(
111111
{
112-
# "RPCNodeTransform": {
113-
# "loop_nests": {},
114-
# "tuned_loops": 9,
115-
# }
116112
}
117113
)
118114

@@ -166,7 +162,7 @@ def test_covariance(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
166162
)
167163

168164
transformation_verification = TransformationVerification(
169-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 6}}
165+
{"RPCNodeTransform": {"loop_nests": {}}}
170166
)
171167

172168
test_case = benchmark_path / "covariance.c"
@@ -224,7 +220,7 @@ def test_gemm(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
224220
)
225221

226222
transformation_verification = TransformationVerification(
227-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 4}}
223+
{"RPCNodeTransform": {"loop_nests": {}}}
228224
)
229225

230226
test_case = benchmark_path / "gemm.c"
@@ -277,10 +273,6 @@ def test_gemver(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
277273

278274
transformation_verification = TransformationVerification(
279275
{
280-
# "RPCNodeTransform": {
281-
# "loop_nests": {},
282-
# "tuned_loops": 2,
283-
# }
284276
}
285277
)
286278

@@ -340,7 +332,7 @@ def test_gesummv(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
340332
)
341333

342334
transformation_verification = TransformationVerification(
343-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 3}}
335+
{"RPCNodeTransform": {"loop_nests": {}}}
344336
)
345337

346338
test_case = benchmark_path / "gesummv.c"
@@ -398,7 +390,7 @@ def test_symm(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
398390
)
399391

400392
transformation_verification = TransformationVerification(
401-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 3}}
393+
{"RPCNodeTransform": {"loop_nests": {}}}
402394
)
403395

404396
test_case = benchmark_path / "symm.c"
@@ -457,10 +449,6 @@ def test_syr2k(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
457449

458450
transformation_verification = TransformationVerification(
459451
{
460-
# "RPCNodeTransform": {
461-
# "loop_nests": {},
462-
# "tuned_loops": 4,
463-
# }
464452
}
465453
)
466454

@@ -519,7 +507,7 @@ def test_syrk(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
519507
)
520508

521509
transformation_verification = TransformationVerification(
522-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 4}}
510+
{"RPCNodeTransform": {"loop_nests": {}}}
523511
)
524512

525513
test_case = benchmark_path / "syrk.c"
@@ -633,7 +621,7 @@ def test_2mm(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
633621
)
634622

635623
transformation_verification = TransformationVerification(
636-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 6}}
624+
{"RPCNodeTransform": {"loop_nests": {}}}
637625
)
638626

639627
test_case = benchmark_path / "2mm.c"
@@ -686,7 +674,7 @@ def test_3mm(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
686674
)
687675

688676
transformation_verification = TransformationVerification(
689-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 7}}
677+
{"RPCNodeTransform": {"loop_nests": {}}}
690678
)
691679

692680
test_case = benchmark_path / "3mm.c"
@@ -738,7 +726,7 @@ def test_atax(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
738726
)
739727

740728
transformation_verification = TransformationVerification(
741-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 5}}
729+
{"RPCNodeTransform": {"loop_nests": {}}}
742730
)
743731

744732
test_case = benchmark_path / "atax.c"
@@ -796,7 +784,7 @@ def test_bicg(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
796784
)
797785

798786
transformation_verification = TransformationVerification(
799-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 3}}
787+
{"RPCNodeTransform": {"loop_nests": {}}}
800788
)
801789

802790
test_case = benchmark_path / "bicg.c"
@@ -910,7 +898,7 @@ def test_mvt(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
910898
)
911899

912900
transformation_verification = TransformationVerification(
913-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 2}}
901+
{"RPCNodeTransform": {"loop_nests": {}}}
914902
)
915903

916904
test_case = benchmark_path / "mvt.c"
@@ -968,7 +956,7 @@ def test_cholesky(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
968956
)
969957

970958
transformation_verification = TransformationVerification(
971-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 7}}
959+
{"RPCNodeTransform": {"loop_nests": {}}}
972960
)
973961

974962
test_case = benchmark_path / "cholesky.c"
@@ -1138,7 +1126,7 @@ def test_lu(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
11381126
)
11391127

11401128
transformation_verification = TransformationVerification(
1141-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 6}}
1129+
{"RPCNodeTransform": {"loop_nests": {}}}
11421130
)
11431131

11441132
test_case = benchmark_path / "lu.c"
@@ -1196,7 +1184,7 @@ def test_trisolv(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
11961184
)
11971185

11981186
transformation_verification = TransformationVerification(
1199-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 2}}
1187+
{"RPCNodeTransform": {"loop_nests": {}}}
12001188
)
12011189

12021190
test_case = benchmark_path / "trisolv.c"
@@ -1249,7 +1237,7 @@ def test_deriche(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
12491237
)
12501238

12511239
transformation_verification = TransformationVerification(
1252-
{"RPCNodeTransform": {"loop_nests": {}, "tuned_loops": 3}}
1240+
{"RPCNodeTransform": {"loop_nests": {}}}
12531241
)
12541242

12551243
test_case = benchmark_path / "deriche.c"
@@ -1294,7 +1282,7 @@ def test_floyd_warshall(compiler="clang-19", size="MEDIUM_DATASET"):
12941282
Path(__file__).parent / "tests" / "polybench" / "medley" / "floyd-warshall"
12951283
)
12961284

1297-
transformation_verification = TransformationVerification({"RPCNodeTransform": {1}})
1285+
transformation_verification = TransformationVerification({"RPCNodeTransform": {}})
12981286

12991287
test_case = benchmark_path / "floyd-warshall.c"
13001288
runner = TestRunner(
@@ -1636,7 +1624,7 @@ def test_seidel_2d(datatype, compiler="clang-19", size="MEDIUM_DATASET"):
16361624
)
16371625

16381626
transformation_verification = TransformationVerification(
1639-
{"RPCNodeTransform": {"loop_nests": {1}, "tuned_loops": 2}}
1627+
{"RPCNodeTransform": {"loop_nests": {}}}
16401628
)
16411629
test_case = benchmark_path / "seidel-2d.c"
16421630
runner = TestRunner(

llvm/integration/test_runner.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ def verify(self, output_dir, stderr: str = None) -> None:
6262
loopnest_to_region = {region.get("loopnest_index"): region for region in regions}
6363

6464
for transformation, params in self._transformations.items():
65-
# Check for new dict format with 'loop_nests' and 'max_tuned_loops'
66-
if isinstance(params, dict) and 'loop_nests' in params and 'tuned_loops' in params:
65+
# Check for new dict format with 'loop_nests' and optional 'tuned_loops'
66+
if isinstance(params, dict) and 'loop_nests' in params:
6767
loop_nests = params['loop_nests']
68-
tuned_loops = params['tuned_loops']
6968
# Check that transformation is present in all specified loop_nests
7069
for idx in loop_nests:
7170
region = loopnest_to_region.get(idx)
@@ -74,20 +73,23 @@ def verify(self, output_dir, stderr: str = None) -> None:
7473
assert transformation in transformations, (
7574
f"Transformation {transformation} not found in region with loopnest_index {idx}."
7675
)
77-
# Count total number of times transformation was applied
78-
applied_count = 0
79-
for region in regions:
80-
transformations = region.get("transformations", {})
81-
if transformation in transformations:
82-
# Check if 'applied' is True (if present)
83-
t = transformations[transformation]
84-
if isinstance(t, dict) and t.get('applied', True):
85-
applied_count += 1
86-
elif t is True:
87-
applied_count += 1
88-
assert applied_count == tuned_loops, (
89-
f"Transformation {transformation} applied {applied_count} times but expected {tuned_loops} times"
90-
)
76+
# Only verify the applied loop count when a 'tuned_loops' count is given.
77+
if 'tuned_loops' in params:
78+
tuned_loops = params['tuned_loops']
79+
# Count total number of times transformation was applied
80+
applied_count = 0
81+
for region in regions:
82+
transformations = region.get("transformations", {})
83+
if transformation in transformations:
84+
# Check if 'applied' is True (if present)
85+
t = transformations[transformation]
86+
if isinstance(t, dict) and t.get('applied', True):
87+
applied_count += 1
88+
elif t is True:
89+
applied_count += 1
90+
assert applied_count == tuned_loops, (
91+
f"Transformation {transformation} applied {applied_count} times but expected {tuned_loops} times"
92+
)
9193
else:
9294
# Fallback to old behavior: params is a set of indices
9395
for idx in params:

0 commit comments

Comments
 (0)