[PATCH] D142237: [AMDGPU][NFC] Clarify heterogeneous DWARF address/memory spaces

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 10:12:32 PST 2023


t-tye created this revision.
t-tye added reviewers: kzhuravl, scott.linder, zoran.zaric.
Herald added subscribers: kosarev, kerbowa, tpr, dstuttard, yaxunl, jvesely.
Herald added a project: All.
t-tye requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142237

Files:
  llvm/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst


Index: llvm/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst
===================================================================
--- llvm/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst
+++ llvm/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst
@@ -327,10 +327,17 @@
 suitable for describing an entity (such as variable or subprogram code) that is
 in a single kind of memory.
 
-Therefore, AMDGPU uses the DWARF concept of address spaces. For example, a
-variable may be allocated in a register that is partially spilled to the call
-stack which is in the private address space, and partially spilled to the local
-address space.
+AMDGPU uses multiple address spaces. For example, a variable may be allocated in
+a register that is partially spilled to the call stack which is in the private
+address space, and partially spilled to the local address space. DWARF mentions
+address spaces, for example as an argument to the ``DW_OP_xderef*`` operations.
+A new section that defines address classes is added (see
+:ref:`amdgpu-dwarf-address-spaces`).
+
+A new attribute ``DW_AT_LLVM_address_space`` is added to pointer and reference
+types (see :ref:`amdgpu-dwarf-type-modifier-entries`). This allows the compiler
+to specify which address space is being used to represent the pointer or
+reference type.
 
 DWARF uses the concept of an address in many expression operations but does not
 define how it relates to address spaces. For example,
@@ -688,6 +695,18 @@
   //    the register #2 positioned as an overlay at offset #3 of size #4:
   DW_OP_LLVM_overlay
 
+2.21 Support for Source Language Memory Spaces
+----------------------------------------------
+
+AMDGPU supports languages, such as OpenCL, that define source language memory
+classes. Support is added to define language specific memory spaces so they can
+be used in a consistent way by consumers. See :ref:`amdgpu-dwarf-memory-spaces`.
+
+A new attribute ``DW_AT_LLVM_memory_space`` is added to support using memory
+spaces in defining source language pointer and reference types (see
+:ref:`amdgpu-dwarf-type-modifier-entries`) and data object allocation (see
+:ref:`amdgpu-dwarf-data-object-entries`).
+
 .. _amdgpu-dwarf-changes-relative-to-dwarf-version-5:
 
 A. Changes Relative to DWARF Version 5
@@ -3597,6 +3616,8 @@
   attributes. These would be incorporated into the corresponding DWARF Version 5
   chapter 4 sections.
 
+.. _amdgpu-dwarf-data-object-entries:
+
 A.4.1 Data Object Entries
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -3655,6 +3676,13 @@
       to be used to push the location description of any variable regardless of
       how it is optimized.
 
+3.  ``DW_AT_LLVM_memory_space``
+
+    A ``DW_AT_memory_space`` attribute with a constant value representing a source
+    language specific DWARF memory space (see 2.14 "Memory Spaces"). If omitted,
+    defaults to ``DW_MSPACE_none``.
+
+
 A.4.2 Common Block Entries
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -3714,6 +3742,8 @@
       entry, or allow some forms of ``DW_TAG_array_type`` (those that have the
       ``DW_AT_GNU_vector`` attribute) to be used as stack entry value types?
 
+.. _amdgpu-dwarf-type-modifier-entries:
+
 A.5.3 Type Modifier Entries
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142237.490906.patch
Type: text/x-patch
Size: 3236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230120/2f24daae/attachment.bin>


More information about the llvm-commits mailing list