Skip to content

Commit 28b8d61

Browse files
PawelJurekigcbot
authored andcommitted
bfloat support for SPV_INTEL_sigmoid
Current SPV_INTEL_sigmoid spec does not allow bfloat type, but it will be added as an update to SPV_INTEL_bfloat16_arithmetic spec. This commit prepares the implementation for this addition.
1 parent 1084303 commit 28b8d61

File tree

1 file changed

+11
-2
lines changed
  • IGC/BiFModule/Implementation/Math

1 file changed

+11
-2
lines changed

IGC/BiFModule/Implementation/Math/sigm.cl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,23 @@ GENERATE_SPIRV_OCL_VECTOR_FUNCTIONS_1ARG_LOOP( sigm, half, half, f16 )
4343
// SPV_INTEL_sigmoid extension
4444
float __attribute__((overloadable)) __spirv_FSigmoidINTEL( float x )
4545
{
46-
return __spirv_ocl_sigm( x );
46+
return __spirv_ocl_sigm(x);
4747
}
4848
SPIRV_GENERATE_VECTOR_FUNCTIONS_1ARG( FSigmoidINTEL, float, float, f32 )
4949

5050
#if defined(cl_khr_fp16)
5151
half __attribute__((overloadable)) __spirv_FSigmoidINTEL( half x )
5252
{
53-
return __spirv_ocl_sigm( x );
53+
return __spirv_ocl_sigm(x);
5454
}
5555
SPIRV_GENERATE_VECTOR_FUNCTIONS_1ARG( FSigmoidINTEL, half, half, f16 )
5656
#endif // defined(cl_khr_fp16)
57+
58+
// bfloat16 - short is used to represent bfloat16, it is changed later
59+
// in BfloatBuiltinsResolution to bfloat type.
60+
61+
short __attribute__((overloadable)) __spirv_FSigmoidINTEL( short x )
62+
{
63+
return __spirv_ocl_sigm(__builtin_IB_bftof_1(x));
64+
}
65+
SPIRV_GENERATE_VECTOR_FUNCTIONS_1ARG( FSigmoidINTEL, short, short, bf16 )

0 commit comments

Comments
 (0)