Skip to content

Commit

Permalink
ensure symbols get a unique name in tile_array.py test
Browse files Browse the repository at this point in the history
  • Loading branch information
fifield committed Nov 23, 2024
1 parent cef1f54 commit 77ae155
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/dialects/aie.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions test/python/tile_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: <Channel: buffer=MemRef(%30, memref<10x10xi32>) 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: <Channel: buffer=MemRef(%30, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%33, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%36, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%39, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%42, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%33, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%36, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%39, memref<10x10xi32>) 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) <Channel: buffer=MemRef(%42, memref<10x10xi32>) 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)

Expand All @@ -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) <Channel: buffer=MemRef(%45, memref<1x2xi32>) 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) <Channel: buffer=MemRef(%48, memref<3x4xi32>) 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) <Channel: buffer=MemRef(%51, memref<5x6xi32>) 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) <Channel: buffer=MemRef(%54, memref<7x8xi32>) 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) <Channel: buffer=MemRef(%45, memref<1x2xi32>) 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) <Channel: buffer=MemRef(%48, memref<3x4xi32>) 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) <Channel: buffer=MemRef(%51, memref<5x6xi32>) 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) <Channel: buffer=MemRef(%54, memref<7x8xi32>) 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)

Expand Down

0 comments on commit 77ae155

Please sign in to comment.