nod-ai / iree-amd-aie

IREE plugin repository for the AMD AIE accelerator
Apache License 2.0
69 stars 30 forks source link

[ObjectFifoStatefulTransform] Fix memory space. #770

Closed newling closed 2 months ago

newling commented 2 months ago

This patch (along with a modification to the tiling on main) enables int32, single core convolution to compile. It fixes the error

<unknown>:0: error: different memory spaces specified for source type 'memref<16xi32, 1 : i32>' and result memref type 'memref<1x1x4x4xi32, 2 : i32>'
<unknown>:0: note: see current operation: %52 = "memref.reinterpret_cast"(%7) <{operandSegmentSizes = array<i32: 1, 0, 0, 0>, static_offsets = array<i64: 0>, static_sizes = array<i64: 1, 1, 4, 4>, static_strides = array<i64: 16, 16, 4, 1>}> : (memref<16xi32, 1 : i32>) -> memref<1x1x4x4xi32, 2 : i32>

I guess this is another fix for what was probably undone in: https://github.com/nod-ai/iree-amd-aie/pull/692

If I understood the original logic better I could probably provide a less clunky fix. This PR gets the memspace from the row that the buffer is on. It assumes row 1 is memory tile, and rows 2+ are AIE cores.

Last comment: the test updated makes more sense now, before it was doing math on memspace 1 memrefs.

newling commented 2 months ago

Closing while I work on a better solution