18 #include <type_traits>
21 inline namespace _V1 {
24 template <
typename Param>
25 typename std::enable_if<
26 std::is_same<typename Param::return_type, std::string>::value,
30 "Invalid kernel information descriptor");
31 size_t ResultSize = 0;
35 nullptr, &ResultSize);
36 if (ResultSize == 0) {
39 std::vector<char> Result(ResultSize);
42 ResultSize, Result.data(),
nullptr);
43 return std::string(Result.data());
46 template <
typename Param>
47 typename std::enable_if<
48 std::is_same<typename Param::return_type, uint32_t>::value, uint32_t>::type
54 sizeof(uint32_t), &Result,
nullptr);
59 template <
typename Param>
60 typename std::enable_if<IsSubGroupInfo<Param>::value>::type
70 template <
typename Param>
71 typename std::enable_if<!IsSubGroupInfo<Param>::value>::type
79 if (Error != PI_SUCCESS)
84 template <
typename Param>
85 typename std::enable_if<
86 !std::is_same<typename Param::return_type, sycl::range<3>>::value,
87 typename Param::return_type>::type
92 "Unexpected kernel_device_specific information descriptor");
93 typename Param::return_type Result = {};
95 get_kernel_device_specific_info_helper<Param>(
96 Kernel, Device, Plugin, &Result,
sizeof(
typename Param::return_type));
100 template <
typename Param>
101 typename std::enable_if<
102 std::is_same<typename Param::return_type, sycl::range<3>>::value,
108 "Unexpected kernel_device_specific information descriptor");
109 size_t Result[3] = {0, 0, 0};
111 get_kernel_device_specific_info_helper<Param>(Kernel, Device, Plugin, Result,
119 template <
typename Param>
124 "Unexpected kernel_device_specific information descriptor");
125 static_assert(std::is_same<typename Param::return_type, uint32_t>::value,
126 "Unexpected return type");
128 "Unexpected kernel_device_specific information descriptor for "
130 size_t Input[3] = {In[0], In[1], In[2]};
135 sizeof(uint32_t), &Result,
nullptr);
140 template <
typename Param>
141 inline typename Param::return_type
146 info::kernel_device_specific::global_work_size>(
const sycl::device &) {
147 throw invalid_object_error(
"This instance of kernel is a host instance",
148 PI_ERROR_INVALID_KERNEL);
154 return Dev.get_info<info::device::max_work_group_size>();
159 info::kernel_device_specific::compile_work_group_size>(
166 info::kernel_device_specific::preferred_work_group_size_multiple>(
174 info::kernel_device_specific::private_mem_size>(
const sycl::device &) {
180 info::kernel_device_specific::ext_codeplay_num_regs>(
const sycl::device &) {
186 info::kernel_device_specific::max_num_sub_groups>(
const sycl::device &) {
187 throw invalid_object_error(
"This instance of kernel is a host instance",
188 PI_ERROR_INVALID_KERNEL);
193 info::kernel_device_specific::max_sub_group_size>(
const sycl::device &) {
194 throw invalid_object_error(
"This instance of kernel is a host instance",
195 PI_ERROR_INVALID_KERNEL);
200 info::kernel_device_specific::compile_num_sub_groups>(
202 throw invalid_object_error(
"This instance of kernel is a host instance",
203 PI_ERROR_INVALID_KERNEL);
208 info::kernel_device_specific::compile_sub_group_size>(
210 throw invalid_object_error(
"This instance of kernel is a host instance",
211 PI_ERROR_INVALID_KERNEL);
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Defines the iteration domain of either a single work-group in a parallel dispatch,...
void handleErrorOrWarning(pi_result Error, pi_kernel_group_info Descriptor, const PluginPtr &Plugin)
Analyzes error code of piKernelGetGroupInfo.
uint32_t get_kernel_device_specific_info_with_input(sycl::detail::pi::PiKernel Kernel, sycl::detail::pi::PiDevice Device, sycl::range< 3 > In, const PluginPtr &Plugin)
std::enable_if< !std::is_same< typename Param::return_type, sycl::range< 3 > >::value, typename Param::return_type >::type get_kernel_device_specific_info(sycl::detail::pi::PiKernel Kernel, sycl::detail::pi::PiDevice Device, const PluginPtr &Plugin)
Param::return_type get_kernel_device_specific_info_host(const sycl::device &Device)=delete
std::shared_ptr< plugin > PluginPtr
std::enable_if< IsSubGroupInfo< Param >::value >::type get_kernel_device_specific_info_helper(sycl::detail::pi::PiKernel Kernel, sycl::detail::pi::PiDevice Device, const PluginPtr &Plugin, void *Result, size_t Size)
std::enable_if< std::is_same< typename Param::return_type, std::string >::value, std::string >::type get_kernel_info(sycl::detail::pi::PiKernel Kernel, const PluginPtr &Plugin)
constexpr work_group_size_key::value_t< Dim0, Dims... > work_group_size
pi_result piKernelGetSubGroupInfo(pi_kernel kernel, pi_device device, pi_kernel_sub_group_info param_name, size_t input_value_size, const void *input_value, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
API to query information from the sub-group from a kernel.
pi_result piKernelGetInfo(pi_kernel kernel, pi_kernel_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
pi_result piKernelGetGroupInfo(pi_kernel kernel, pi_device device, pi_kernel_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
C++ wrapper of extern "C" PI interfaces.