[all-commits] [llvm/llvm-project] 171da4: [HIPSPV] Fix literals are mapped to Generic addres...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Sat Feb 5 17:10:31 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 171da443d598662371f4101f0ba92c0138011ff6
      https://github.com/llvm/llvm-project/commit/171da443d598662371f4101f0ba92c0138011ff6
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2022-02-05 (Sat, 05 Feb 2022)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGenHIP/hipspv-addr-spaces.cpp

  Log Message:
  -----------
  [HIPSPV] Fix literals are mapped to Generic address space

This issue is an oversight in D108621.

Literals in HIP are emitted as global constant variables with default
address space which maps to Generic address space for HIPSPV. In
SPIR-V such variables translate to OpVariable instructions with
Generic storage class which are not legal. Fix by mapping literals
to CrossWorkGroup address space.

The literals are not mapped to UniformConstant because the “flat”
pointers in HIP may reference them and “flat” pointers are modeled
as Generic pointers in SPIR-V. In SPIR-V/OpenCL UniformConstant
pointers may not be casted to Generic.

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu

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




More information about the All-commits mailing list