From ef4e86f7ab05a628e80c4a7b5da29e75db4f3b7d Mon Sep 17 00:00:00 2001 From: Joe Loser Date: Tue, 10 Dec 2024 16:39:19 -0700 Subject: [PATCH] [stdlib] [GPU] Fix address spaces for AMD The address space values for AMD are incorrect, so adjust the definitions to be correct for both Nvidia and AMD. Note that there are some other oddities with address spaces we'll deal with in a follow-up. MODULAR_ORIG_COMMIT_REV_ID: a9feb989eba84e8cd69242dcd82e6188bb0c8437 --- stdlib/src/memory/pointer.mojo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/src/memory/pointer.mojo b/stdlib/src/memory/pointer.mojo index 16a4eadd29..007343d63f 100644 --- a/stdlib/src/memory/pointer.mojo +++ b/stdlib/src/memory/pointer.mojo @@ -19,6 +19,8 @@ from memory import Pointer ``` """ +from sys import is_nvidia_gpu + # ===-----------------------------------------------------------------------===# # AddressSpace @@ -36,13 +38,13 @@ struct _GPUAddressSpace(EqualityComparable): """Generic address space.""" alias GLOBAL = AddressSpace(1) """Global address space.""" - alias CONSTANT = AddressSpace(2) + alias CONSTANT = AddressSpace(2) if is_nvidia_gpu() else AddressSpace(4) """Constant address space.""" alias SHARED = AddressSpace(3) """Shared address space.""" alias PARAM = AddressSpace(4) """Param address space.""" - alias LOCAL = AddressSpace(5) + alias LOCAL = AddressSpace(5) if is_nvidia_gpu() else AddressSpace(3) """Local address space.""" @always_inline("nodebug")