Skip to content

Commit

Permalink
A few more test fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
fifield committed Aug 17, 2023
1 parent 1e6ebab commit ce91afa
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 36 deletions.
11 changes: 7 additions & 4 deletions test/ipu-xrt/add_one_metadata/aie.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,22 @@ module {
}
AIE.end
}

memref.global "public" @outOF : memref<32xi32>
memref.global "public" @inOF : memref<32xi32>
func.func @sequence(%in : memref<4x2x8xi32>, %buf : memref<32xi32>, %out : memref<64xi32>) {
%c0 = arith.constant 0 : i32
%c1 = arith.constant 1 : i32
%c2 = arith.constant 2 : i32
%c8 = arith.constant 8 : i32
%c16 = arith.constant 16 : i32
%c32 = arith.constant 32 : i32
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c1,%c32][%c0,%c0,%c0]) { metadata = "of_toMem", id = 1 : i32 } : (i32, i32, memref<64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in[%c0,%c2,%c0,%c0][%c1,%c2,%c2,%c8][%c0,%c16,%c8]) { metadata = "of_fromMem", id = 0 : i32 } : (i32, i32, memref<4x2x8xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c1,%c32][%c0,%c0,%c0]) { metadata = @outOF, id = 1 : i32 } : (i32, i32, memref<64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in[%c0,%c2,%c0,%c0][%c1,%c2,%c2,%c8][%c0,%c16,%c8]) { metadata = @inOF, id = 0 : i32 } : (i32, i32, memref<4x2x8xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.sync { column = 0 : i32, row = 0 : i32, direction = 0 : i32, channel = 0 : i32, column_num = 1 : i32, row_num = 1 : i32 }
return
}
AIE.shimDMAAllocation @inOF (MM2S, 0, 0)
AIE.shimDMAAllocation @outOF (S2MM, 0, 0)
}
AIE.shimDMAAllocation("of_fromMem", MM2S, 0, 0)
AIE.shimDMAAllocation("of_toMem", S2MM, 0, 0)
}
17 changes: 10 additions & 7 deletions test/ipu-xrt/eltwise_add_memcpy_nd/aiert_insts.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@

