Skip to content

Commit e5417cf

Browse files
committed
Removed torch.cuda.synchronize and delete=False for temp files
Signed-off-by: Gregory Shimansky <[email protected]>
1 parent 684c115 commit e5417cf

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

python/test/unit/language/print_helper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ def test_print(func: str, data_type: str, device: str):
140140
func != "print_multiple_args" and func != "device_print_multiple_args" and \
141141
func != "device_print_pointer" and func != "device_print_scalar":
142142
assert_close(y, x)
143-
if torch.cuda.is_available():
144-
torch.cuda.synchronize()
145143

146144
# Wait until driver complete all the jobs for the device_print, especially test_subprocess
147145
# require this which captures stdout when child exits.

python/test/unit/language/test_core.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ def test_scan_layouts(M, N, src_layout, axis, device):
26002600
}}
26012601
"""
26022602

2603-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
2603+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
26042604
f.write(ir)
26052605
f.flush()
26062606
kernel = triton.compile(f.name)
@@ -2734,10 +2734,9 @@ def test_reduce_layouts(M, N, src_layout, axis, epilogue_kind, dtype_str, reduce
27342734
}}) {{axis = {axis} : i32}} : (tensor<{M}x{N}x{ty}, #src>) -> tensor<{rdims_1d}x{ty}, #{GPU_DIALECT}.slice<{{dim = {axis}, parent = #src}}>>
27352735
""" + epilogue
27362736

2737-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
2737+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
27382738
f.write(ir)
27392739
f.flush()
2740-
f.close()
27412740
kernel = triton.compile(f.name)
27422741

27432742
rs = RandomState(17)
@@ -2789,7 +2788,7 @@ def test_store_op(M, src_layout, device):
27892788
}}
27902789
"""
27912790

2792-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
2791+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
27932792
f.write(ir)
27942793
f.flush()
27952794
store_kernel = triton.compile(f.name)
@@ -2839,7 +2838,7 @@ def test_convert1d(M, src_layout, dst_layout, src_dim, dst_dim, device):
28392838
}}
28402839
}}
28412840
"""
2842-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
2841+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
28432842
f.write(ir)
28442843
f.flush()
28452844
kernel = triton.compile(f.name)
@@ -2921,7 +2920,7 @@ def test_chain_reduce(M, N, src_layout, op, device, first_axis):
29212920
}}
29222921
}}
29232922
"""
2924-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
2923+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
29252924
f.write(ir)
29262925
f.flush()
29272926
kernel = triton.compile(f.name)
@@ -5298,7 +5297,7 @@ def test_convert2d(M, N, src_layout, interm_layout, dst_layout, dtype, device):
52985297
x = to_triton(numpy_random((M, N), dtype_str=dtype), device=device)
52995298
z = torch.empty_like(x, device=device)
53005299

5301-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
5300+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
53025301
f.write(ir)
53035302
f.flush()
53045303
kernel = triton.compile(f.name)
@@ -5411,7 +5410,7 @@ def do_test(src_layout, dst_layout):
54115410
x = to_triton(numpy_random((M, N), dtype_str=dtype), device=device)
54125411
z = torch.empty_like(x)
54135412

5414-
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir', delete=False) as f:
5413+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ttgir') as f:
54155414
f.write(ir)
54165415
f.flush()
54175416
kernel = triton.compile(f.name)

0 commit comments

Comments
 (0)