11 #ifdef __SYCL_INTERNAL_API
35 enum class program_state {
none = 0, compiled = 1, linked = 2 };
44 "program class is deprecated, use kernel_bundle
instead") program {
56 explicit program(
const context &Context,
const property_list &PropList = {});
67 program(
const context &Context, std::vector<device> DeviceList,
68 const property_list &PropList = {});
82 program(std::vector<program> ProgramList,
const property_list &PropList = {});
97 program(std::vector<program> ProgramList, std::string LinkOptions,
98 const property_list &PropList = {});
111 program(
const context &Context, cl_program ClProgram);
113 program(
const program &rhs) =
default;
115 program(program &&rhs) =
default;
117 program &operator=(
const program &rhs) =
default;
119 program &operator=(program &&rhs) =
default;
121 bool operator==(
const program &rhs)
const {
return impl == rhs.impl; }
123 bool operator!=(
const program &rhs)
const {
return impl != rhs.impl; }
128 template <
typename propertyT>
bool has_property()
const;
136 template <
typename propertyT> propertyT
get_property()
const;
145 cl_program
get()
const;
148 bool is_host()
const;
162 template <
typename KernelT>
163 void compile_with_kernel_type(std::string CompileOptions =
"") {
165 detail::KernelInfo<KernelT>::getName());
166 compile_with_kernel_name(detail::KernelInfo<KernelT>::getName(),
183 void compile_with_source(std::string KernelSource,
184 std::string CompileOptions =
"");
199 template <
typename KernelT>
200 void build_with_kernel_type(std::string BuildOptions =
"") {
202 detail::KernelInfo<KernelT>::getName());
203 build_with_kernel_name(detail::KernelInfo<KernelT>::getName(), BuildOptions,
220 void build_with_source(std::string KernelSource,
221 std::string BuildOptions =
"");
234 void link(std::string LinkOptions =
"");
242 template <
typename KernelT>
bool has_kernel()
const {
243 return has_kernel(detail::KernelInfo<KernelT>::getName(),
256 bool has_kernel(std::string KernelName)
const;
264 template <
typename KernelT>
kernel get_kernel()
const {
265 return get_kernel(detail::KernelInfo<KernelT>::getName(),
276 kernel get_kernel(std::string KernelName)
const;
281 template <info::program param>
282 typename info::param_traits<info::program, param>::return_type
293 std::vector<std::vector<char>> get_binaries()
const;
299 std::vector<device> get_devices()
const;
311 std::string get_compile_options()
const;
327 std::string get_link_options()
const;
337 std::string get_build_options()
const;
340 program_state get_state()
const;
347 template <
typename ID,
typename T>
348 ext::oneapi::experimental::spec_constant<T, ID> set_spec_constant(
T Cst) {
349 constexpr
const char *Name = detail::SpecConstantInfo<ID>::getName();
350 static_assert(std::is_arithmetic<T>::value ||
351 (std::is_class<T>::value && std::is_pod<T>::value),
352 "unsupported specialization constant type");
353 #ifdef __SYCL_DEVICE_ONLY__
356 return ext::oneapi::experimental::spec_constant<T, ID>();
358 set_spec_constant_impl(Name, &Cst,
sizeof(
T));
359 return ext::oneapi::experimental::spec_constant<T, ID>(Cst);
360 #endif // __SYCL_DEVICE_ONLY__
366 backend get_backend() const noexcept;
374 return reinterpret_cast<backend_return_t<Backend, program>
>(getNative());
379 program(std::shared_ptr<detail::program_impl> impl);
387 kernel get_kernel(std::string KernelName,
bool IsCreatedFromSource)
const;
395 bool has_kernel(std::string KernelName,
bool IsCreatedFromSource)
const;
402 void compile_with_kernel_name(std::string KernelName,
403 std::string CompileOptions,
411 void build_with_kernel_name(std::string KernelName, std::string buildOptions,
414 void set_spec_constant_impl(
const char *Name,
void *Data,
size_t Size);
416 std::shared_ptr<detail::program_impl> impl;
427 template <>
struct hash<
cl::sycl::program> {
428 size_t operator()(
const cl::sycl::program &prg)
const {
429 return hash<std::shared_ptr<cl::sycl::detail::program_impl>>()(