Skip to content

Commit

Permalink
finish fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
fifield committed Nov 20, 2024
1 parent b11eaa6 commit 7278acf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 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.result.get_name()
return self.sym_name.value if self.sym_name else ""

def __str__(self):
return str(self.result)
Expand Down
36 changes: 18 additions & 18 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(%buffer_2_2, memref<10x10xi32>) producer_lock=Scalar(%buffer_2_2_producer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_producer_lock"}) consumer_lock=Scalar(%buffer_2_2_consumer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_consumer_lock"})>
# 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)>
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(%buffer_2_2_0, memref<10x10xi32>) producer_lock=Scalar(%buffer_2_2_0_producer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_0_producer_lock"}) consumer_lock=Scalar(%buffer_2_2_0_consumer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_0_consumer_lock"})>
# CHECK: (0, 1) <Channel: buffer=MemRef(%buffer_2_3, memref<10x10xi32>) producer_lock=Scalar(%buffer_2_3_producer_lock = aie.lock(%tile_2_3) {sym_name = "buffer_2_3_producer_lock"}) consumer_lock=Scalar(%buffer_2_3_consumer_lock = aie.lock(%tile_2_3) {sym_name = "buffer_2_3_consumer_lock"})>
# CHECK: (1, 0) <Channel: buffer=MemRef(%buffer_3_2, memref<10x10xi32>) producer_lock=Scalar(%buffer_3_2_producer_lock = aie.lock(%tile_3_2) {sym_name = "buffer_3_2_producer_lock"}) consumer_lock=Scalar(%buffer_3_2_consumer_lock = aie.lock(%tile_3_2) {sym_name = "buffer_3_2_consumer_lock"})>
# CHECK: (1, 1) <Channel: buffer=MemRef(%buffer_3_3, memref<10x10xi32>) producer_lock=Scalar(%buffer_3_3_producer_lock = aie.lock(%tile_3_3) {sym_name = "buffer_3_3_producer_lock"}) consumer_lock=Scalar(%buffer_3_3_consumer_lock = aie.lock(%tile_3_3) {sym_name = "buffer_3_3_consumer_lock"})>
# 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)>
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(%buffer_2_2_1, memref<1x2xi32>) producer_lock=Scalar(%buffer_2_2_1_producer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_1_producer_lock"}) consumer_lock=Scalar(%buffer_2_2_1_consumer_lock = aie.lock(%tile_2_2) {sym_name = "buffer_2_2_1_consumer_lock"})>
# CHECK: (0, 1) <Channel: buffer=MemRef(%buffer_2_3_2, memref<3x4xi32>) producer_lock=Scalar(%buffer_2_3_2_producer_lock = aie.lock(%tile_2_3) {sym_name = "buffer_2_3_2_producer_lock"}) consumer_lock=Scalar(%buffer_2_3_2_consumer_lock = aie.lock(%tile_2_3) {sym_name = "buffer_2_3_2_consumer_lock"})>
# CHECK: (1, 0) <Channel: buffer=MemRef(%buffer_3_2_3, memref<5x6xi32>) producer_lock=Scalar(%buffer_3_2_3_producer_lock = aie.lock(%tile_3_2) {sym_name = "buffer_3_2_3_producer_lock"}) consumer_lock=Scalar(%buffer_3_2_3_consumer_lock = aie.lock(%tile_3_2) {sym_name = "buffer_3_2_3_consumer_lock"})>
# CHECK: (1, 1) <Channel: buffer=MemRef(%buffer_3_3_4, memref<7x8xi32>) producer_lock=Scalar(%buffer_3_3_4_producer_lock = aie.lock(%tile_3_3) {sym_name = "buffer_3_3_4_producer_lock"}) consumer_lock=Scalar(%buffer_3_3_4_consumer_lock = aie.lock(%tile_3_3) {sym_name = "buffer_3_3_4_consumer_lock"})>
# 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)>
for idx, c in np.ndenumerate(cs):
print(idx, c)

Expand All @@ -384,25 +384,25 @@ def npu():

shapes = [(10, 10)]
c = tiles[2, 2].buffer(shape=shapes, dtype=[np.int32])
# CHECK: MemRef(%buffer_2_2, memref<10x10xi32>)
# CHECK: MemRef(%30, memref<10x10xi32>)
print(c)
cs = tiles[2:4, 2:4].buffer(shape=shapes, dtype=[np.int32])
assert cs.shape == (2, 2)

# CHECK: (0, 0) MemRef(%buffer_2_2_0, memref<10x10xi32>)
# CHECK: (0, 1) MemRef(%buffer_2_3, memref<10x10xi32>)
# CHECK: (1, 0) MemRef(%buffer_3_2, memref<10x10xi32>)
# CHECK: (1, 1) MemRef(%buffer_3_3, memref<10x10xi32>)
# CHECK: (0, 0) MemRef(%31, memref<10x10xi32>)
# CHECK: (0, 1) MemRef(%32, memref<10x10xi32>)
# CHECK: (1, 0) MemRef(%33, memref<10x10xi32>)
# CHECK: (1, 1) MemRef(%34, memref<10x10xi32>)
for idx, c in np.ndenumerate(cs):
print(idx, c)

shapes = [[(1, 2), (3, 4)], [(5, 6), (7, 8)]]
cs = tiles[2:4, 2:4].buffer(shape=shapes, dtype=[np.int32])
assert cs.shape == (2, 2)

# CHECK: (0, 0) MemRef(%buffer_2_2_1, memref<1x2xi32>)
# CHECK: (0, 1) MemRef(%buffer_2_3_2, memref<3x4xi32>)
# CHECK: (1, 0) MemRef(%buffer_3_2_3, memref<5x6xi32>)
# CHECK: (1, 1) MemRef(%buffer_3_3_4, memref<7x8xi32>)
# CHECK: (0, 0) MemRef(%35, memref<1x2xi32>)
# CHECK: (0, 1) MemRef(%36, memref<3x4xi32>)
# CHECK: (1, 0) MemRef(%37, memref<5x6xi32>)
# CHECK: (1, 1) MemRef(%38, memref<7x8xi32>)
for idx, c in np.ndenumerate(cs):
print(idx, c)

0 comments on commit 7278acf

Please sign in to comment.