-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[clang][HIP] Make some math not not work with AMDGCN SPIR-V #128360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,12 @@ | |||||||||||||
#include "hip/hip_version.h" | ||||||||||||||
#endif // __has_include("hip/hip_version.h") | ||||||||||||||
|
||||||||||||||
#ifdef __SPIRV__ | ||||||||||||||
#define __PRIVATE_AS __attribute__((address_space(0))) | ||||||||||||||
#else | ||||||||||||||
#define __PRIVATE_AS __attribute__((address_space(5))) | ||||||||||||||
#endif | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
#ifdef __cplusplus | ||||||||||||||
extern "C" { | ||||||||||||||
#endif | ||||||||||||||
|
@@ -55,8 +61,7 @@ __device__ __attribute__((const)) float __ocml_fmax_f32(float, float); | |||||||||||||
__device__ __attribute__((const)) float __ocml_fmin_f32(float, float); | ||||||||||||||
__device__ __attribute__((const)) __device__ float __ocml_fmod_f32(float, | ||||||||||||||
float); | ||||||||||||||
__device__ float __ocml_frexp_f32(float, | ||||||||||||||
__attribute__((address_space(5))) int *); | ||||||||||||||
__device__ float __ocml_frexp_f32(float, __PRIVATE_AS int *); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_hypot_f32(float, float); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_ilogb_f32(float); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_isfinite_f32(float); | ||||||||||||||
|
@@ -74,8 +79,7 @@ __device__ __attribute__((pure)) float __ocml_native_log2_f32(float); | |||||||||||||
__device__ __attribute__((const)) float __ocml_logb_f32(float); | ||||||||||||||
__device__ __attribute__((pure)) float __ocml_log_f32(float); | ||||||||||||||
__device__ __attribute__((pure)) float __ocml_native_log_f32(float); | ||||||||||||||
__device__ float __ocml_modf_f32(float, | ||||||||||||||
__attribute__((address_space(5))) float *); | ||||||||||||||
__device__ float __ocml_modf_f32(float, __PRIVATE_AS float *); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_nearbyint_f32(float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_nextafter_f32(float, float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_len3_f32(float, float, float); | ||||||||||||||
|
@@ -87,8 +91,7 @@ __device__ __attribute__((pure)) float __ocml_pow_f32(float, float); | |||||||||||||
__device__ __attribute__((pure)) float __ocml_pown_f32(float, int); | ||||||||||||||
__device__ __attribute__((pure)) float __ocml_rcbrt_f32(float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_remainder_f32(float, float); | ||||||||||||||
__device__ float __ocml_remquo_f32(float, float, | ||||||||||||||
__attribute__((address_space(5))) int *); | ||||||||||||||
__device__ float __ocml_remquo_f32(float, float, __PRIVATE_AS int *); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_rhypot_f32(float, float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_rint_f32(float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_rlen3_f32(float, float, float); | ||||||||||||||
|
@@ -99,10 +102,8 @@ __device__ __attribute__((pure)) float __ocml_rsqrt_f32(float); | |||||||||||||
__device__ __attribute__((const)) float __ocml_scalb_f32(float, float); | ||||||||||||||
__device__ __attribute__((const)) float __ocml_scalbn_f32(float, int); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_signbit_f32(float); | ||||||||||||||
__device__ float __ocml_sincos_f32(float, | ||||||||||||||
__attribute__((address_space(5))) float *); | ||||||||||||||
__device__ float __ocml_sincospi_f32(float, | ||||||||||||||
__attribute__((address_space(5))) float *); | ||||||||||||||
__device__ float __ocml_sincos_f32(float, __PRIVATE_AS float *); | ||||||||||||||
__device__ float __ocml_sincospi_f32(float, __PRIVATE_AS float *); | ||||||||||||||
__device__ float __ocml_sin_f32(float); | ||||||||||||||
__device__ float __ocml_native_sin_f32(float); | ||||||||||||||
__device__ __attribute__((pure)) float __ocml_sinh_f32(float); | ||||||||||||||
|
@@ -176,8 +177,7 @@ __device__ __attribute__((const)) double __ocml_fma_f64(double, double, double); | |||||||||||||
__device__ __attribute__((const)) double __ocml_fmax_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_fmin_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_fmod_f64(double, double); | ||||||||||||||
__device__ double __ocml_frexp_f64(double, | ||||||||||||||
__attribute__((address_space(5))) int *); | ||||||||||||||
__device__ double __ocml_frexp_f64(double, __PRIVATE_AS int *); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_hypot_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_ilogb_f64(double); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_isfinite_f64(double); | ||||||||||||||
|
@@ -192,8 +192,7 @@ __device__ __attribute__((pure)) double __ocml_log1p_f64(double); | |||||||||||||
__device__ __attribute__((pure)) double __ocml_log2_f64(double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_logb_f64(double); | ||||||||||||||
__device__ __attribute__((pure)) double __ocml_log_f64(double); | ||||||||||||||
__device__ double __ocml_modf_f64(double, | ||||||||||||||
__attribute__((address_space(5))) double *); | ||||||||||||||
__device__ double __ocml_modf_f64(double, __PRIVATE_AS double *); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_nearbyint_f64(double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_nextafter_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_len3_f64(double, double, | ||||||||||||||
|
@@ -206,8 +205,7 @@ __device__ __attribute__((pure)) double __ocml_pow_f64(double, double); | |||||||||||||
__device__ __attribute__((pure)) double __ocml_pown_f64(double, int); | ||||||||||||||
__device__ __attribute__((pure)) double __ocml_rcbrt_f64(double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_remainder_f64(double, double); | ||||||||||||||
__device__ double __ocml_remquo_f64(double, double, | ||||||||||||||
__attribute__((address_space(5))) int *); | ||||||||||||||
__device__ double __ocml_remquo_f64(double, double, __PRIVATE_AS int *); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_rhypot_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_rint_f64(double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_rlen3_f64(double, double, | ||||||||||||||
|
@@ -219,10 +217,8 @@ __device__ __attribute__((pure)) double __ocml_rsqrt_f64(double); | |||||||||||||
__device__ __attribute__((const)) double __ocml_scalb_f64(double, double); | ||||||||||||||
__device__ __attribute__((const)) double __ocml_scalbn_f64(double, int); | ||||||||||||||
__device__ __attribute__((const)) int __ocml_signbit_f64(double); | ||||||||||||||
__device__ double __ocml_sincos_f64(double, | ||||||||||||||
__attribute__((address_space(5))) double *); | ||||||||||||||
__device__ double | ||||||||||||||
__ocml_sincospi_f64(double, __attribute__((address_space(5))) double *); | ||||||||||||||
__device__ double __ocml_sincos_f64(double, __PRIVATE_AS double *); | ||||||||||||||
__device__ double __ocml_sincospi_f64(double, __PRIVATE_AS double *); | ||||||||||||||
__device__ double __ocml_sin_f64(double); | ||||||||||||||
__device__ __attribute__((pure)) double __ocml_sinh_f64(double); | ||||||||||||||
__device__ double __ocml_sinpi_f64(double); | ||||||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never use numbered address spaces. Unconditionally use
__attribute__((opencl_private))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged, but the header was already using numbered address spaces (ROCDL is also using numbered rather than generic), and I really don't want to take on fixing the general badness living here/there. We shouldn't be using explicit ASes at all in what is supposed to be a generic interface, but that's a different kettle of fish. I'd like to keep this simple and land it, if possible, within the backport window as it's a hard break for us at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using opencl_private is the simpler fix. You are calling code declared and defined in OpenCL, with the private address. Without a specific example of why this does not work out of the box, I insist you just go straight to using it