Page MenuHomePhabricator

[mlir] Fix LLVM lowering of memory space in unranked memrefs

Authored by dcaballe on Sep 21 2020, 1:35 PM.



This patch lowers the memory space of an unraked memref to the
proper address space in LLVM. We were always lowering it to the
default memory space.

Diff Detail

Event Timeline

dcaballe created this revision.Sep 21 2020, 1:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2020, 1:35 PM
dcaballe requested review of this revision.Sep 21 2020, 1:35 PM

Hmm, this may not be as straightforward as it seems. The pointer in the unranked memref descriptor is to the ranked descriptor struct rather than to the data. Since we don't have two memory spaces in the type, we need to at least define a convention. One can be that the descriptor of the memref is allocated in the same memory space as the memref itself, which requires changes to memref_cast lowering and thinking about what it means for descriptors that live in registers. Another convention can be that the descriptor itself lives in the default memory space, and then this change isn't necessary, only making sure that memref_cast produces the llvm.bitcast to a descriptor struct with correct memory spaces inside.

ftynse requested changes to this revision.Sep 22 2020, 1:15 AM
This revision now requires changes to proceed.Sep 22 2020, 1:15 AM
dcaballe abandoned this revision.Sep 24 2020, 7:43 PM

Sorry, I misunderstood what an unranked memref models. This indeed doesn't make sense as is. Thanks.