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
3 changes: 0 additions & 3 deletions libclc/opencl/include/clc/opencl/atomic/atom_decl_int32.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
//
//===----------------------------------------------------------------------===//

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

Expand Down
3 changes: 0 additions & 3 deletions libclc/opencl/include/clc/opencl/atomic/atom_decl_int64.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
//
//===----------------------------------------------------------------------===//

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

Expand Down
1 change: 0 additions & 1 deletion libclc/opencl/lib/amdgcn/SOURCES
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cl_khr_int64_extended_atomics/minmax_helpers.ll
mem_fence/fence.cl
synchronization/barrier.cl
workitem/get_global_offset.cl
Expand Down

This file was deleted.

29 changes: 16 additions & 13 deletions libclc/opencl/lib/generic/atomic/atom_add.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,35 @@
//
//===----------------------------------------------------------------------===//

#include <clc/atomic/clc_atomic_fetch_add.h>
#include <clc/opencl/atomic/atom_add.h>
#include <clc/opencl/atomic/atomic_add.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \
return __clc_atomic_fetch_add(p, val, __ATOMIC_RELAXED, \
__MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(AS TYPE *p, TYPE val) { \
return atom_add((volatile AS TYPE *)p, val); \
}

#ifdef cl_khr_global_int32_base_atomics
#define __CLC_ATOMIC_OP add
#define __CLC_ATOMIC_ADDRESS_SPACE global
#include "atom_int32_binary.inc"
__CLC_IMPL(global, int)
__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_base_atomics

#ifdef cl_khr_local_int32_base_atomics
#define __CLC_ATOMIC_OP add
#define __CLC_ATOMIC_ADDRESS_SPACE local
#include "atom_int32_binary.inc"
__CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics

#ifdef cl_khr_int64_base_atomics

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_add_8(p, val); \
}

__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)
#undef __CLC_IMPL

#endif // cl_khr_int64_base_atomics
29 changes: 16 additions & 13 deletions libclc/opencl/lib/generic/atomic/atom_and.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,35 @@
//
//===----------------------------------------------------------------------===//

#include <clc/atomic/clc_atomic_fetch_and.h>
#include <clc/opencl/atomic/atom_and.h>
#include <clc/opencl/atomic/atomic_and.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \
return __clc_atomic_fetch_and(p, val, __ATOMIC_RELAXED, \
__MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(AS TYPE *p, TYPE val) { \
return atom_and((volatile AS TYPE *)p, val); \
}

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_ATOMIC_OP and
#define __CLC_ATOMIC_ADDRESS_SPACE global
#include "atom_int32_binary.inc"
__CLC_IMPL(global, int)
__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_ATOMIC_OP and
#define __CLC_ATOMIC_ADDRESS_SPACE local
#include "atom_int32_binary.inc"
__CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_and_8(p, val); \
}

__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)
#undef __CLC_IMPL

#endif // cl_khr_int64_extended_atomics
20 changes: 9 additions & 11 deletions libclc/opencl/lib/generic/atomic/atom_cmpxchg.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
//
//===----------------------------------------------------------------------===//

#include <clc/atomic/clc_atomic_compare_exchange.h>
#include <clc/opencl/atomic/atom_cmpxchg.h>
#include <clc/opencl/atomic/atomic_cmpxchg.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \
TYPE val) { \
return atomic_cmpxchg(p, cmp, val); \
return __clc_atomic_compare_exchange(p, cmp, val, __ATOMIC_RELAXED, \
__ATOMIC_RELAXED, \
__MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(AS TYPE *p, TYPE cmp, TYPE val) { \
return atom_cmpxchg((volatile AS TYPE *)p, cmp, val); \
}

#ifdef cl_khr_global_int32_base_atomics
Expand All @@ -24,20 +31,11 @@ __CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics

#undef __CLC_IMPL

#ifdef cl_khr_int64_base_atomics

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \
TYPE val) { \
return __sync_val_compare_and_swap_8(p, cmp, val); \
}

__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)
#undef __CLC_IMPL

#endif // cl_khr_int64_base_atomics
18 changes: 7 additions & 11 deletions libclc/opencl/lib/generic/atomic/atom_dec.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
//
//===----------------------------------------------------------------------===//

