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

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 09:41:43 PDT 2022


jhuber6 updated this revision to Diff 462948.
jhuber6 added a comment.

Adding an extra check in `CodeGenAction.cpp` that forcibly internalizes these if we link in any modules in RDC mode. This is a considerable hack, but should solve the problem. It's not a great solution, so let me know if you think that this is a leser evil than linking in many bitcode files as we do now.

To reiterate, what this patch offers is.
+ Reduces number of files needed to link in, (no on/off files, only `ocml.bc` and `ockl.bc` are needed).
+ Enforces that the architecture constants are the same across the compilation
And I think negatively,

- Requires a hack to internalize some variables to prevent linking problems
- Some extra code in Clang

The best solution would be to handle these per-TU variables in the backend. Or maybe even all of these could be placed in the backend where the code paths that currently require a control constant could be a simple attribute that the backend will use to control code emission.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130096

Files:
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h
  clang/test/CodeGen/amdgcn-control-constants.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130096.462948.patch
Type: text/x-patch
Size: 10986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220926/50c14e3f/attachment-0001.bin>


More information about the cfe-commits mailing list