Program class C wrapper¶
Overview¶
// global functions DPCTL_API __dpctl_give DPCTLSyclProgramRef DPCTLProgram_CreateFromOCLSource( __dpctl_keep const DPCTLSyclContextRef Ctx, __dpctl_keep const char* Source, __dpctl_keep const char* CompileOpts ); DPCTL_API __dpctl_give DPCTLSyclProgramRef DPCTLProgram_CreateFromSpirv( __dpctl_keep const DPCTLSyclContextRef Ctx, __dpctl_keep const void* IL, size_t Length, const char* CompileOpts ); DPCTL_API void DPCTLProgram_Delete(__dpctl_take DPCTLSyclProgramRef PRef); DPCTL_API __dpctl_give DPCTLSyclKernelRef DPCTLProgram_GetKernel( __dpctl_keep DPCTLSyclProgramRef PRef, __dpctl_keep const char* KernelName ); DPCTL_API bool DPCTLProgram_HasKernel( __dpctl_keep DPCTLSyclProgramRef PRef, __dpctl_keep const char* KernelName );
Detailed Documentation¶
Global Functions¶
DPCTL_API __dpctl_give DPCTLSyclProgramRef DPCTLProgram_CreateFromOCLSource( __dpctl_keep const DPCTLSyclContextRef Ctx, __dpctl_keep const char* Source, __dpctl_keep const char* CompileOpts )
Create a Sycl program from an OpenCL kernel source string.
Parameters:
Ctx |
An opaque pointer to a sycl::context |
Source |
OpenCL source string |
CompileOpts |
Extra compiler flags (refer Sycl spec.) |
Returns:
A new SyclProgramRef pointer if the program creation succeeded, else returns NULL.
DPCTL_API __dpctl_give DPCTLSyclProgramRef DPCTLProgram_CreateFromSpirv( __dpctl_keep const DPCTLSyclContextRef Ctx, __dpctl_keep const void* IL, size_t Length, const char* CompileOpts )
Create a Sycl program from an OpenCL SPIR-V binary file.
Sycl 1.2 does not expose any method to create a sycl::program from a SPIR-V IL file. To get around this limitation, we first creare a SYCL interoperability program and then create a SYCL program from the interoperability program. Currently, interoperability programs can be created for OpenCL and Level-0 backends.
The feature to create a Sycl kernel from a SPIR-V IL binary will be available in Sycl 2.0 at which point this function may become deprecated.
Parameters:
Ctx |
An opaque pointer to a sycl::context |
IL |
SPIR-V binary |
Length |
The size of the IL binary in bytes. |
CompileOpts |
Optional compiler flags used when compiling the SPIR-V binary. |
Returns:
A new SyclProgramRef pointer if the program creation succeeded, else returns NULL.
DPCTL_API void DPCTLProgram_Delete(__dpctl_take DPCTLSyclProgramRef PRef)
Frees the DPCTLSyclProgramRef pointer.
Parameters:
PRef |
Opaque pointer to a sycl::program |
DPCTL_API __dpctl_give DPCTLSyclKernelRef DPCTLProgram_GetKernel( __dpctl_keep DPCTLSyclProgramRef PRef, __dpctl_keep const char* KernelName )
Returns the SyclKernel with given name from the program, if not found then return NULL.
Parameters:
PRef |
Opaque pointer to a sycl::program |
KernelName |
Name of kernel |
Returns:
A SyclKernel reference if the kernel exists, else NULL
DPCTL_API bool DPCTLProgram_HasKernel( __dpctl_keep DPCTLSyclProgramRef PRef, __dpctl_keep const char* KernelName )
Return True if a SyclKernel with given name exists in the program, if not found then returns False.
Parameters:
PRef |
Opaque pointer to a sycl::program |
KernelName |
Name of kernel |
Returns:
True if the kernel exists, else False