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

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Mon Feb 7 07:33:01 PST 2022

  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 02d5b112138e7e9f30dec685afb380c1b9593a84
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2022-02-07 (Mon, 07 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