[PATCH] D61493: AMDGPU/MC: Add .amdgpu_lds directive

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 05:03:51 PDT 2019


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, rampitec, t-tye, b-sumner, jsjodin.
Herald added subscribers: rupprecht, tpr, dstuttard, yaxunl, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

The directive defines a symbol as an group/local memory (LDS) symbol.
LDS symbols are of the processor-specific STT_AMDGPU_LDS type and encode
their minimum alignment requirement in the st_other field.

It is the linker and/or runtime loader's job to "instantiate" LDS symbols
and resolve relocations that reference them.

It is not possible to initialize LDS memory (not even zero-initialize
as for .bss).

We want to be able to link together objects -- starting with relocatable
objects, but possible expanding to shared objects in the future -- that
access LDS memory in a flexible way.

LDS memory is in an address space that is entirely separate from the
address space that contains the program image (code and normal data),
so having program segments for it doesn't really make sense.

Furthermore, we want to be able to compile multiple kernels in a
compilation unit which have disjoint use of LDS memory. In that case,
we may want to place LDS symbols differently for different kernels
to save memory (LDS memory is very limited and physically private to
each kernel invocation), so we can't simply place LDS symbols in a
.lds section.

Hence this solution where LDS symbols always stay undefined.

Change-Id: I08cbc37a7c0c32f53f7b6123aa0afc91dbc1748f


Repository:
  rL LLVM

https://reviews.llvm.org/D61493

Files:
  docs/AMDGPUUsage.rst
  include/llvm/BinaryFormat/ELF.h
  lib/MC/MCSymbolELF.cpp
  lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
  lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
  lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
  test/MC/AMDGPU/elf-lds-error.s
  test/MC/AMDGPU/elf-lds.s
  tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61493.197961.patch
Type: text/x-patch
Size: 12782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190503/4771adb3/attachment.bin>


More information about the llvm-commits mailing list