[Mlir-commits] [mlir] [mlir][LLVM|ptr] Add the `#llvm.address_space` attribute, and allow `ptr` translation (PR #156333)
Fabian Mora
llvmlistbot at llvm.org
Tue Sep 2 03:40:12 PDT 2025
================
@@ -23,6 +24,41 @@ class LLVM_Attr<string name, string attrMnemonic,
let mnemonic = attrMnemonic;
}
+//===----------------------------------------------------------------------===//
+// AddressSpaceAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_AddressSpaceAttr :
+ LLVM_Attr<"AddressSpace", "address_space", [
+ DeclareAttrInterfaceMethods<MemorySpaceAttrInterface>
+ ]> {
+ let summary = "LLVM address space";
+ let description = [{
+ The `address_space` attribute represents an LLVM address space. It takes an
+ unsigned integer parameter that specifies the address space number.
+
+ Different address spaces in LLVM can have different properties:
+ - Address space 0 is the default/generic address space
+ - Other address spaces may have specific semantics (e.g., shared memory,
+ constant memory, etc.) depending on the target architecture
+
+ Example:
+
+ ```mlir
+ // Address space 0 (default)
+ #llvm.address_space<0>
+
+ // Address space 1 (e.g., global memory on some targets)
+ #llvm.address_space<1>
+
+ // Address space 3 (e.g., shared memory on some GPU targets)
+ #llvm.address_space<3>
+ ```
+ }];
+ let parameters = (ins "unsigned":$addressSpace);
----------------
fabianmcg wrote:
Should I bundle that new interface into this PR, or lets land this and then land the interface?
https://github.com/llvm/llvm-project/pull/156333
More information about the Mlir-commits
mailing list