[libclc] Reorganize OpenCL builtins (#140557)

This commits moves all OpenCL builtins under a top-level 'opencl'
directory, akin to how the CLC builtins are organized. This new
structure aims to better convey the separation of the two layers and
that 'CLC' is not a subset of OpenCL or a libclc target.

In doing so this commit moves the location of the 'lib' directory to
match CLC: libclc/generic/lib/ becomes libclc/opencl/lib/generic/. This
allows us to remove some special casing in CMake and ensure a common
directory structure.

It also tries to better communicate that the OpenCL headers are
libclc-specific OpenCL headers and should not be confused with or used
as standard OpenCL headers. It does so by ensuring includes are of the
form <clc/opencl/*>. It might be that we don't specifically need the
libclc OpenCL headers and we simply could use clang's built-in
declarations, but we can revisit that later.

Aside from the code move, there is some code formatting and updating a
couple of OpenCL builtin includes to use the readily available gentype
helpers. This allows us to remove some '.inc' files.
This commit is contained in:
Fraser Cormack
2025-05-20 09:51:30 +01:00
committed by GitHub
parent 80816e7923
commit 32cf55aef3
488 changed files with 1142 additions and 1188 deletions

View File

@@ -18,13 +18,14 @@ include( AddLibclc )
include( GNUInstallDirs )
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
amdgcn-amdhsa/lib/SOURCES;
amdgcn/lib/SOURCES;
clspv/lib/SOURCES;
generic/lib/SOURCES;
ptx-nvidiacl/lib/SOURCES;
r600/lib/SOURCES;
spirv/lib/SOURCES;
# OpenCL libraries
opencl/lib/amdgcn-amdhsa/SOURCES;
opencl/lib/amdgcn/SOURCES;
opencl/lib/clspv/SOURCES;
opencl/lib/generic/SOURCES;
opencl/lib/ptx-nvidiacl/SOURCES;
opencl/lib/r600/SOURCES;
opencl/lib/spirv/SOURCES;
# CLC internal libraries
clc/lib/generic/SOURCES;
clc/lib/amdgcn/SOURCES;
@@ -227,7 +228,7 @@ if( ENABLE_RUNTIME_SUBNORMAL )
foreach( file IN ITEMS subnormal_use_default subnormal_disable )
link_bc(
TARGET ${file}
INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/${file}.ll
INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/${file}.ll
)
install(
FILES $<TARGET_PROPERTY:${file},TARGET_FILE>
@@ -237,7 +238,7 @@ if( ENABLE_RUNTIME_SUBNORMAL )
endif()
find_package( Python3 REQUIRED COMPONENTS Interpreter )
file( TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/gen_convert.py script_loc )
file( TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/utils/gen_convert.py script_loc )
add_custom_command(
OUTPUT convert.cl
COMMAND ${Python3_EXECUTABLE} ${script_loc} > convert.cl
@@ -283,20 +284,20 @@ set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_log10.cl
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/r600/math/clc_native_rsqrt.cl
# OpenCL builtins
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_cos.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_divide.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_exp.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_exp10.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_exp2.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_log.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_log10.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_log2.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_powr.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_recip.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_rsqrt.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_sin.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_sqrt.cl
${CMAKE_CURRENT_SOURCE_DIR}/generic/lib/math/native_tan.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_cos.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_divide.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp10.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp2.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log10.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log2.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_powr.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_recip.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_rsqrt.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sin.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sqrt.cl
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_tan.cl
PROPERTIES COMPILE_OPTIONS -fapprox-func
)
@@ -351,7 +352,6 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
libclc_configure_lib_source(
clc_lib_files
CLC_INTERNAL
LIB_ROOT_DIR clc
DIRS ${clc_dirs}
)
@@ -365,13 +365,14 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
else()
list( APPEND opencl_gen_files convert.cl )
if ( NOT ENABLE_RUNTIME_SUBNORMAL )
list( APPEND opencl_lib_files generic/lib/subnormal_use_default.ll )
list( APPEND opencl_lib_files opencl/lib/generic/subnormal_use_default.ll )
endif()
endif()
endif()
libclc_configure_lib_source(
opencl_lib_files
LIB_ROOT_DIR opencl
DIRS ${opencl_dirs}
)
@@ -439,7 +440,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
)
list( APPEND build_flags
-I${CMAKE_CURRENT_SOURCE_DIR}/generic/include
-I${CMAKE_CURRENT_SOURCE_DIR}/opencl/include
)
add_libclc_builtin_set(

View File

@@ -1,73 +0,0 @@
math/fma.cl
shared/vstore_half.cl
subnormal_config.cl
../../generic/lib/geometric/distance.cl
../../generic/lib/geometric/length.cl
../../generic/lib/math/acos.cl
../../generic/lib/math/acosh.cl
../../generic/lib/math/asinh.cl
../../generic/lib/math/acospi.cl
../../generic/lib/math/asin.cl
../../generic/lib/math/atan.cl
../../generic/lib/math/asinh.cl
../../generic/lib/math/asinpi.cl
../../generic/lib/math/atan2.cl
../../generic/lib/math/atan2pi.cl
../../generic/lib/math/atanh.cl
../../generic/lib/math/atanpi.cl
../../generic/lib/math/cbrt.cl
../../generic/lib/math/cos.cl
../../generic/lib/math/cosh.cl
../../generic/lib/math/cospi.cl
../../generic/lib/math/erf.cl
../../generic/lib/math/erfc.cl
../../generic/lib/math/exp.cl
../../generic/lib/math/exp10.cl
../../generic/lib/math/exp2.cl
../../generic/lib/math/expm1.cl
../../generic/lib/math/fdim.cl
../../generic/lib/math/fmod.cl
../../generic/lib/math/fract.cl
../../generic/lib/math/frexp.cl
../../generic/lib/math/half_cos.cl
../../generic/lib/math/half_divide.cl
../../generic/lib/math/half_exp.cl
../../generic/lib/math/half_exp10.cl
../../generic/lib/math/half_exp2.cl
../../generic/lib/math/half_log.cl
../../generic/lib/math/half_log10.cl
../../generic/lib/math/half_log2.cl
../../generic/lib/math/half_powr.cl
../../generic/lib/math/half_recip.cl
../../generic/lib/math/half_sin.cl
../../generic/lib/math/half_sqrt.cl
../../generic/lib/math/half_tan.cl
../../generic/lib/math/hypot.cl
../../generic/lib/math/ilogb.cl
../../generic/lib/math/ldexp.cl
../../generic/lib/math/lgamma.cl
../../generic/lib/math/lgamma_r.cl
../../generic/lib/math/log.cl
../../generic/lib/math/log10.cl
../../generic/lib/math/log1p.cl
../../generic/lib/math/log2.cl
../../generic/lib/math/logb.cl
../../generic/lib/math/maxmag.cl
../../generic/lib/math/minmag.cl
../../generic/lib/math/modf.cl
../../generic/lib/math/nan.cl
../../generic/lib/math/nextafter.cl
../../generic/lib/math/pow.cl
../../generic/lib/math/pown.cl
../../generic/lib/math/powr.cl
../../generic/lib/math/remainder.cl
../../generic/lib/math/remquo.cl
../../generic/lib/math/rootn.cl
../../generic/lib/math/sin.cl
../../generic/lib/math/sincos.cl
../../generic/lib/math/sinh.cl
../../generic/lib/math/sinpi.cl
../../generic/lib/math/tan.cl
../../generic/lib/math/tanh.cl
../../generic/lib/math/tanpi.cl
../../generic/lib/math/tgamma.cl

View File

@@ -424,9 +424,6 @@ endfunction(add_libclc_builtin_set)
# LIB_FILE_LIST may be pre-populated and is appended to.
#
# Arguments:
# * CLC_INTERNAL
# Pass if compiling the internal CLC builtin libraries, which have a
# different directory structure.
# * LIB_ROOT_DIR <string>
# Root directory containing target's lib files, relative to libclc root
# directory. If not provided, is set to '.'.
@@ -436,7 +433,7 @@ endfunction(add_libclc_builtin_set)
# subsequent ones.
function(libclc_configure_lib_source LIB_FILE_LIST)
cmake_parse_arguments(ARG
"CLC_INTERNAL"
""
"LIB_ROOT_DIR"
"DIRS"
${ARGN}
@@ -450,11 +447,7 @@ function(libclc_configure_lib_source LIB_FILE_LIST)
set( source_list )
foreach( l IN LISTS ARG_DIRS )
foreach( s "SOURCES" "SOURCES_${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}" )
if( ARG_CLC_INTERNAL )
file( TO_CMAKE_PATH ${ARG_LIB_ROOT_DIR}/lib/${l}/${s} file_loc )
else()
file( TO_CMAKE_PATH ${ARG_LIB_ROOT_DIR}/${l}/lib/${s} file_loc )
endif()
file( TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file_loc} loc )
# Prepend the location to give higher priority to the specialized
# implementation

View File

@@ -1,12 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL int atomic_dec (volatile local int *);
_CLC_OVERLOAD _CLC_DECL int atomic_dec (volatile global int *);
_CLC_OVERLOAD _CLC_DECL uint atomic_dec (volatile local uint *);
_CLC_OVERLOAD _CLC_DECL uint atomic_dec (volatile global uint *);

View File

@@ -1,12 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL int atomic_inc (volatile local int *);
_CLC_OVERLOAD _CLC_DECL int atomic_inc (volatile global int *);
_CLC_OVERLOAD _CLC_DECL uint atomic_inc (volatile local uint *);
_CLC_OVERLOAD _CLC_DECL uint atomic_inc (volatile global uint *);

View File

@@ -1,267 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef __CLC_CLC_H__
#define __CLC_CLC_H__
#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
#endif
/* Function Attributes */
#include <clc/clcfunc.h>
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>
/* 6.2.3 Explicit Conversions */
#include <clc/convert.h>
/* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */
#include <clc/as_type.h>
/* 6.11.1 Work-Item Functions */
#include <clc/workitem/get_global_size.h>
#include <clc/workitem/get_global_id.h>
#include <clc/workitem/get_local_size.h>
#include <clc/workitem/get_local_id.h>
#include <clc/workitem/get_num_groups.h>
#include <clc/workitem/get_group_id.h>
#include <clc/workitem/get_global_offset.h>
#include <clc/workitem/get_work_dim.h>
/* 6.11.2 Math Functions */
#include <clc/math/acos.h>
#include <clc/math/acosh.h>
#include <clc/math/acospi.h>
#include <clc/math/asin.h>
#include <clc/math/asinh.h>
#include <clc/math/asinpi.h>
#include <clc/math/atan.h>
#include <clc/math/atan2.h>
#include <clc/math/atan2pi.h>
#include <clc/math/atanh.h>
#include <clc/math/atanpi.h>
#include <clc/math/cbrt.h>
#include <clc/math/copysign.h>
#include <clc/math/cos.h>
#include <clc/math/cosh.h>
#include <clc/math/cospi.h>
#include <clc/math/ceil.h>
#include <clc/math/erf.h>
#include <clc/math/erfc.h>
#include <clc/math/exp.h>
#include <clc/math/expm1.h>
#include <clc/math/exp10.h>
#include <clc/math/exp2.h>
#include <clc/math/fabs.h>
#include <clc/math/fdim.h>
#include <clc/math/floor.h>
#include <clc/math/fma.h>
#include <clc/math/fmax.h>
#include <clc/math/fmin.h>
#include <clc/math/fmod.h>
#include <clc/math/fract.h>
#include <clc/math/frexp.h>
#include <clc/math/half_cos.h>
#include <clc/math/half_divide.h>
#include <clc/math/half_exp.h>
#include <clc/math/half_exp10.h>
#include <clc/math/half_exp2.h>
#include <clc/math/half_log.h>
#include <clc/math/half_log10.h>
#include <clc/math/half_log2.h>
#include <clc/math/half_powr.h>
#include <clc/math/half_recip.h>
#include <clc/math/half_rsqrt.h>
#include <clc/math/half_sin.h>
#include <clc/math/half_sqrt.h>
#include <clc/math/half_tan.h>
#include <clc/math/hypot.h>
#include <clc/math/ilogb.h>
#include <clc/math/ldexp.h>
#include <clc/math/lgamma.h>
#include <clc/math/lgamma_r.h>
#include <clc/math/log.h>
#include <clc/math/log10.h>
#include <clc/math/log1p.h>
#include <clc/math/log2.h>
#include <clc/math/logb.h>
#include <clc/math/mad.h>
#include <clc/math/maxmag.h>
#include <clc/math/minmag.h>
#include <clc/math/modf.h>
#include <clc/math/nan.h>
#include <clc/math/nextafter.h>
#include <clc/math/pow.h>
#include <clc/math/pown.h>
#include <clc/math/powr.h>
#include <clc/math/remainder.h>
#include <clc/math/remquo.h>
#include <clc/math/rint.h>
#include <clc/math/rootn.h>
#include <clc/math/round.h>
#include <clc/math/sin.h>
#include <clc/math/sincos.h>
#include <clc/math/sinh.h>
#include <clc/math/sinpi.h>
#include <clc/math/sqrt.h>
#include <clc/math/tan.h>
#include <clc/math/tanh.h>
#include <clc/math/tanpi.h>
#include <clc/math/tgamma.h>
#include <clc/math/trunc.h>
#include <clc/math/native_cos.h>
#include <clc/math/native_divide.h>
#include <clc/math/native_exp.h>
#include <clc/math/native_exp10.h>
#include <clc/math/native_exp2.h>
#include <clc/math/native_log.h>
#include <clc/math/native_log10.h>
#include <clc/math/native_log2.h>
#include <clc/math/native_powr.h>
#include <clc/math/native_recip.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
#include <clc/math/native_rsqrt.h>
#include <clc/math/native_tan.h>
#include <clc/math/rsqrt.h>
/* 6.11.2.1 Floating-point macros */
#include <clc/float/definitions.h>
/* 6.11.3 Integer Functions */
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
#include <clc/integer/clz.h>
#include <clc/integer/ctz.h>
#include <clc/integer/hadd.h>
#include <clc/integer/mad24.h>
#include <clc/integer/mad_hi.h>
#include <clc/integer/mad_sat.h>
#include <clc/integer/mul24.h>
#include <clc/integer/mul_hi.h>
#include <clc/integer/popcount.h>
#include <clc/integer/rhadd.h>
#include <clc/integer/rotate.h>
#include <clc/integer/sub_sat.h>
#include <clc/integer/upsample.h>
/* 6.11.3 Integer Definitions */
#include <clc/integer/definitions.h>
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
#include <clc/shared/clamp.h>
#include <clc/shared/max.h>
#include <clc/shared/min.h>
#include <clc/shared/vload.h>
#include <clc/shared/vstore.h>
/* 6.11.4 Common Functions */
#include <clc/common/degrees.h>
#include <clc/common/radians.h>
#include <clc/common/mix.h>
#include <clc/common/sign.h>
#include <clc/common/smoothstep.h>
#include <clc/common/step.h>
/* 6.11.5 Geometric Functions */
#include <clc/geometric/cross.h>
#include <clc/geometric/distance.h>
#include <clc/geometric/dot.h>
#include <clc/geometric/fast_distance.h>
#include <clc/geometric/fast_length.h>
#include <clc/geometric/fast_normalize.h>
#include <clc/geometric/length.h>
#include <clc/geometric/normalize.h>
/* 6.11.6 Relational Functions */
#include <clc/relational/all.h>
#include <clc/relational/any.h>
#include <clc/relational/bitselect.h>
#include <clc/relational/isequal.h>
#include <clc/relational/isfinite.h>
#include <clc/relational/isgreater.h>
#include <clc/relational/isgreaterequal.h>
#include <clc/relational/isinf.h>
#include <clc/relational/isless.h>
#include <clc/relational/islessequal.h>
#include <clc/relational/islessgreater.h>
#include <clc/relational/isnan.h>
#include <clc/relational/isnormal.h>
#include <clc/relational/isnotequal.h>
#include <clc/relational/isordered.h>
#include <clc/relational/isunordered.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>
/* 6.11.8 Synchronization Functions */
#include <clc/synchronization/cl_mem_fence_flags.h>
#include <clc/synchronization/barrier.h>
/* 6.11.9 Explicit Memory Fence Functions */
#include <clc/explicit_fence/explicit_memory_fence.h>
/* 6.11.10 Async Copy and Prefetch Functions */
#include <clc/async/async_work_group_copy.h>
#include <clc/async/async_work_group_strided_copy.h>
#include <clc/async/prefetch.h>
#include <clc/async/wait_group_events.h>
/* 6.11.11 Atomic Functions */
#include <clc/atomic/atomic_add.h>
#include <clc/atomic/atomic_and.h>
#include <clc/atomic/atomic_cmpxchg.h>
#include <clc/atomic/atomic_dec.h>
#include <clc/atomic/atomic_inc.h>
#include <clc/atomic/atomic_max.h>
#include <clc/atomic/atomic_min.h>
#include <clc/atomic/atomic_or.h>
#include <clc/atomic/atomic_sub.h>
#include <clc/atomic/atomic_xchg.h>
#include <clc/atomic/atomic_xor.h>
/* cl_khr_global_int32_base_atomics, cl_khr_local_int32_base_atomics and
* cl_khr_int64_base_atomics Extension Functions */
#include <clc/atomic/atom_add.h>
#include <clc/atomic/atom_cmpxchg.h>
#include <clc/atomic/atom_dec.h>
#include <clc/atomic/atom_inc.h>
#include <clc/atomic/atom_sub.h>
#include <clc/atomic/atom_xchg.h>
/* cl_khr_global_int32_extended_atomics, cl_khr_local_int32_extended_atomics and
* cl_khr_int64_extended_atomics Extension Functions */
#include <clc/atomic/atom_and.h>
#include <clc/atomic/atom_max.h>
#include <clc/atomic/atom_min.h>
#include <clc/atomic/atom_or.h>
#include <clc/atomic/atom_xor.h>
/* 6.12.12 Miscellaneous Vector Functions */
#include <clc/misc/shuffle.h>
#include <clc/misc/shuffle2.h>
/* 6.11.13 Image Read and Write Functions */
#include <clc/image/image_defines.h>
#include <clc/image/image.h>
#pragma OPENCL EXTENSION all : disable
#endif // __CLC_CLC_H__

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE degrees(__CLC_GENTYPE x);

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE radians(__CLC_GENTYPE x);

View File

@@ -1,48 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#if defined(__opencl_c_images)
_CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_height (image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_height (image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_depth (image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image3d_t image);
_CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image);
_CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image);
_CLC_OVERLOAD _CLC_DECL void
write_imagef(image2d_t image, int2 coord, float4 color);
_CLC_OVERLOAD _CLC_DECL void
write_imagei(image2d_t image, int2 coord, int4 color);
_CLC_OVERLOAD _CLC_DECL void
write_imageui(image2d_t image, int2 coord, uint4 color);
_CLC_OVERLOAD _CLC_DECL float4
read_imagef(image2d_t image, sampler_t sampler, int2 coord);
_CLC_OVERLOAD _CLC_DECL float4
read_imagef(image2d_t image, sampler_t sampler, float2 coord);
_CLC_OVERLOAD _CLC_DECL int4
read_imagei(image2d_t image, sampler_t sampler, int2 coord);
_CLC_OVERLOAD _CLC_DECL int4
read_imagei(image2d_t image, sampler_t sampler, float2 coord);
_CLC_OVERLOAD _CLC_DECL uint4
read_imageui(image2d_t image, sampler_t sampler, int2 coord);
_CLC_OVERLOAD _CLC_DECL uint4
read_imageui(image2d_t image, sampler_t sampler, float2 coord);
#endif

View File

@@ -1,57 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
/* get_image_channel_data_type flags */
#define CLK_SNORM_INT8 0x10D0
#define CLK_SNORM_INT16 0x10D1
#define CLK_UNORM_INT8 0x10D2
#define CLK_UNORM_INT16 0x10D3
#define CLK_UNORM_SHORT_565 0x10D4
#define CLK_UNORM_SHORT_555 0x10D5
#define CLK_UNORM_SHORT_101010 0x10D6
#define CLK_SIGNED_INT8 0x10D7
#define CLK_SIGNED_INT16 0x10D8
#define CLK_SIGNED_INT32 0x10D9
#define CLK_UNSIGNED_INT8 0x10DA
#define CLK_UNSIGNED_INT16 0x10DB
#define CLK_UNSIGNED_INT32 0x10DC
#define CLK_HALF_FLOAT 0x10DD
#define CLK_FLOAT 0x10DE
/* get_image_channel_order flags */
#define CLK_R 0x10B0
#define CLK_A 0x10B1
#define CLK_RG 0x10B2
#define CLK_RA 0x10B3
#define CLK_RGB 0x10B4
#define CLK_RGBA 0x10B5
#define CLK_BGRA 0x10B6
#define CLK_ARGB 0x10B7
#define CLK_INTENSITY 0x10B8
#define CLK_LUMINANCE 0x10B9
#define CLK_Rx 0x10BA
#define CLK_RGx 0x10BB
#define CLK_RGBx 0x10BC
/* sampler normalized coords */
#define CLK_NORMALIZED_COORDS_FALSE 0x0000
#define CLK_NORMALIZED_COORDS_TRUE 0x0001
#define __CLC_NORMALIZED_COORDS_MASK 0x0001
/* sampler addressing mode */
#define CLK_ADDRESS_NONE 0x0000
#define CLK_ADDRESS_CLAMP_TO_EDGE 0x0002
#define CLK_ADDRESS_CLAMP 0x0004
#define CLK_ADDRESS_REPEAT 0x0006
#define CLK_ADDRESS_MIRRORED_REPEAT 0x0008
#define __CLC_ADDRESS_MASK 0x000E
/* sampler filter mode */
#define CLK_FILTER_NEAREST 0x0000
#define CLK_FILTER_LINEAR 0x0010
#define __CLC_FILTER_MASK 0x0010

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE add_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad_sat(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z);

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE sub_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,9 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x);

