Skip to content

Commit c121bbb

Browse files
authored
[SYCL][LIBCLC] Add atan and cbrt for amdgcn-amdhsa (#4180)
Use AMD's `__ocml` functions to implement cbrt and atan spir-v builtins. Co-authored-by: Jakub Chlanda <[email protected]>
1 parent e825916 commit c121bbb

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

libclc/amdgcn-amdhsa/libspirv/SOURCES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ synchronization/barrier.cl
55
math/cos.cl
66
math/sin.cl
77
math/sqrt.cl
8+
math/atan.cl
9+
math/cbrt.cl
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <clcmacro.h>
10+
#include <spirv/spirv.h>
11+
12+
double __ocml_atan_f64(double);
13+
float __ocml_atan_f32(float);
14+
15+
#define __CLC_FUNCTION __spirv_ocl_atan
16+
#define __CLC_BUILTIN __ocml_atan
17+
#define __CLC_BUILTIN_F __CLC_XCONCAT(__CLC_BUILTIN, _f32)
18+
#define __CLC_BUILTIN_D __CLC_XCONCAT(__CLC_BUILTIN, _f64)
19+
#include <math/unary_builtin.inc>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <clcmacro.h>
10+
#include <spirv/spirv.h>
11+
12+
double __ocml_cbrt_f64(double);
13+
float __ocml_cbrt_f32(float);
14+
15+
#define __CLC_FUNCTION __spirv_ocl_cbrt
16+
#define __CLC_BUILTIN __ocml_cbrt
17+
#define __CLC_BUILTIN_F __CLC_XCONCAT(__CLC_BUILTIN, _f32)
18+
#define __CLC_BUILTIN_D __CLC_XCONCAT(__CLC_BUILTIN, _f64)
19+
#include <math/unary_builtin.inc>

0 commit comments

Comments
 (0)