[clang] [Clang][HIP] Warn when __AMDGCN_WAVEFRONT_SIZE is used in host code without relying on target-dependent overload resolution (PR #109663)
Fabian Ritter via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 2 04:47:03 PDT 2024
ritter-x2a wrote:
@Artem-B thank you for the suggestion!
Do I understand correctly that it boils down to the following?
- If a (new) clang CLI option is set: enable PR #91478 - which, among other things, warns during host compilation whenever `__AMDGCN_WAVEFRONT_SIZE__` is used in template default arguments or template arguments outside of function bodies and global initializers,
- provide `__AMDGCN_WAVEFRONT_SIZE_IS_64_ON_THE_HOST__` as an unchecked and more clearly named alternative, and
- probably change the wording of the deprecation warning to also point to this new macro as an alternative to silence the warning.
We would then recommend to the users to use `__AMDGCN_WAVEFRONT_SIZE_IS_64_ON_THE_HOST__` instead of `__AMDGCN_WAVEFRONT_SIZE__` outside of function bodies and global initializers (and to make sure that that is the behavior they want).
My main concern with this is that I'm not sure if users are likely to manually turn on these extra checks, so that the less strict but always-on diagnostics produced by this PR might have a bigger impact in practice, at least until we change the default.
Also: With the host/device target selection outside of function bodies during the different compilation modes as it is, users would need quite deep knowledge about compiler internals to make sure that `__AMDGCN_WAVEFRONT_SIZE_IS_64_ON_THE_HOST__` is what they want (but, then, they also need that when using `__AMDGCN_WAVEFRONT_SIZE__` in these places right now, so it might be okay to require that).
https://github.com/llvm/llvm-project/pull/109663
More information about the cfe-commits
mailing list