Skip to content

Commit dd89af7

Browse files
authored
[libclc] Move 'half' builtins to CLC library (#139563)
There are no changes to the generated bytecode.
1 parent 4f0be94 commit dd89af7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+648
-111
lines changed

libclc/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ include( GNUInstallDirs )
2020
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
2121
amdgcn-amdhsa/lib/SOURCES;
2222
amdgcn/lib/SOURCES;
23-
amdgpu/lib/SOURCES;
2423
clspv/lib/SOURCES;
2524
generic/lib/SOURCES;
2625
ptx-nvidiacl/lib/SOURCES;

libclc/amdgpu/lib/SOURCES

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_COS_H__
10+
#define __CLC_MATH_CLC_HALF_COS_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_cos
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_COS_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_DIVIDE_H__
10+
#define __CLC_MATH_CLC_HALF_DIVIDE_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_divide
14+
#define __CLC_BODY <clc/shared/binary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_DIVIDE_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_EXP_H__
10+
#define __CLC_MATH_CLC_HALF_EXP_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_exp
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_EXP_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_EXP10_H__
10+
#define __CLC_MATH_CLC_HALF_EXP10_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_exp10
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_EXP10_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_EXP2_H__
10+
#define __CLC_MATH_CLC_HALF_EXP2_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_exp2
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_EXP2_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_LOG_H__
10+
#define __CLC_MATH_CLC_HALF_LOG_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_log
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_LOG_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_LOG10_H__
10+
#define __CLC_MATH_CLC_HALF_LOG10_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_log10
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_LOG10_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_LOG2_H__
10+
#define __CLC_MATH_CLC_HALF_LOG2_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_log2
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_LOG2_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_POWR_H__
10+
#define __CLC_MATH_CLC_HALF_POWR_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_powr
14+
#define __CLC_BODY <clc/shared/binary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_POWR_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_RECIP_H__
10+
#define __CLC_MATH_CLC_HALF_RECIP_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_recip
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_RECIP_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_RSQRT_H__
10+
#define __CLC_MATH_CLC_HALF_RSQRT_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_rsqrt
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_RSQRT_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_SIN_H__
10+
#define __CLC_MATH_CLC_HALF_SIN_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_sin
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_SIN_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_SQRT_H__
10+
#define __CLC_MATH_CLC_HALF_SQRT_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_sqrt
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_SQRT_H__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#ifndef __CLC_MATH_CLC_HALF_TAN_H__
10+
#define __CLC_MATH_CLC_HALF_TAN_H__
11+
12+
#define __FLOAT_ONLY
13+
#define __CLC_FUNCTION __clc_half_tan
14+
#define __CLC_BODY <clc/shared/unary_decl.inc>
15+
16+
#include <clc/math/gentype.inc>
17+
18+
#undef __CLC_FUNCTION
19+
#undef __FLOAT_ONLY
20+
21+
#endif // __CLC_MATH_CLC_HALF_TAN_H__

libclc/clc/lib/amdgpu/SOURCES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
math/clc_half_exp10.cl
2+
math/clc_half_exp2.cl
3+
math/clc_half_exp.cl
4+
math/clc_half_log10.cl
5+
math/clc_half_log2.cl
6+
math/clc_half_log.cl
7+
math/clc_half_recip.cl
8+
math/clc_half_rsqrt.cl
9+
math/clc_half_sqrt.cl
110
math/clc_native_exp2.cl
211
math/clc_native_exp.cl
312
math/clc_native_log10.cl

libclc/amdgpu/lib/math/half_exp.cl renamed to libclc/clc/lib/amdgpu/math/clc_half_exp.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <clc/clc.h>
10-
9+
#include <clc/math/clc_native_exp.h>
10+
1111
#define __CLC_FUNC exp
1212
#define __FLOAT_ONLY
13-
#define __CLC_BODY <half_native_unary.inc>
13+
#define __CLC_BODY <clc_half_native_unary.inc>
1414
#include <clc/math/gentype.inc>

libclc/amdgpu/lib/math/half_exp10.cl renamed to libclc/clc/lib/amdgpu/math/clc_half_exp10.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <clc/clc.h>
10-
9+
#include <clc/math/clc_native_exp10.h>
10+
1111
#define __CLC_FUNC exp10
1212
#define __FLOAT_ONLY
13-
#define __CLC_BODY <half_native_unary.inc>
13+
#define __CLC_BODY <clc_half_native_unary.inc>
1414
#include <clc/math/gentype.inc>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 <clc/internal/clc.h>
10+
#include <clc/math/clc_native_exp2.h>
11+
12+
#define __CLC_FUNC exp2
13+
#define __FLOAT_ONLY
14+
#define __CLC_BODY <clc_half_native_unary.inc>
15+
#include <clc/math/gentype.inc>

libclc/amdgpu/lib/math/half_log.cl renamed to libclc/clc/lib/amdgpu/math/clc_half_log.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <clc/clc.h>
10-
9+
#include <clc/math/clc_native_log.h>
10+
1111
#define __CLC_FUNC log
1212
#define __FLOAT_ONLY
13-
#define __CLC_BODY <half_native_unary.inc>
13+
#define __CLC_BODY <clc_half_native_unary.inc>
1414
#include <clc/math/gentype.inc>

0 commit comments

Comments
 (0)