[clang] [lld] [llvm] [mlir] [IR] Introduce `T<address space>` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

Justin Holewinski via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 12:00:02 PDT 2024


jholewinski wrote:

>> If you specify a flat address space, does that mean that all other address spaces are not flat, and thus cannot alias with other address spaces?

> Yes, all other address spaces are not flat. A flat address space pointer can still point to the same place as a non-flat address space pointer, so it doesn't guarantee no alias.

Just to clarify, does this mean any two non-flat address space pointers _cannot_ alias?

> I think conceptually we should describe AS hierarchy explicitly, and avoid the assumptions on their number or layout.
E.g. T0:1,2,3,4,5 may mean AS 0 is a flat superset of AS 1,2,3,4,5.

This definitely feels more expressive, though I'm still concerned about the (no-)aliasing guarantees. It's useful to have two non-flat address spaces that _can_ alias, for example two address spaces that may touch the same underlying memory using two vastly different hardware paths. For GPUs, this could be global and texture memory. It may technically be the same memory and can alias, even though the instructions and hardware paths used to access it are very different.

https://github.com/llvm/llvm-project/pull/108786


More information about the cfe-commits mailing list