yxsamliu wrote:

One drawback of not defining `__AMDGCN_WAVEFRONT_SIZE__` in host compilation is 
the impairment of uniformity of source code across host and device sides. Users 
have to put `#if __HIP_DEVICE_COMPILE__` anywhere they use 
`__AMDGCN_WAVEFRONT_SIZE__`. Previous experience tells us that this causes bad 
user experience and clutters source code.

There are valid uses of `__AMDGCN_WAVEFRONT_SIZE__` seen in host compilation. 
Obviously they can be safely used in device functions or kernels. Even if they 
are used in file scope, as long as the resulted constants end up in device 
binary, they are safe to be 'seen' during host compilation. However, if we 
simply ban `__AMDGCN_WAVEFRONT_SIZE__` in host compilation, we are banning the 
valid uses of `__AMDGCN_WAVEFRONT_SIZE__` in the source code.

I think we need to balance between usability and safety. That is, we want to 
diagnose misuse of `__AMDGCN_WAVEFRONT_SIZE__` in host code without impairing 
too much on single-source-ness of HIP.

https://github.com/llvm/llvm-project/pull/109663
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to