20 program::program(
const context &context,
const property_list &PropList)
21 : impl(
std::make_shared<detail::program_impl>(
24 program::program(
const context &context, std::vector<device> deviceList,
25 const property_list &PropList)
26 : impl(
std::make_shared<detail::program_impl>(
29 program::program(std::vector<program> programList,
30 const property_list &PropList)
31 : program(
std::move(programList),
"", PropList) {}
33 program::program(std::vector<program> programList, std::string linkOptions,
34 const property_list &PropList) {
35 std::vector<std::shared_ptr<detail::program_impl>> impls;
36 for (
auto &x : programList) {
39 impl = std::make_shared<detail::program_impl>(impls, linkOptions, PropList);
42 program::program(
const context &context, cl_program clProgram)
43 : impl(
std::make_shared<detail::program_impl>(
48 clRetainProgram(clProgram);
55 program::program(std::shared_ptr<detail::program_impl> impl) : impl(impl) {}
59 bool program::is_host()
const {
return impl->is_host(); }
61 void program::compile_with_source(std::string kernelSource,
62 std::string compileOptions) {
63 impl->compile_with_source(kernelSource, compileOptions);
66 void program::build_with_source(std::string kernelSource,
67 std::string buildOptions) {
68 impl->build_with_source(kernelSource, buildOptions);
71 void program::compile_with_kernel_name(std::string KernelName,
72 std::string compileOptions,
74 impl->compile_with_kernel_name(KernelName, compileOptions, M);
77 void program::build_with_kernel_name(std::string KernelName,
78 std::string buildOptions,
80 impl->build_with_kernel_name(KernelName, buildOptions, M);
83 void program::link(std::string linkOptions) { impl->link(linkOptions); }
85 bool program::has_kernel(std::string kernelName)
const {
86 return has_kernel(kernelName,
true);
89 bool program::has_kernel(std::string kernelName,
90 bool IsCreatedFromSource)
const {
91 return impl->has_kernel(kernelName, IsCreatedFromSource);
94 kernel program::get_kernel(std::string kernelName)
const {
95 return get_kernel(kernelName,
true);
98 kernel program::get_kernel(std::string kernelName,
99 bool IsCreatedFromSource)
const {
100 return impl->get_kernel(kernelName, impl, IsCreatedFromSource);
103 template <info::program param>
104 typename info::param_traits<info::program, param>::return_type
105 program::get_info()
const {
106 return impl->get_info<param>();
109 #define __SYCL_PARAM_TRAITS_SPEC(param_type, param, ret_type) \
110 template __SYCL_EXPORT ret_type program::get_info<info::param_type::param>() \
113 #include <CL/sycl/info/program_traits.def>
115 #undef __SYCL_PARAM_TRAITS_SPEC
117 #define __SYCL_PARAM_TRAITS_SPEC(param_type) \
118 template <> __SYCL_EXPORT bool program::has_property<param_type>() const { \
119 return impl->has_property<param_type>(); \
121 #include <CL/sycl/detail/properties_traits.def>
123 #undef __SYCL_PARAM_TRAITS_SPEC
125 #define __SYCL_PARAM_TRAITS_SPEC(param_type) \
127 __SYCL_EXPORT param_type program::get_property<param_type>() const { \
128 return impl->get_property<param_type>(); \
130 #include <CL/sycl/detail/properties_traits.def>
132 #undef __SYCL_PARAM_TRAITS_SPEC
134 std::vector<std::vector<char>> program::get_binaries()
const {
135 return impl->get_binaries();
138 context program::get_context()
const {
return impl->get_context(); }
140 std::vector<device> program::get_devices()
const {
return impl->get_devices(); }
142 std::string program::get_compile_options()
const {
143 return impl->get_compile_options();
146 std::string program::get_link_options()
const {
147 return impl->get_link_options();
150 std::string program::get_build_options()
const {
151 return impl->get_build_options();
154 program_state program::get_state()
const {
return impl->get_state(); }
156 void program::set_spec_constant_impl(
const char *Name,
void *Data,
158 impl->set_spec_constant_impl(Name, Data, Size);