@@ -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' ) as f :
2603+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
26042604 f .write (ir )
26052605 f .flush ()
26062606 kernel = triton .compile (f .name )
@@ -2734,9 +2734,10 @@ 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' ) as f :
2737+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
27382738 f .write (ir )
27392739 f .flush ()
2740+ f .close ()
27402741 kernel = triton .compile (f .name )
27412742
27422743 rs = RandomState (17 )
@@ -2788,7 +2789,7 @@ def test_store_op(M, src_layout, device):
27882789 }}
27892790 """
27902791
2791- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' ) as f :
2792+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
27922793 f .write (ir )
27932794 f .flush ()
27942795 store_kernel = triton .compile (f .name )
@@ -2838,7 +2839,7 @@ def test_convert1d(M, src_layout, dst_layout, src_dim, dst_dim, device):
28382839 }}
28392840 }}
28402841 """
2841- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' ) as f :
2842+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
28422843 f .write (ir )
28432844 f .flush ()
28442845 kernel = triton .compile (f .name )
@@ -2920,7 +2921,7 @@ def test_chain_reduce(M, N, src_layout, op, device, first_axis):
29202921 }}
29212922 }}
29222923 """
2923- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' ) as f :
2924+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
29242925 f .write (ir )
29252926 f .flush ()
29262927 kernel = triton .compile (f .name )
@@ -5297,7 +5298,7 @@ def test_convert2d(M, N, src_layout, interm_layout, dst_layout, dtype, device):
52975298 x = to_triton (numpy_random ((M , N ), dtype_str = dtype ), device = device )
52985299 z = torch .empty_like (x , device = device )
52995300
5300- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' ) as f :
5301+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
53015302 f .write (ir )
53025303 f .flush ()
53035304 kernel = triton .compile (f .name )
@@ -5410,7 +5411,7 @@ def do_test(src_layout, dst_layout):
54105411 x = to_triton (numpy_random ((M , N ), dtype_str = dtype ), device = device )
54115412 z = torch .empty_like (x )
54125413
5413- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' ) as f :
5414+ with tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.ttgir' , delete = False ) as f :
54145415 f .write (ir )
54155416 f .flush ()
54165417 kernel = triton .compile (f .name )
0 commit comments