Skip to content

Commit

Permalink
[stdlib] [GPU] Fix address spaces for AMD
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JoeLoser authored and modularbot committed Dec 11, 2024
1 parent 8123754 commit ef4e86f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stdlib/src/memory/pointer.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ from memory import Pointer
```
"""

from sys import is_nvidia_gpu


# ===-----------------------------------------------------------------------===#
# AddressSpace
Expand All @@ -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")
Expand Down

0 comments on commit ef4e86f

Please sign in to comment.