View File

@@ -1,11 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, global __CLC_INTN *iptr);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, local __CLC_INTN *iptr);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, private __CLC_INTN *iptr);

View File

@@ -8,18 +8,18 @@
#define __CLC_DST_ADDR_SPACE local
#define __CLC_SRC_ADDR_SPACE global
#define __CLC_BODY <clc/async/async_work_group_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_copy.inc>
#include <clc/integer/gentype.inc>
#define __CLC_BODY <clc/async/async_work_group_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_copy.inc>
#include <clc/math/gentype.inc>
#undef __CLC_DST_ADDR_SPACE
#undef __CLC_SRC_ADDR_SPACE
#define __CLC_DST_ADDR_SPACE global
#define __CLC_SRC_ADDR_SPACE local
#define __CLC_BODY <clc/async/async_work_group_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_copy.inc>
#include <clc/integer/gentype.inc>
#define __CLC_BODY <clc/async/async_work_group_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_copy.inc>
#include <clc/math/gentype.inc>
#undef __CLC_DST_ADDR_SPACE
#undef __CLC_SRC_ADDR_SPACE

View File

@@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL event_t async_work_group_copy(
__CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst,
_CLC_OVERLOAD _CLC_DECL event_t
async_work_group_copy(__CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst,
const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src,
size_t num_gentypes,
event_t event);
size_t num_gentypes, event_t event);

