]> granicus.if.org Git - llvm/commit
AMDGPU/MC: Add .amdgpu_lds directive
authorNicolai Haehnle <nhaehnle@gmail.com>
Tue, 25 Jun 2019 11:51:35 +0000 (11:51 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Tue, 25 Jun 2019 11:51:35 +0000 (11:51 +0000)
commitf1a1a392dbca5a0240b26a88ea3bc470e8df62cd
treec2f9b8b6b0100df8eb8ffa99a5a0820c630c29f3
parent6fb3129d4f134a2d96d813c760ab8175930b8211
AMDGPU/MC: Add .amdgpu_lds directive

Summary:
The directive defines a symbol as an group/local memory (LDS) symbol.
LDS symbols behave similar to common symbols for the purposes of ELF,
using the processor-specific SHN_AMDGPU_LDS as section index.

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

Reviewers: arsenm, rampitec, t-tye, b-sumner, jsjodin

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61493

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364296 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
docs/AMDGPUUsage.rst
include/llvm/BinaryFormat/ELF.h
include/llvm/MC/MCSymbol.h
lib/MC/ELFObjectWriter.cpp
lib/ObjectYAML/ELFYAML.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 [new file with mode: 0644]
test/MC/AMDGPU/elf-lds.s [new file with mode: 0644]
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/ELF/Object.h