Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_base_atomics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to go back to this but I think really these should all be #if guarded with the appropriate extension: cl_khr_(local|global)_int32_(base|extended)_atomics. It works now because only targets that should build the atomics builtins are including these headers, which isn't the worst thing but it might be good to fix this up since we're here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, you're right that they should be all guarded since they are extensions. Thanks.

#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_add
#include <clc/atomic/atom_decl_int64.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_and
#include <clc/atomic/atom_decl_int64.inc>
36 changes: 36 additions & 0 deletions libclc/generic/include/clc/atomic/atom_cmpxchg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//===----------------------------------------------------------------------===//
//
// 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>

// 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);

// 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);

// 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);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@
//
//===----------------------------------------------------------------------===//

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

// 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);

// 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);

// 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 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);
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//
//===----------------------------------------------------------------------===//

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);

__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int)
__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//
//===----------------------------------------------------------------------===//

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
#include <clc/clcfunc.h>
#include <clc/clctypes.h>

#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);

__CLC_DECLARE_ATOM(local, long)
__CLC_DECLARE_ATOM(local, ulong)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@
//
//===----------------------------------------------------------------------===//

#include <clc/clcfunc.h>
#include <clc/clctypes.h>

// 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);

// 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);

// 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 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);
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_max
#include <clc/atomic/atom_decl_int64.inc>
#undef __CLC_FUNCTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_min
#include <clc/atomic/atom_decl_int64.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_or
#include <clc/atomic/atom_decl_int64.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_sub
#include <clc/atomic/atom_decl_int64.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_base_atomics
#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_base_atomics
#define __CLC_FUNCTION atom_xchg
#include <clc/atomic/atom_decl_int64.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//
//===----------------------------------------------------------------------===//

// cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE global
#include <clc/atom_decl_int32.inc>
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_local_int32_extended_atomics
#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE local
#include <clc/atomic/atom_decl_int32.inc>

// cl_khr_int64_extended_atomics
#define __CLC_FUNCTION atom_xor
#include <clc/atomic/atom_decl_int64.inc>

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h

This file was deleted.

10 changes: 0 additions & 10 deletions libclc/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions libclc/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading