diff --git a/tests/transformations/gpu_transform_test.py b/tests/transformations/gpu_transform_test.py index f6d299e630..779f41f99b 100644 --- a/tests/transformations/gpu_transform_test.py +++ b/tests/transformations/gpu_transform_test.py @@ -119,9 +119,60 @@ def write_subset_dynamic(A: dace.int32[20, 20], x: dace.int32[20], y: dace.int32 assert np.array_equal(ref, val) +@pytest.mark.parametrize("transient", [False, True]) +def test_free_tasklet_and_array(transient): + sdfg = dace.SDFG("assign") + + state = sdfg.add_state("main") + arr_name, arr = sdfg.add_array("A", (4,), dace.float32, transient=transient) + an = state.add_access(arr_name) + + t = state.add_tasklet("assign", {}, {"_out"}, "_out = 2.0") + state.add_edge(t, "_out", an, None, dace.memlet.Memlet("A[0]")) + + sdfg.validate() + + sdfg.apply_gpu_transformations( + validate = True, + validate_all = True, + permissive = True, + sequential_innermaps=True, + register_transients=False, + simplify=False + ) + + sdfg.validate() + +@pytest.mark.parametrize("transient", [False, True]) +def test_free_tasklet_and_scalar(transient): + sdfg = dace.SDFG("assign") + + state = sdfg.add_state("main") + arr_name, arr = sdfg.add_scalar("A", dace.float32, transient=transient) + an = state.add_access(arr_name) + + t = state.add_tasklet("assign", {}, {"_out"}, "_out = 2.0") + state.add_edge(t, "_out", an, None, dace.memlet.Memlet("A")) + + sdfg.validate() + + sdfg.apply_gpu_transformations( + validate = True, + validate_all = True, + permissive = True, + sequential_innermaps=True, + register_transients=False, + simplify=False + ) + + sdfg.validate() + if __name__ == '__main__': test_toplevel_transient_lifetime() test_scalar_to_symbol_in_nested_sdfg() test_write_subset() test_write_full() test_write_subset_dynamic() + for transient in [False, True]: + test_free_tasklet_and_array(transient) + test_free_tasklet_and_array(transient)