#include <clc/atomic/clc_atomic_dec.h>
#include <clc/opencl/atomic/atom_dec.h>
#include <clc/opencl/atomic/atom_sub.h>
#include <clc/opencl/atomic/atomic_dec.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \
return atomic_dec(p); \
return __clc_atomic_dec(p, __ATOMIC_RELAXED, __MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(AS TYPE *p) { \
return atom_dec((volatile AS TYPE *)p); \
}

#ifdef cl_khr_global_int32_base_atomics
Expand All @@ -24,19 +28,11 @@ __CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics

#undef __CLC_IMPL

#ifdef cl_khr_int64_base_atomics

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \
return atom_sub(p, (TYPE)1); \
}

__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)
#undef __CLC_IMPL

#endif // cl_khr_int64_base_atomics
18 changes: 7 additions & 11 deletions libclc/opencl/lib/generic/atomic/atom_inc.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
//
//===----------------------------------------------------------------------===//

#include <clc/opencl/atomic/atom_add.h>
#include <clc/atomic/clc_atomic_inc.h>
#include <clc/opencl/atomic/atom_inc.h>
#include <clc/opencl/atomic/atomic_inc.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \
return atomic_inc(p); \
return __clc_atomic_inc(p, __ATOMIC_RELAXED, __MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(AS TYPE *p) { \
return atom_inc((volatile AS TYPE *)p); \
}

#ifdef cl_khr_global_int32_base_atomics
Expand All @@ -24,19 +28,11 @@ __CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics

#undef __CLC_IMPL

#ifdef cl_khr_int64_base_atomics

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \
return atom_add(p, (TYPE)1); \
}

__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)
#undef __CLC_IMPL

#endif // cl_khr_int64_base_atomics
45 changes: 20 additions & 25 deletions libclc/opencl/lib/generic/atomic/atom_max.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,35 @@
//
//===----------------------------------------------------------------------===//

#include <clc/atomic/clc_atomic_fetch_max.h>
#include <clc/opencl/atomic/atom_max.h>
#include <clc/opencl/atomic/atomic_max.h>

// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Corrected grammar: 'overloads is' should be 'overload is' (or 'overloads are' for plural).

Suggested change
// Non-volatile overloads is for backward compatibility with OpenCL 1.0.
// Non-volatile overloads are for backward compatibility with OpenCL 1.0.

Copilot uses AI. Check for mistakes.

#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \
return __clc_atomic_fetch_max(p, val, __ATOMIC_RELAXED, \
__MEMORY_SCOPE_DEVICE); \
} \
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(AS TYPE *p, TYPE val) { \
return atom_max((volatile AS TYPE *)p, val); \
}

#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_ATOMIC_OP max
#define __CLC_ATOMIC_ADDRESS_SPACE global
#include "atom_int32_binary.inc"
__CLC_IMPL(global, int)
__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_extended_atomics

#ifdef cl_khr_local_int32_extended_atomics
#define __CLC_ATOMIC_OP max
#define __CLC_ATOMIC_ADDRESS_SPACE local
#include "atom_int32_binary.inc"
__CLC_IMPL(local, int)
__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_extended_atomics

#ifdef cl_khr_int64_extended_atomics

unsigned long __clc__sync_fetch_and_max_local_8(volatile local long *, long);
unsigned long __clc__sync_fetch_and_max_global_8(volatile global long *, long);
unsigned long __clc__sync_fetch_and_umax_local_8(volatile local unsigned long *,
unsigned long);
unsigned long
__clc__sync_fetch_and_umax_global_8(volatile global unsigned long *,
unsigned long);

#define __CLC_IMPL(AS, TYPE, OP) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \
return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \
}

__CLC_IMPL(global, long, max)
__CLC_IMPL(global, unsigned long, umax)
__CLC_IMPL(local, long, max)
__CLC_IMPL(local, unsigned long, umax)
#undef __CLC_IMPL
__CLC_IMPL(global, long)
__CLC_IMPL(global, unsigned long)
__CLC_IMPL(local, long)
__CLC_IMPL(local, unsigned long)

#endif // cl_khr_int64_extended_atomics
Loading
Loading