View File

@@ -8,18 +8,18 @@
#define __CLC_DST_ADDR_SPACE local
#define __CLC_SRC_ADDR_SPACE global
#define __CLC_BODY <clc/async/async_work_group_strided_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_strided_copy.inc>
#include <clc/integer/gentype.inc>
#define __CLC_BODY <clc/async/async_work_group_strided_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_strided_copy.inc>
#include <clc/math/gentype.inc>
#undef __CLC_DST_ADDR_SPACE
#undef __CLC_SRC_ADDR_SPACE
#define __CLC_DST_ADDR_SPACE global
#define __CLC_SRC_ADDR_SPACE local
#define __CLC_BODY <clc/async/async_work_group_strided_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_strided_copy.inc>
#include <clc/integer/gentype.inc>
#define __CLC_BODY <clc/async/async_work_group_strided_copy.inc>
#define __CLC_BODY <clc/opencl/async/async_work_group_strided_copy.inc>
#include <clc/math/gentype.inc>
#undef __CLC_DST_ADDR_SPACE
#undef __CLC_SRC_ADDR_SPACE

View File

@@ -8,7 +8,5 @@
_CLC_OVERLOAD _CLC_DECL event_t async_work_group_strided_copy(
__CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst,
const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src,
size_t num_gentypes,
size_t stride,
event_t event);
const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src, size_t num_gentypes,
size_t stride, event_t event);

