From 77ae155e0cc6a1dbb2a29c81b30ed0422951f42f Mon Sep 17 00:00:00 2001 From: Jeff Fifield Date: Fri, 22 Nov 2024 18:02:13 -0700 Subject: [PATCH] ensure symbols get a unique name in tile_array.py test --- python/dialects/aie.py | 2 +- test/python/tile_array.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/dialects/aie.py b/python/dialects/aie.py index e117251970..6ee6030f9e 100644 --- a/python/dialects/aie.py +++ b/python/dialects/aie.py @@ -290,7 +290,7 @@ def __init__( ) def get_name(self): - return self.sym_name.value if self.sym_name else "" + return self.sym_name.value if self.sym_name else self.result.get_name() def __str__(self): return str(self.result) diff --git a/test/python/tile_array.py b/test/python/tile_array.py index c9725023c5..60da37a90b 100644 --- a/test/python/tile_array.py +++ b/test/python/tile_array.py @@ -347,15 +347,15 @@ def npu(): shapes = np.array([(10, 10)], dtype="i,i").astype(object) c = tiles[2, 2].channel(shape=shapes, dtype=[np.int32]) - # CHECK: ) producer_lock=Scalar(%31 = "aie.lock"(%14) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%32 = "aie.lock"(%14) <{sym_name = "_consumer_lock"}> : (index) -> index)> + # CHECK: ) producer_lock=Scalar(%31 = "aie.lock"(%14) <{sym_name = "30_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%32 = "aie.lock"(%14) <{sym_name = "30_consumer_lock"}> : (index) -> index)> print(c) cs = tiles[2:4, 2:4].channel(shape=shapes, dtype=[np.int32]) assert cs.shape == (2, 2) - # CHECK: (0, 0) ) producer_lock=Scalar(%34 = "aie.lock"(%14) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%35 = "aie.lock"(%14) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (0, 1) ) producer_lock=Scalar(%37 = "aie.lock"(%15) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%38 = "aie.lock"(%15) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (1, 0) ) producer_lock=Scalar(%40 = "aie.lock"(%20) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%41 = "aie.lock"(%20) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (1, 1) ) producer_lock=Scalar(%43 = "aie.lock"(%21) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%44 = "aie.lock"(%21) <{sym_name = "_consumer_lock"}> : (index) -> index)> + # CHECK: (0, 0) ) producer_lock=Scalar(%34 = "aie.lock"(%14) <{sym_name = "33_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%35 = "aie.lock"(%14) <{sym_name = "33_consumer_lock"}> : (index) -> index)> + # CHECK: (0, 1) ) producer_lock=Scalar(%37 = "aie.lock"(%15) <{sym_name = "36_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%38 = "aie.lock"(%15) <{sym_name = "36_consumer_lock"}> : (index) -> index)> + # CHECK: (1, 0) ) producer_lock=Scalar(%40 = "aie.lock"(%20) <{sym_name = "39_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%41 = "aie.lock"(%20) <{sym_name = "39_consumer_lock"}> : (index) -> index)> + # CHECK: (1, 1) ) producer_lock=Scalar(%43 = "aie.lock"(%21) <{sym_name = "42_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%44 = "aie.lock"(%21) <{sym_name = "42_consumer_lock"}> : (index) -> index)> for idx, c in np.ndenumerate(cs): print(idx, c) @@ -365,10 +365,10 @@ def npu(): cs = tiles[2:4, 2:4].channel(shape=shapes, dtype=[np.int32]) assert cs.shape == (2, 2) - # CHECK: (0, 0) ) producer_lock=Scalar(%46 = "aie.lock"(%14) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%47 = "aie.lock"(%14) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (0, 1) ) producer_lock=Scalar(%49 = "aie.lock"(%15) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%50 = "aie.lock"(%15) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (1, 0) ) producer_lock=Scalar(%52 = "aie.lock"(%20) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%53 = "aie.lock"(%20) <{sym_name = "_consumer_lock"}> : (index) -> index)> - # CHECK: (1, 1) ) producer_lock=Scalar(%55 = "aie.lock"(%21) <{sym_name = "_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%56 = "aie.lock"(%21) <{sym_name = "_consumer_lock"}> : (index) -> index)> + # CHECK: (0, 0) ) producer_lock=Scalar(%46 = "aie.lock"(%14) <{sym_name = "45_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%47 = "aie.lock"(%14) <{sym_name = "45_consumer_lock"}> : (index) -> index)> + # CHECK: (0, 1) ) producer_lock=Scalar(%49 = "aie.lock"(%15) <{sym_name = "48_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%50 = "aie.lock"(%15) <{sym_name = "48_consumer_lock"}> : (index) -> index)> + # CHECK: (1, 0) ) producer_lock=Scalar(%52 = "aie.lock"(%20) <{sym_name = "51_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%53 = "aie.lock"(%20) <{sym_name = "51_consumer_lock"}> : (index) -> index)> + # CHECK: (1, 1) ) producer_lock=Scalar(%55 = "aie.lock"(%21) <{sym_name = "54_producer_lock"}> : (index) -> index) consumer_lock=Scalar(%56 = "aie.lock"(%21) <{sym_name = "54_consumer_lock"}> : (index) -> index)> for idx, c in np.ndenumerate(cs): print(idx, c)