Skip to content

Commit

Permalink
Add partial support for cl_arm_scheduling_controls
Browse files Browse the repository at this point in the history
- Add support for device queries
- Introduce a generic function for clSetKernelExecInfo

Support for the command queue properties will be added via KhronosGroup#80.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
  • Loading branch information
kpet committed Sep 14, 2020
1 parent 3b03738 commit 6ec1532
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/CL/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,9 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_UNITS_BITFIELD_AR
#ifdef CL_DEVICE_JOB_SLOTS_ARM
CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_JOB_SLOTS_ARM, cl_uint)
#endif
#ifdef CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM
CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM, cl_bitfield)
#endif

#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
Expand Down Expand Up @@ -6145,6 +6148,17 @@ class Kernel : public detail::Wrapper<cl_kernel>
sizeof(void*)*(1 + sizeof...(Ts)),
pointerList.data()));
}

template<typename T>
cl_int setExecInfo(cl_kernel_exec_info param_name, const T& val)
{
return detail::errHandler(
::clSetKernelExecInfo(
object_,
param_name,
sizeof(T),
&val));
}
#endif // #if CL_HPP_TARGET_OPENCL_VERSION >= 200

#if CL_HPP_TARGET_OPENCL_VERSION >= 210
Expand Down
14 changes: 14 additions & 0 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,20 @@ void testKernelSetArgLocal()
kernelPool[0].setArg(2, cl::Local(123));
}

void testKernelSetExecInfo()
{
#if CL_HPP_TARGET_OPENCL_VERSION >= 200
cl_bool val = CL_TRUE;
// Using CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM in the tests since it's
// defined by the core spec but this function is particularly useful for
// vendor extensions.
clSetKernelExecInfo_ExpectAndReturn(make_kernel(0),
CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM,
sizeof(cl_bool), &val, CL_SUCCESS);
kernelPool[0].setExecInfo(CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM, val);
#endif
}

/****************************************************************************
* Tests for cl::copy
****************************************************************************/
Expand Down

0 comments on commit 6ec1532

Please sign in to comment.