-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][libclc] Merge atomic extension built-ins with identical name into a single file #134489
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
frasercrmck
merged 6 commits into
llvm:main
from
wenju-he:libclc-merge-combine-atomic-extension-functions-into-single-file
Apr 14, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
310f537
[NFC][libclc] Merge atomic extension built-ins with identical name in…
wenju-he 0d1a5a6
guard cl_khr_int64_base_atomics in headers
wenju-he 3c3f065
merge global_int32/local_int32 macros
wenju-he 46d2df7
clang-format
wenju-he 36964ad
use #if to guard cl_khr_(local|global)_int32_(base|extended)_atomics
wenju-he de7d8b9
cl_khr_int64_base_atomics -> cl_khr_int64_extended_atomics, fix a cop…
wenju-he 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
#define __CLC_FUNCTION atom_add | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
#define __CLC_FUNCTION atom_add | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
#define __CLC_FUNCTION atom_add | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_base_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_and | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_extended_atomics | ||
|
||
#ifdef cl_khr_local_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_and | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_extended_atomics | ||
|
||
#ifdef cl_khr_int64_extended_atomics | ||
#define __CLC_FUNCTION atom_and | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_extended_atomics |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <clc/clcfunc.h> | ||
#include <clc/clctypes.h> | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile global int *p, int cmp, | ||
int val); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int | ||
atom_cmpxchg(volatile global unsigned int *p, unsigned int cmp, | ||
unsigned int val); | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile local int *p, int cmp, | ||
int val); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int | ||
atom_cmpxchg(volatile local unsigned int *p, unsigned int cmp, | ||
unsigned int val); | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp, | ||
long val); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long | ||
atom_cmpxchg(volatile global unsigned long *p, unsigned long cmp, | ||
unsigned long val); | ||
_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile local long *p, long cmp, | ||
long val); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long | ||
atom_cmpxchg(volatile local unsigned long *p, unsigned long cmp, | ||
unsigned long val); | ||
#endif // cl_khr_int64_base_atomics |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <clc/clcfunc.h> | ||
#include <clc/clctypes.h> | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile global int *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile global unsigned int *p); | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile local int *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile local unsigned int *p); | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile global long *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long | ||
atom_dec(volatile global unsigned long *p); | ||
_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile local long *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile local unsigned long *p); | ||
#endif // cl_khr_int64_base_atomics |
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
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <clc/clcfunc.h> | ||
#include <clc/clctypes.h> | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile global int *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile global unsigned int *p); | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile local int *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile local unsigned int *p); | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile global long *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long | ||
atom_inc(volatile global unsigned long *p); | ||
_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile local long *p); | ||
_CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile local unsigned long *p); | ||
#endif // cl_khr_int64_base_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_max | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_extended_atomics | ||
|
||
#ifdef cl_khr_local_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_max | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_extended_atomics | ||
|
||
#ifdef cl_khr_int64_extended_atomics | ||
#define __CLC_FUNCTION atom_max | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_extended_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_min | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_extended_atomics | ||
|
||
#ifdef cl_khr_local_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_min | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_extended_atomics | ||
|
||
#ifdef cl_khr_int64_extended_atomics | ||
#define __CLC_FUNCTION atom_min | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_extended_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_or | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_extended_atomics | ||
|
||
#ifdef cl_khr_local_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_or | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_extended_atomics | ||
|
||
#ifdef cl_khr_int64_extended_atomics | ||
#define __CLC_FUNCTION atom_or | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_extended_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
#define __CLC_FUNCTION atom_sub | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
#define __CLC_FUNCTION atom_sub | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
#define __CLC_FUNCTION atom_sub | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_base_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_base_atomics | ||
#define __CLC_FUNCTION atom_xchg | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_base_atomics | ||
|
||
#ifdef cl_khr_local_int32_base_atomics | ||
#define __CLC_FUNCTION atom_xchg | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_base_atomics | ||
|
||
#ifdef cl_khr_int64_base_atomics | ||
#define __CLC_FUNCTION atom_xchg | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_base_atomics |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifdef cl_khr_global_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_xor | ||
#define __CLC_ADDRESS_SPACE global | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_global_int32_extended_atomics | ||
|
||
#ifdef cl_khr_local_int32_extended_atomics | ||
#define __CLC_FUNCTION atom_xor | ||
#define __CLC_ADDRESS_SPACE local | ||
#include <clc/atomic/atom_decl_int32.inc> | ||
#endif // cl_khr_local_int32_extended_atomics | ||
|
||
#ifdef cl_khr_int64_extended_atomics | ||
#define __CLC_FUNCTION atom_xor | ||
#include <clc/atomic/atom_decl_int64.inc> | ||
#endif // cl_khr_int64_extended_atomics |
11 changes: 0 additions & 11 deletions
11
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
libclc/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h
This file was deleted.
Oops, something went wrong.
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.