[Mesa-dev] [PATCH 0/6] amd,radeonsi: link explicit LDS symbols

Nicolai Hähnle nhaehnle at gmail.com
Sat May 4 13:39:16 UTC 2019


this series builds on my recent series adding a runtime linker to now
support layout and relocation of explicit LDS symbols.

Currently, all our uses of LDS have a single LDS base pointer which
is defined either by an inttoptr case from 0 or as a single global LDS
symbol. This is fine for our current use cases, but it gets tedious
when we want to do more with LDS, such as keeping multiple logically
separately variables in LDS.

(LS/HS shaders are already affected by this issue, because they use LDS
for two conceptually separate things: vertex shader outputs to be read
by the TCS, and TCS outputs in case they are read back for cross-thread
communication. Ironically, since we don't know the LS/HS LDS data sizes
until draw time, this series won't help there.)

This series works in tandem with related changes in LLVM, see the changes
leading up to and including https://reviews.llvm.org/D61494:
- global in the LDS address space are written out as specially marked
  symbols to the ELF object by LLVM
- the Mesa rtld combines those symbols with driver-specified "shared"
  LDS symbols, where the "shared" means shared between multiple shader
  parts
- rtld calculates a layout for the objects in LDS: shared  symbols
  first, followed by private, per-shader-part symbols that can alias,
  followed by the special __lds_end symbol marking the end of LDS
  memory
- rtld resolves any relocations

For a smooth upgrade with Mesa master and LLVM trunk, the plan to upstream
these changes is:

1. Land at least the first two patches of this series, which add rtld
   support for the new LDS symbols.
2. Land the LLVM changes for generating the symbols in the ELF
3. Land the remainder of this series (this should mostly be possible
   earlier, actually).

Please review!

Thanks,
Nicolai
--
 src/amd/common/ac_rtld.c                     | 210 +++++++++++++++--
 src/amd/common/ac_rtld.h                     |  39 ++-
 src/gallium/drivers/radeonsi/si_compute.c    |   9 +-
 src/gallium/drivers/radeonsi/si_debug.c      |  22 +-
 src/gallium/drivers/radeonsi/si_shader.c     | 210 +++++++++++------
 src/gallium/drivers/radeonsi/si_shader.h     |  26 +-
 src/gallium/drivers/radeonsi/si_state_draw.c |   5 +
 .../drivers/radeonsi/si_state_shaders.c      |  31 +--
 8 files changed, 431 insertions(+), 121 deletions(-)




More information about the mesa-dev mailing list