View File

@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/async/prefetch.inc>
#define __CLC_BODY <clc/opencl/async/prefetch.inc>
#include <clc/integer/gentype.inc>
#define __CLC_BODY <clc/async/prefetch.inc>
#define __CLC_BODY <clc/opencl/async/prefetch.inc>
#include <clc/math/gentype.inc>

View File

@@ -6,4 +6,5 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL void prefetch(const global __CLC_GENTYPE *p, size_t num_gentypes);
_CLC_OVERLOAD _CLC_DECL void prefetch(const global __CLC_GENTYPE *p,
size_t num_gentypes);

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_base_atomics
#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics

View File

@@ -9,16 +9,16 @@
#ifdef cl_khr_global_int32_extended_atomics
#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE global
#include <clc/atomic/atom_decl_int32.inc>
#include <clc/opencl/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>
#include <clc/opencl/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>
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_add
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_and
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL int atomic_cmpxchg (volatile local int *, int, int);
_CLC_OVERLOAD _CLC_DECL int atomic_cmpxchg (volatile global int *, int, int);
_CLC_OVERLOAD _CLC_DECL uint atomic_cmpxchg (volatile local uint *, uint, uint);
_CLC_OVERLOAD _CLC_DECL uint atomic_cmpxchg (volatile global uint *, uint, uint);
_CLC_OVERLOAD _CLC_DECL int atomic_cmpxchg(volatile local int *, int, int);
_CLC_OVERLOAD _CLC_DECL int atomic_cmpxchg(volatile global int *, int, int);
_CLC_OVERLOAD _CLC_DECL uint atomic_cmpxchg(volatile local uint *, uint, uint);
_CLC_OVERLOAD _CLC_DECL uint atomic_cmpxchg(volatile global uint *, uint, uint);

