-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[libclc] Refine __clc_fp*_subnormals_supported and __clc_flush_denormal_if_not_supported #157633
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
7e2d210
96ec9dc
d52fcdb
4608f77
3f665ce
7b290a2
3da9705
7d21a1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
|
|
||
| #include <clc/clc_as_type.h> | ||
| #include <clc/clcfunc.h> | ||
| #include <clc/math/clc_subnormal_config.h> | ||
|
|
||
| #define SNAN 0x001 | ||
| #define QNAN 0x002 | ||
|
|
@@ -24,15 +23,6 @@ | |
| #define PNOR 0x100 | ||
| #define PINF 0x200 | ||
|
|
||
| #if (defined __AMDGCN__ || defined __R600__) && !defined __HAS_FMAF__ | ||
| #define __CLC_HAVE_HW_FMA32() (0) | ||
| #elif defined(CLC_SPIRV) | ||
| bool __attribute__((noinline)) __clc_runtime_has_hw_fma32(void); | ||
| #define __CLC_HAVE_HW_FMA32() __clc_runtime_has_hw_fma32() | ||
| #else | ||
| #define __CLC_HAVE_HW_FMA32() (1) | ||
| #endif | ||
|
|
||
| #define HAVE_BITALIGN() (0) | ||
| #define HAVE_FAST_FMA32() (0) | ||
|
|
||
|
|
@@ -65,14 +55,12 @@ bool __attribute__((noinline)) __clc_runtime_has_hw_fma32(void); | |
|
|
||
| #define LOG_MAGIC_NUM_SP32 (1 + NUMEXPBITS_SP32 - EXPBIAS_SP32) | ||
|
|
||
| _CLC_OVERLOAD _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x) { | ||
| int ix = __clc_as_int(x); | ||
| if (!__clc_fp32_subnormals_supported() && ((ix & EXPBITS_SP32) == 0) && | ||
| ((ix & MANTBITS_SP32) != 0)) { | ||
| ix &= SIGNBIT_SP32; | ||
| x = __clc_as_float(ix); | ||
| } | ||
| return x; | ||
| _CLC_OVERLOAD _CLC_INLINE float __clc_soft_flush_denormal(float x) { | ||
| // Avoid calling __clc_fp32_subnormals_supported here: it uses | ||
|
Contributor
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. You might have less trouble just using canonicalize for now and trying to relax it later
Contributor
Author
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.
do you mean reverting __clc_soft_flush_denormal to use __clc_fp32_subnormals_supported which uses llvm.canonicalize, or just replacing use of __clc_fp32_subnormals_supported with __builtin_elementwise_canonicalize? |
||
| // llvm.canonicalize, which quiets sNaN. | ||
| return __builtin_elementwise_abs(x) < 0x1p-149f | ||
| ? __builtin_elementwise_copysign(0.0f, x) | ||
| : x; | ||
| } | ||
|
|
||
| #ifdef cl_khr_fp64 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| math/clc_sw_fma.cl | ||
| integer/clc_mul_hi.cl |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.