updated boost on windows

This commit is contained in:
Bassem Girgis
2019-08-13 21:48:48 -05:00
parent 7d77d485fd
commit b40a3bee82
5162 changed files with 473027 additions and 116452 deletions

View File

@@ -15,11 +15,16 @@
#include <boost/assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/optional.hpp>
#include <boost/compute/cl_ext.hpp> // cl_khr_subgroups
#include <boost/compute/config.hpp>
#include <boost/compute/program.hpp>
#include <boost/compute/exception.hpp>
#include <boost/compute/program.hpp>
#include <boost/compute/platform.hpp>
#include <boost/compute/type_traits/is_fundamental.hpp>
#include <boost/compute/detail/diagnostic.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/detail/assert_cl_success.hpp>
@@ -124,6 +129,21 @@ public:
}
}
#if defined(BOOST_COMPUTE_CL_VERSION_2_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// Creates a new kernel object based on a shallow copy of
/// the undelying OpenCL kernel object.
///
/// \opencl_version_warning{2,1}
///
/// \see_opencl21_ref{clCloneKernel}
kernel clone()
{
cl_int ret = 0;
cl_kernel k = clCloneKernel(m_kernel, &ret);
return kernel(k, false);
}
#endif // BOOST_COMPUTE_CL_VERSION_2_1
/// Returns a reference to the underlying OpenCL kernel object.
cl_kernel& get() const
{
@@ -168,7 +188,7 @@ public:
typename detail::get_object_info_type<kernel, Enum>::type
get_info() const;
#if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
#if defined(BOOST_COMPUTE_CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// Returns information about the argument at \p index.
///
/// For example, to get the name of the first argument:
@@ -197,7 +217,7 @@ public:
template<int Enum>
typename detail::get_object_info_type<kernel, Enum>::type
get_arg_info(size_t index) const;
#endif // CL_VERSION_1_2
#endif // BOOST_COMPUTE_CL_VERSION_1_2
/// Returns work-group information for the kernel with \p device.
///
@@ -208,6 +228,106 @@ public:
return detail::get_object_info<T>(clGetKernelWorkGroupInfo, m_kernel, info, device.id());
}
#if defined(BOOST_COMPUTE_CL_VERSION_2_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// Returns sub-group information for the kernel with \p device. Returns a null
/// optional if \p device is not 2.1 device, or is not 2.0 device with support
/// for cl_khr_subgroups extension.
///
/// \opencl_version_warning{2,1}
/// \see_opencl21_ref{clGetKernelSubGroupInfo}
/// \see_opencl2_ref{clGetKernelSubGroupInfoKHR}
template<class T>
boost::optional<T> get_sub_group_info(const device &device, cl_kernel_sub_group_info info,
const size_t input_size, const void * input) const
{
if(device.check_version(2, 1))
{
return detail::get_object_info<T>(
clGetKernelSubGroupInfo, m_kernel, info, device.id(), input_size, input
);
}
else if(!device.check_version(2, 0) || !device.supports_extension("cl_khr_subgroups"))
{
return boost::optional<T>();
}
// Only CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE and CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE
// are supported in cl_khr_subgroups extension for 2.0 devices.
else if(info != CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE && info != CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE)
{
return boost::optional<T>();
}
BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS();
clGetKernelSubGroupInfoKHR_fn clGetKernelSubGroupInfoKHR_fptr =
reinterpret_cast<clGetKernelSubGroupInfoKHR_fn>(
reinterpret_cast<size_t>(
device.platform().get_extension_function_address("clGetKernelSubGroupInfoKHR")
)
);
BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS();
return detail::get_object_info<T>(
clGetKernelSubGroupInfoKHR_fptr, m_kernel, info, device.id(), input_size, input
);
}
/// \overload
template<class T>
boost::optional<T> get_sub_group_info(const device &device, cl_kernel_sub_group_info info) const
{
return get_sub_group_info<T>(device, info, 0, 0);
}
/// \overload
template<class T>
boost::optional<T> get_sub_group_info(const device &device, cl_kernel_sub_group_info info,
const size_t input) const
{
return get_sub_group_info<T>(device, info, sizeof(size_t), &input);
}
#endif // BOOST_COMPUTE_CL_VERSION_2_1
#if defined(BOOST_COMPUTE_CL_VERSION_2_0) && !defined(BOOST_COMPUTE_CL_VERSION_2_1)
/// Returns sub-group information for the kernel with \p device. Returns a null
/// optional if cl_khr_subgroups extension is not supported by \p device.
///
/// \opencl_version_warning{2,0}
/// \see_opencl2_ref{clGetKernelSubGroupInfoKHR}
template<class T>
boost::optional<T> get_sub_group_info(const device &device, cl_kernel_sub_group_info info,
const size_t input_size, const void * input) const
{
if(!device.check_version(2, 0) || !device.supports_extension("cl_khr_subgroups"))
{
return boost::optional<T>();
}
BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS();
clGetKernelSubGroupInfoKHR_fn clGetKernelSubGroupInfoKHR_fptr =
reinterpret_cast<clGetKernelSubGroupInfoKHR_fn>(
reinterpret_cast<size_t>(
device.platform().get_extension_function_address("clGetKernelSubGroupInfoKHR")
)
);
BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS();
return detail::get_object_info<T>(
clGetKernelSubGroupInfoKHR_fptr, m_kernel, info, device.id(), input_size, input
);
}
#endif // defined(BOOST_COMPUTE_CL_VERSION_2_0) && !defined(BOOST_COMPUTE_CL_VERSION_2_1)
#if defined(BOOST_COMPUTE_CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// \overload
template<class T>
boost::optional<T> get_sub_group_info(const device &device, cl_kernel_sub_group_info info,
const std::vector<size_t> input) const
{
BOOST_ASSERT(input.size() > 0);
return get_sub_group_info<T>(device, info, input.size() * sizeof(size_t), &input[0]);
}
#endif // BOOST_COMPUTE_CL_VERSION_2_0
/// Sets the argument at \p index to \p value with \p size.
///
/// \see_opencl_ref{clSetKernelArg}
@@ -266,7 +386,7 @@ public:
/// \internal_
void set_arg_svm_ptr(size_t index, void* ptr)
{
#ifdef CL_VERSION_2_0
#ifdef BOOST_COMPUTE_CL_VERSION_2_0
cl_int ret = clSetKernelArgSVMPointer(m_kernel, static_cast<cl_uint>(index), ptr);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
@@ -289,7 +409,7 @@ public:
}
#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES
#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
#if defined(BOOST_COMPUTE_CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
/// Sets additional execution information for the kernel.
///
/// \opencl_version_warning{2,0}
@@ -302,7 +422,7 @@ public:
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
}
#endif // CL_VERSION_2_0
#endif // BOOST_COMPUTE_CL_VERSION_2_0
/// Returns \c true if the kernel is the same at \p other.
bool operator==(const kernel &other) const
@@ -365,14 +485,14 @@ BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel,
((cl_program, CL_KERNEL_PROGRAM))
)
#ifdef CL_VERSION_1_2
#ifdef BOOST_COMPUTE_CL_VERSION_1_2
BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel,
((std::string, CL_KERNEL_ATTRIBUTES))
)
#endif // CL_VERSION_1_2
#endif // BOOST_COMPUTE_CL_VERSION_1_2
/// \internal_ define get_arg_info() specializations for kernel
#ifdef CL_VERSION_1_2
#ifdef BOOST_COMPUTE_CL_VERSION_1_2
#define BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(result_type, value) \
namespace detail { \
template<> struct get_object_info_type<kernel, value> { typedef result_type type; }; \
@@ -386,7 +506,7 @@ BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_acc
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_TYPE_NAME)
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_type_qualifier, CL_KERNEL_ARG_TYPE_QUALIFIER)
BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_NAME)
#endif // CL_VERSION_1_2
#endif // BOOST_COMPUTE_CL_VERSION_1_2
namespace detail {