View File

@@ -0,0 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL int atomic_dec(volatile local int *);
_CLC_OVERLOAD _CLC_DECL int atomic_dec(volatile global int *);
_CLC_OVERLOAD _CLC_DECL uint atomic_dec(volatile local uint *);
_CLC_OVERLOAD _CLC_DECL uint atomic_dec(volatile global uint *);

View File

@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#define __CLC_DECLARE_ATOMIC(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
#define __CLC_DECLARE_ATOMIC_ADDRSPACE(TYPE) \
__CLC_DECLARE_ATOMIC(global, TYPE) \

View File

@@ -0,0 +1,12 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL int atomic_inc(volatile local int *);
_CLC_OVERLOAD _CLC_DECL int atomic_inc(volatile global int *);
_CLC_OVERLOAD _CLC_DECL uint atomic_inc(volatile local uint *);
_CLC_OVERLOAD _CLC_DECL uint atomic_inc(volatile global uint *);

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_max
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_min
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_or
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_sub
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -8,6 +8,6 @@
#define __CLC_FUNCTION atomic_xchg
_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION (volatile local float *, float);
_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION (volatile global float *, float);
#include <clc/atomic/atomic_decl.inc>
_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION(volatile local float *, float);
_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION(volatile global float *, float);
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -7,4 +7,4 @@
//===----------------------------------------------------------------------===//
#define __CLC_FUNCTION atomic_xor
#include <clc/atomic/atomic_decl.inc>
#include <clc/opencl/atomic/atomic_decl.inc>

View File