module {
AIE.device(ipu) {
memref.global "public" @inOF0 : memref<128xi32>
memref.global "public" @inOF1 : memref<128xi32>
memref.global "public" @outOF : memref<128xi32>
func.func @sequence(%in0 : memref<128xi32>, %in1 : memref<128xi32>, %out : memref<128xi32>) {
%c0 = arith.constant 0 : i32
%c1 = arith.constant 1 : i32
%c4 = arith.constant 4 : i32
%c32 = arith.constant 32 : i32
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = "of_toMem", id = 1 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in0[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = "of_fromMem0", id = 0 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in1[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = "of_fromMem1", id = 1 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = @outOF, id = 1 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in0[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = @inOF0, id = 0 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in1[%c0,%c0,%c0,%c0][%c1,%c1,%c4,%c32][%c0,%c0,%c32]) { metadata = @inOF1, id = 1 : i32 } : (i32, i32, memref<128xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.sync { column = 0 : i32, row = 0 : i32, direction = 0 : i32, channel = 0 : i32, column_num = 1 : i32, row_num = 1 : i32 }
return
}
AIE.shimDMAAllocation @inOF0 (MM2S, 0, 0)
AIE.shimDMAAllocation @inOF1 (MM2S, 1, 0)
AIE.shimDMAAllocation @outOF (S2MM, 0, 0)
}
}
AIE.shimDMAAllocation("of_fromMem0", MM2S, 0, 0)
AIE.shimDMAAllocation("of_fromMem1", MM2S, 1, 0)
AIE.shimDMAAllocation("of_toMem", S2MM, 0, 0)
}
42 changes: 21 additions & 21 deletions test/ipu-xrt/four_core_chain/aie.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module {
%tile03 = AIE.tile(0, 3)
%tile04 = AIE.tile(0, 4)
%tile05 = AIE.tile(0, 5)
%connect1 = AIE.objectFifo.createObjectFifo(%tile00, {%tile02}, 2 : i32) {sym_name = "of0"} : !AIE.objectFifo<memref<64xi32>>
%connect2_3 = AIE.objectFifo.createObjectFifo(%tile02, {%tile03}, 2 : i32) {sym_name = "of1"} : !AIE.objectFifo<memref<64xi32>>
%connect3_4 = AIE.objectFifo.createObjectFifo(%tile03, {%tile04}, 2 : i32) {sym_name = "of2"} : !AIE.objectFifo<memref<64xi32>>
%connect4_5 = AIE.objectFifo.createObjectFifo(%tile04, {%tile05}, 2 : i32) {sym_name = "of3"} : !AIE.objectFifo<memref<64xi32>>
%connect5 = AIE.objectFifo.createObjectFifo(%tile05, {%tile00}, 2 : i32) {sym_name = "of4"} : !AIE.objectFifo<memref<64xi32>>
AIE.objectFifo @connect1(%tile00, {%tile02}, 2 : i32) : !AIE.objectFifo<memref<64xi32>>
AIE.objectFifo @connect2_3(%tile02, {%tile03}, 2 : i32) : !AIE.objectFifo<memref<64xi32>>
AIE.objectFifo @connect3_4(%tile03, {%tile04}, 2 : i32) : !AIE.objectFifo<memref<64xi32>>
AIE.objectFifo @connect4_5(%tile04, {%tile05}, 2 : i32) : !AIE.objectFifo<memref<64xi32>>
AIE.objectFifo @connect5(%tile05, {%tile00}, 2 : i32) : !AIE.objectFifo<memref<64xi32>>

func.func @kernel_add(%in: memref<64xi32>, %out: memref<64xi32>, %value: i32) -> () {
%c0 = arith.constant 0 : index
Expand Down Expand Up @@ -48,15 +48,15 @@ module {
%c2_32 = arith.constant 2 : i32

scf.for %arg3 = %c0 to %c1024 step %c1 {
%subview1 = AIE.objectFifo.acquire<Consume>(%connect1 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview1 = AIE.objectFifo.acquire @connect1(Consume, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem1 = AIE.objectFifo.subview.access %subview1[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>
%subview2 = AIE.objectFifo.acquire<Produce>(%connect2_3 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview2 = AIE.objectFifo.acquire @connect2_3(Produce, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem2 = AIE.objectFifo.subview.access %subview2[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>

func.call @kernel_add(%elem1, %elem2, %c2_32) : (memref<64xi32>, memref<64xi32>, i32) -> ()

AIE.objectFifo.release<Consume>(%connect1 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release<Produce>(%connect2_3 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release @connect1(Consume, 1)
AIE.objectFifo.release @connect2_3(Produce, 1)

}
AIE.end
Expand All @@ -72,15 +72,15 @@ module {
%c3_32 = arith.constant 3 : i32

scf.for %arg3 = %c0 to %c1024 step %c1 {
%subview1 = AIE.objectFifo.acquire<Consume>(%connect2_3 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview1 = AIE.objectFifo.acquire @connect2_3(Consume, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem1 = AIE.objectFifo.subview.access %subview1[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>
%subview2 = AIE.objectFifo.acquire<Produce>(%connect3_4 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview2 = AIE.objectFifo.acquire @connect3_4(Produce, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem2 = AIE.objectFifo.subview.access %subview2[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>

func.call @kernel_mul(%elem1, %elem2, %c3_32) : (memref<64xi32>, memref<64xi32>, i32) -> ()

AIE.objectFifo.release<Consume>(%connect2_3 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release<Produce>(%connect3_4 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release @connect2_3(Consume, 1)
AIE.objectFifo.release @connect3_4(Produce, 1)

}
AIE.end
Expand All @@ -96,15 +96,15 @@ module {
%c4_32 = arith.constant 4 : i32

scf.for %arg3 = %c0 to %c1024 step %c1 {
%subview1 = AIE.objectFifo.acquire<Consume>(%connect3_4 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview1 = AIE.objectFifo.acquire @connect3_4(Consume, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem1 = AIE.objectFifo.subview.access %subview1[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>
%subview2 = AIE.objectFifo.acquire<Produce>(%connect4_5 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview2 = AIE.objectFifo.acquire @connect4_5(Produce, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem2 = AIE.objectFifo.subview.access %subview2[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>

func.call @kernel_add(%elem1, %elem2, %c4_32) : (memref<64xi32>, memref<64xi32>, i32) -> ()

AIE.objectFifo.release<Consume>(%connect3_4 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release<Produce>(%connect4_5 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release @connect3_4(Consume, 1)
AIE.objectFifo.release @connect4_5(Produce, 1)

}
AIE.end
Expand All @@ -120,15 +120,15 @@ module {
%c5_32 = arith.constant 5 : i32

scf.for %arg3 = %c0 to %c1024 step %c1 {
%subview1 = AIE.objectFifo.acquire<Consume>(%connect4_5 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview1 = AIE.objectFifo.acquire @connect4_5(Consume, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem1 = AIE.objectFifo.subview.access %subview1[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>
%subview2 = AIE.objectFifo.acquire<Produce>(%connect5 : !AIE.objectFifo<memref<64xi32>>, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%subview2 = AIE.objectFifo.acquire @connect5(Produce, 1) : !AIE.objectFifoSubview<memref<64xi32>>
%elem2 = AIE.objectFifo.subview.access %subview2[0] : !AIE.objectFifoSubview<memref<64xi32>> -> memref<64xi32>

func.call @kernel_mul(%elem1, %elem2, %c5_32) : (memref<64xi32>, memref<64xi32>, i32) -> ()

AIE.objectFifo.release<Consume>(%connect4_5 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release<Produce>(%connect5 : !AIE.objectFifo<memref<64xi32>>, 1)
AIE.objectFifo.release @connect4_5(Consume, 1)
AIE.objectFifo.release @connect5(Produce, 1)

}
AIE.end
Expand Down
10 changes: 6 additions & 4 deletions test/ipu-xrt/four_core_chain_skip/aie.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,20 @@ AIE.device(ipu) {
AIE.end
}

memref.global "public" @inOF : memref<64x64xi32>
memref.global "public" @outOF : memref<64x64xi32>
func.func @sequence(%in : memref<64x64xi32>, %b : memref<64xi32>, %out : memref<64x64xi32>) {
%c0 = arith.constant 0 : i32
%c1 = arith.constant 1 : i32
%c64 = arith.constant 64 : i32
%c1024 = arith.constant 1024 : i32
%c4096 = arith.constant 4096 : i32
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c64,%c64][%c0,%c0,%c64]) { metadata = "of_toMem", id = 1 : i32 } : (i32, i32, memref<64x64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in[%c0,%c0,%c0,%c0][%c1,%c1,%c64,%c64][%c0,%c0,%c64]) { metadata = "of_fromMem", id = 0 : i32 } : (i32, i32, memref<64x64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %out[%c0,%c0,%c0,%c0][%c1,%c1,%c64,%c64][%c0,%c0,%c64]) { metadata = @outOF, id = 1 : i32 } : (i32, i32, memref<64x64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.dma_memcpy_nd (%c0, %c0, %in[%c0,%c0,%c0,%c0][%c1,%c1,%c64,%c64][%c0,%c0,%c64]) { metadata = @inOF, id = 0 : i32 } : (i32, i32, memref<64x64xi32>, [i32,i32,i32,i32], [i32,i32,i32,i32], [i32,i32,i32])
AIEX.ipu.sync { column = 0 : i32, row = 0 : i32, direction = 0 : i32, channel = 0 : i32, column_num = 1 : i32, row_num = 1 : i32 }
return
}
AIE.shimDMAAllocation @inOF (MM2S, 0, 0)
AIE.shimDMAAllocation @outOF (S2MM, 0, 0)
}
AIE.shimDMAAllocation("of_fromMem", MM2S, 0, 0)
AIE.shimDMAAllocation("of_toMem", S2MM, 0, 0)
}

0 comments on commit ce91afa

Please sign in to comment.