[all-commits] [llvm/llvm-project] 01e23c: [HIPSTDPAR] Add support for globals (#146813)

Alex Voicu via All-commits all-commits at lists.llvm.org
Wed Jul 23 05:56:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 01e23c3d626c30000820465f029793e44e2062e4
      https://github.com/llvm/llvm-project/commit/01e23c3d626c30000820465f029793e44e2062e4
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2025-07-23 (Wed, 23 Jul 2025)

  Changed paths:
    M clang/docs/HIPSupport.rst
    M llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
    A llvm/test/Transforms/HipStdPar/global-var-indirection-wrong-table-member-0.ll
    A llvm/test/Transforms/HipStdPar/global-var-indirection-wrong-table-member-1.ll
    A llvm/test/Transforms/HipStdPar/global-var-indirection-wrong-table-member-2.ll
    A llvm/test/Transforms/HipStdPar/global-var-indirection-wrong-table-member-count.ll
    A llvm/test/Transforms/HipStdPar/global-var-indirection-wrong-table-type.ll
    A llvm/test/Transforms/HipStdPar/global-var-indirection.ll
    M llvm/test/Transforms/HipStdPar/global-var.ll

  Log Message:
  -----------
  [HIPSTDPAR] Add support for globals (#146813)

This (mostly) removes one of the largest remaining limitations of
`hipstdpar` based algorithm acceleration, by adding support for global
variable usage in offloaded algorithms. It is mean to compose with a run
time component that will live in the support library, and fires iff a
special variable is provided by the latter. In short, things work as
follows:

- We replace uses some global `G` with an indirect access via an
implicitly created anonymous global `F`, which is of pointer type and is
expected to hold the program-wide address of `G`;
- We append 'F', alongside 'G''s name, to an table structure;
- At run-time, the support library uses the table to look-up the
program-wide address of a contained symbol based on its name, and then
stores the address via the paired pointer.

This doesn't handle internal linkage symbols (`static foo` or `namespace
{ foo }`) if they are not unique i.e. if there's a name clash that is
solved by the linker, as the resolution would not be visible. Also,
initially we will only support "true" globals in RDC mode. Things would
be much simpler if we had direct access to the accelerator loader, but
since the expectation is to compose at the HIP RT level we have to jump
through additional hoops.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list