@@ -0,0 +1,267 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef __CLC_OPENCL_CLC_H__
#define __CLC_OPENCL_CLC_H__
#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
#endif
/* Function Attributes */
#include <clc/clcfunc.h>
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>
/* 6.2.3 Explicit Conversions */
#include <clc/opencl/convert.h>
/* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */
#include <clc/opencl/as_type.h>
/* 6.11.1 Work-Item Functions */
#include <clc/opencl/workitem/get_global_id.h>
#include <clc/opencl/workitem/get_global_offset.h>
#include <clc/opencl/workitem/get_global_size.h>
#include <clc/opencl/workitem/get_group_id.h>
#include <clc/opencl/workitem/get_local_id.h>
#include <clc/opencl/workitem/get_local_size.h>
#include <clc/opencl/workitem/get_num_groups.h>
#include <clc/opencl/workitem/get_work_dim.h>
/* 6.11.2 Math Functions */
#include <clc/opencl/math/acos.h>
#include <clc/opencl/math/acosh.h>
#include <clc/opencl/math/acospi.h>
#include <clc/opencl/math/asin.h>
#include <clc/opencl/math/asinh.h>
#include <clc/opencl/math/asinpi.h>
#include <clc/opencl/math/atan.h>
#include <clc/opencl/math/atan2.h>
#include <clc/opencl/math/atan2pi.h>
#include <clc/opencl/math/atanh.h>
#include <clc/opencl/math/atanpi.h>
#include <clc/opencl/math/cbrt.h>
#include <clc/opencl/math/ceil.h>
#include <clc/opencl/math/copysign.h>
#include <clc/opencl/math/cos.h>
#include <clc/opencl/math/cosh.h>
#include <clc/opencl/math/cospi.h>
#include <clc/opencl/math/erf.h>
#include <clc/opencl/math/erfc.h>
#include <clc/opencl/math/exp.h>
#include <clc/opencl/math/exp10.h>
#include <clc/opencl/math/exp2.h>
#include <clc/opencl/math/expm1.h>
#include <clc/opencl/math/fabs.h>
#include <clc/opencl/math/fdim.h>
#include <clc/opencl/math/floor.h>
#include <clc/opencl/math/fma.h>
#include <clc/opencl/math/fmax.h>
#include <clc/opencl/math/fmin.h>
#include <clc/opencl/math/fmod.h>
#include <clc/opencl/math/fract.h>
#include <clc/opencl/math/frexp.h>
#include <clc/opencl/math/half_cos.h>
#include <clc/opencl/math/half_divide.h>
#include <clc/opencl/math/half_exp.h>
#include <clc/opencl/math/half_exp10.h>
#include <clc/opencl/math/half_exp2.h>
#include <clc/opencl/math/half_log.h>
#include <clc/opencl/math/half_log10.h>
#include <clc/opencl/math/half_log2.h>
#include <clc/opencl/math/half_powr.h>
#include <clc/opencl/math/half_recip.h>
#include <clc/opencl/math/half_rsqrt.h>
#include <clc/opencl/math/half_sin.h>
#include <clc/opencl/math/half_sqrt.h>
#include <clc/opencl/math/half_tan.h>
#include <clc/opencl/math/hypot.h>
#include <clc/opencl/math/ilogb.h>
#include <clc/opencl/math/ldexp.h>
#include <clc/opencl/math/lgamma.h>
#include <clc/opencl/math/lgamma_r.h>
#include <clc/opencl/math/log.h>
#include <clc/opencl/math/log10.h>
#include <clc/opencl/math/log1p.h>
#include <clc/opencl/math/log2.h>
#include <clc/opencl/math/logb.h>
#include <clc/opencl/math/mad.h>
#include <clc/opencl/math/maxmag.h>
#include <clc/opencl/math/minmag.h>
#include <clc/opencl/math/modf.h>
#include <clc/opencl/math/nan.h>
#include <clc/opencl/math/native_cos.h>
#include <clc/opencl/math/native_divide.h>
#include <clc/opencl/math/native_exp.h>
#include <clc/opencl/math/native_exp10.h>
#include <clc/opencl/math/native_exp2.h>
#include <clc/opencl/math/native_log.h>
#include <clc/opencl/math/native_log10.h>
#include <clc/opencl/math/native_log2.h>
#include <clc/opencl/math/native_powr.h>
#include <clc/opencl/math/native_recip.h>
#include <clc/opencl/math/native_rsqrt.h>
#include <clc/opencl/math/native_sin.h>
#include <clc/opencl/math/native_sqrt.h>
#include <clc/opencl/math/native_tan.h>
#include <clc/opencl/math/nextafter.h>
#include <clc/opencl/math/pow.h>
#include <clc/opencl/math/pown.h>
#include <clc/opencl/math/powr.h>
#include <clc/opencl/math/remainder.h>
#include <clc/opencl/math/remquo.h>
#include <clc/opencl/math/rint.h>
#include <clc/opencl/math/rootn.h>
#include <clc/opencl/math/round.h>
#include <clc/opencl/math/rsqrt.h>
#include <clc/opencl/math/sin.h>
#include <clc/opencl/math/sincos.h>
#include <clc/opencl/math/sinh.h>
#include <clc/opencl/math/sinpi.h>
#include <clc/opencl/math/sqrt.h>
#include <clc/opencl/math/tan.h>
#include <clc/opencl/math/tanh.h>
#include <clc/opencl/math/tanpi.h>
#include <clc/opencl/math/tgamma.h>
#include <clc/opencl/math/trunc.h>
/* 6.11.2.1 Floating-point macros */
#include <clc/float/definitions.h>
/* 6.11.3 Integer Functions */
#include <clc/opencl/integer/abs.h>
#include <clc/opencl/integer/abs_diff.h>
#include <clc/opencl/integer/add_sat.h>
#include <clc/opencl/integer/clz.h>
#include <clc/opencl/integer/ctz.h>
#include <clc/opencl/integer/hadd.h>
#include <clc/opencl/integer/mad24.h>
#include <clc/opencl/integer/mad_hi.h>
#include <clc/opencl/integer/mad_sat.h>
#include <clc/opencl/integer/mul24.h>
#include <clc/opencl/integer/mul_hi.h>
#include <clc/opencl/integer/popcount.h>
#include <clc/opencl/integer/rhadd.h>
#include <clc/opencl/integer/rotate.h>
#include <clc/opencl/integer/sub_sat.h>
#include <clc/opencl/integer/upsample.h>
/* 6.11.3 Integer Definitions */
#include <clc/integer/definitions.h>
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
#include <clc/opencl/shared/clamp.h>
#include <clc/opencl/shared/max.h>
#include <clc/opencl/shared/min.h>
#include <clc/opencl/shared/vload.h>
#include <clc/opencl/shared/vstore.h>
/* 6.11.4 Common Functions */
#include <clc/opencl/common/degrees.h>
#include <clc/opencl/common/mix.h>
#include <clc/opencl/common/radians.h>
#include <clc/opencl/common/sign.h>
#include <clc/opencl/common/smoothstep.h>
#include <clc/opencl/common/step.h>
/* 6.11.5 Geometric Functions */
#include <clc/opencl/geometric/cross.h>
#include <clc/opencl/geometric/distance.h>
#include <clc/opencl/geometric/dot.h>
#include <clc/opencl/geometric/fast_distance.h>
#include <clc/opencl/geometric/fast_length.h>
#include <clc/opencl/geometric/fast_normalize.h>
#include <clc/opencl/geometric/length.h>
#include <clc/opencl/geometric/normalize.h>
/* 6.11.6 Relational Functions */
#include <clc/opencl/relational/all.h>
#include <clc/opencl/relational/any.h>
#include <clc/opencl/relational/bitselect.h>
#include <clc/opencl/relational/isequal.h>
#include <clc/opencl/relational/isfinite.h>
#include <clc/opencl/relational/isgreater.h>
#include <clc/opencl/relational/isgreaterequal.h>
#include <clc/opencl/relational/isinf.h>
#include <clc/opencl/relational/isless.h>
#include <clc/opencl/relational/islessequal.h>
#include <clc/opencl/relational/islessgreater.h>
#include <clc/opencl/relational/isnan.h>
#include <clc/opencl/relational/isnormal.h>
#include <clc/opencl/relational/isnotequal.h>
#include <clc/opencl/relational/isordered.h>
#include <clc/opencl/relational/isunordered.h>
#include <clc/opencl/relational/select.h>
#include <clc/opencl/relational/signbit.h>
/* 6.11.8 Synchronization Functions */
#include <clc/opencl/synchronization/barrier.h>
#include <clc/opencl/synchronization/cl_mem_fence_flags.h>
/* 6.11.9 Explicit Memory Fence Functions */
#include <clc/opencl/explicit_fence/explicit_memory_fence.h>
/* 6.11.10 Async Copy and Prefetch Functions */
#include <clc/opencl/async/async_work_group_copy.h>
#include <clc/opencl/async/async_work_group_strided_copy.h>
#include <clc/opencl/async/prefetch.h>
#include <clc/opencl/async/wait_group_events.h>
/* 6.11.11 Atomic Functions */
#include <clc/opencl/atomic/atomic_add.h>
#include <clc/opencl/atomic/atomic_and.h>
#include <clc/opencl/atomic/atomic_cmpxchg.h>
#include <clc/opencl/atomic/atomic_dec.h>
#include <clc/opencl/atomic/atomic_inc.h>
#include <clc/opencl/atomic/atomic_max.h>
#include <clc/opencl/atomic/atomic_min.h>
#include <clc/opencl/atomic/atomic_or.h>
#include <clc/opencl/atomic/atomic_sub.h>
#include <clc/opencl/atomic/atomic_xchg.h>
#include <clc/opencl/atomic/atomic_xor.h>
/* cl_khr_global_int32_base_atomics, cl_khr_local_int32_base_atomics and
* cl_khr_int64_base_atomics Extension Functions */
#include <clc/opencl/atomic/atom_add.h>
#include <clc/opencl/atomic/atom_cmpxchg.h>
#include <clc/opencl/atomic/atom_dec.h>
#include <clc/opencl/atomic/atom_inc.h>
#include <clc/opencl/atomic/atom_sub.h>
#include <clc/opencl/atomic/atom_xchg.h>
/* cl_khr_global_int32_extended_atomics, cl_khr_local_int32_extended_atomics and
* cl_khr_int64_extended_atomics Extension Functions */
#include <clc/opencl/atomic/atom_and.h>
#include <clc/opencl/atomic/atom_max.h>
#include <clc/opencl/atomic/atom_min.h>
#include <clc/opencl/atomic/atom_or.h>
#include <clc/opencl/atomic/atom_xor.h>
/* 6.12.12 Miscellaneous Vector Functions */
#include <clc/opencl/misc/shuffle.h>
#include <clc/opencl/misc/shuffle2.h>
/* 6.11.13 Image Read and Write Functions */
#include <clc/opencl/image/image.h>
#include <clc/opencl/image/image_defines.h>
#pragma OPENCL EXTENSION all : disable
#endif // __CLC_OPENCL_CLC_H__

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/common/degrees.inc>
#define __CLC_FUNCTION degrees
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
#undef __CLC_FUNCTION

