[PATCH] D85223: [CUDA][HIP] Support accessing static device variable in host code for -fgpu-rdc

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 08:55:06 PST 2020


JonChesterfield added reviewers: jdoerfert, hfinkel.
JonChesterfield added a comment.
Herald added a subscriber: dexonsmith.

I concede that making the variables external, and trying to give them unique names, does work around static variables not working. I believe static variables are subjected to more aggressive optimisation than external ones but the effect might not be significant.

This "works" in cuda today because the loader ignores the local annotation when accessing the variable. There is some probably unintended behaviour when multiple static variables have the same name in that the first one wins.

The corresponding change to the hsa loader is trivial. Why is making the symbols external, with the associated complexity in picking non-conflicting names, considered better than changing the loader?


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

https://reviews.llvm.org/D85223



More information about the cfe-commits mailing list