[PATCH] D130096: [Clang][AMDGPU] Emit AMDGPU library control constants in clang

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 09:00:17 PDT 2022


yaxunl added inline comments.


================
Comment at: clang/test/CodeGen/amdgcn-link-control-constants.c:2-3
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-globals --include-generated-funcs --global-value-regex "__oclc_daz_opt"
+// RUN: %clang_cc1 -x hip -triple amdgcn-amd-amdhsa -target-cpu gfx90a -emit-llvm-bc -o %t.bc -DLIBRARY %s
+// RUN: %clang_cc1 -x hip -triple amdgcn-amd-amdhsa -target-cpu gfx90a -mlink-builtin-bitcode %t.bc -S -emit-llvm -o - %s | FileCheck %s
+
----------------
JonChesterfield wrote:
> jhuber6 wrote:
> > jhuber6 wrote:
> > > yaxunl wrote:
> > > > This is compiling HIP as host. Please add -fcuda-is-device.
> > > This test should only require that the triple is `amdgcn`. I could potentially make the generation of the constants require HIP or OpenMPDevice, or OpenCL is enabled if you think that's bad.
> > I can also change it to just `-x c` if the HIP is the problem.
> We probably want these magic constants for C++ code as well, so keying it off the triple (at least triple + that we're using rocm / compute stuff, which I think is adequately indicated by hsa in the triple) is better. And likewise don't want to emit these constants for non-gpu code, e.g. x64 host hip doesn't need the daz_opt constant, which also suggests triple is the right hook.
We don't officially support C on amdgcn but we officially support HIP. I would suggest move this to CodeGenCUDA and compile it as HIP, and use HIP syntax.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130096/new/

https://reviews.llvm.org/D130096



More information about the cfe-commits mailing list