View File

@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/common/mix.inc>
#define __CLC_BODY <clc/opencl/common/mix.inc>
#include <clc/math/gentype.inc>

View File

@@ -6,8 +6,10 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b,
__CLC_GENTYPE c);
#ifndef __CLC_SCALAR
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_SCALAR_GENTYPE c);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b,
__CLC_SCALAR_GENTYPE c);
#endif

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/common/radians.inc>
#define __CLC_FUNCTION radians
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
#undef __CLC_FUNCTION

View File

@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/common/smoothstep.inc>
#define __CLC_BODY <clc/opencl/common/smoothstep.inc>
#include <clc/math/gentype.inc>

View File

@@ -6,9 +6,13 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(__CLC_GENTYPE edge0, __CLC_GENTYPE edge1, __CLC_GENTYPE x);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(float edge0, float edge1, __CLC_GENTYPE x);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(__CLC_GENTYPE edge0,
__CLC_GENTYPE edge1,
__CLC_GENTYPE x);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(float edge0, float edge1,
__CLC_GENTYPE x);
#ifdef cl_khr_fp64
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(double edge0, double edge1, __CLC_GENTYPE x);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(double edge0, double edge1,
__CLC_GENTYPE x);
#endif

View File

@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/common/step.inc>
#define __CLC_BODY <clc/opencl/common/step.inc>
#include <clc/math/gentype.inc>

View File

@@ -0,0 +1,48 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#if defined(__opencl_c_images)
_CLC_OVERLOAD _CLC_DECL int get_image_width(image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_width(image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_height(image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_height(image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_depth(image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type(image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type(image3d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order(image2d_t image);
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order(image3d_t image);
_CLC_OVERLOAD _CLC_DECL int2 get_image_dim(image2d_t image);
_CLC_OVERLOAD _CLC_DECL int4 get_image_dim(image3d_t image);
_CLC_OVERLOAD _CLC_DECL void write_imagef(image2d_t image, int2 coord,
float4 color);
_CLC_OVERLOAD _CLC_DECL void write_imagei(image2d_t image, int2 coord,
int4 color);
_CLC_OVERLOAD _CLC_DECL void write_imageui(image2d_t image, int2 coord,
uint4 color);
_CLC_OVERLOAD _CLC_DECL float4 read_imagef(image2d_t image, sampler_t sampler,
int2 coord);
_CLC_OVERLOAD _CLC_DECL float4 read_imagef(image2d_t image, sampler_t sampler,
float2 coord);
_CLC_OVERLOAD _CLC_DECL int4 read_imagei(image2d_t image, sampler_t sampler,
int2 coord);
_CLC_OVERLOAD _CLC_DECL int4 read_imagei(image2d_t image, sampler_t sampler,
float2 coord);
_CLC_OVERLOAD _CLC_DECL uint4 read_imageui(image2d_t image, sampler_t sampler,
int2 coord);
_CLC_OVERLOAD _CLC_DECL uint4 read_imageui(image2d_t image, sampler_t sampler,
float2 coord);
#endif

View File

@@ -0,0 +1,57 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
/* get_image_channel_data_type flags */
#define CLK_SNORM_INT8 0x10D0
#define CLK_SNORM_INT16 0x10D1
#define CLK_UNORM_INT8 0x10D2
#define CLK_UNORM_INT16 0x10D3
#define CLK_UNORM_SHORT_565 0x10D4
#define CLK_UNORM_SHORT_555 0x10D5
#define CLK_UNORM_SHORT_101010 0x10D6
#define CLK_SIGNED_INT8 0x10D7
#define CLK_SIGNED_INT16 0x10D8
#define CLK_SIGNED_INT32 0x10D9
#define CLK_UNSIGNED_INT8 0x10DA
#define CLK_UNSIGNED_INT16 0x10DB
#define CLK_UNSIGNED_INT32 0x10DC
#define CLK_HALF_FLOAT 0x10DD
#define CLK_FLOAT 0x10DE
/* get_image_channel_order flags */
#define CLK_R 0x10B0
#define CLK_A 0x10B1
#define CLK_RG 0x10B2
#define CLK_RA 0x10B3
#define CLK_RGB 0x10B4
#define CLK_RGBA 0x10B5
#define CLK_BGRA 0x10B6
#define CLK_ARGB 0x10B7
#define CLK_INTENSITY 0x10B8
#define CLK_LUMINANCE 0x10B9
#define CLK_Rx 0x10BA
#define CLK_RGx 0x10BB
#define CLK_RGBx 0x10BC
/* sampler normalized coords */
#define CLK_NORMALIZED_COORDS_FALSE 0x0000
#define CLK_NORMALIZED_COORDS_TRUE 0x0001
#define __CLC_NORMALIZED_COORDS_MASK 0x0001
/* sampler addressing mode */
#define CLK_ADDRESS_NONE 0x0000
#define CLK_ADDRESS_CLAMP_TO_EDGE 0x0002
#define CLK_ADDRESS_CLAMP 0x0004
#define CLK_ADDRESS_REPEAT 0x0006
#define CLK_ADDRESS_MIRRORED_REPEAT 0x0008
#define __CLC_ADDRESS_MASK 0x000E
/* sampler filter mode */
#define CLK_FILTER_NEAREST 0x0000
#define CLK_FILTER_LINEAR 0x0010
#define __CLC_FILTER_MASK 0x0010

View File

@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/abs.inc>
#define __CLC_BODY <clc/opencl/integer/abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/abs_diff.inc>
#define __CLC_BODY <clc/opencl/integer/abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -6,4 +6,5 @@
//
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y);
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x,
__CLC_GENTYPE y);

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/add_sat.inc>
#define __CLC_FUNCTION add_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_FUNCTION

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/mad_sat.inc>
#define __CLC_FUNCTION mad_sat
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_FUNCTION

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/rotate.inc>
#define __CLC_FUNCTION rotate
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_FUNCTION

View File

@@ -6,5 +6,9 @@
//
//===----------------------------------------------------------------------===//
#define __CLC_BODY <clc/integer/sub_sat.inc>
#define __CLC_FUNCTION sub_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_FUNCTION

Some files were not shown because too many files have changed in this diff Show More