.. index:: pair: group; Program class C wrapper .. _doxid-d3/d4f/group__ProgramInterface: Program class C wrapper ======================= .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block // global functions DPCTL_API __dpctl_give :ref:`DPCTLSyclProgramRef` :ref:`DPCTLProgram_CreateFromOCLSource`( __dpctl_keep const :ref:`DPCTLSyclContextRef` Ctx, __dpctl_keep const char* Source, __dpctl_keep const char* CompileOpts ); DPCTL_API __dpctl_give :ref:`DPCTLSyclProgramRef` :ref:`DPCTLProgram_CreateFromSpirv`( __dpctl_keep const :ref:`DPCTLSyclContextRef` Ctx, __dpctl_keep const void* IL, size_t Length, const char* CompileOpts ); DPCTL_API void :ref:`DPCTLProgram_Delete`(__dpctl_take :ref:`DPCTLSyclProgramRef` PRef); DPCTL_API __dpctl_give :ref:`DPCTLSyclKernelRef` :ref:`DPCTLProgram_GetKernel`( __dpctl_keep :ref:`DPCTLSyclProgramRef` PRef, __dpctl_keep const char* KernelName ); DPCTL_API bool :ref:`DPCTLProgram_HasKernel`( __dpctl_keep :ref:`DPCTLSyclProgramRef` PRef, __dpctl_keep const char* KernelName ); .. _details-d3/d4f/group__ProgramInterface: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Functions ---------------- .. index:: pair: function; DPCTLProgram_CreateFromOCLSource .. _doxid-d3/d4f/group__ProgramInterface_1gae1f8caf6c9bb8d8683b3717f63e56ae7: .. ref-code-block:: cpp :class: doxyrest-title-code-block DPCTL_API __dpctl_give :ref:`DPCTLSyclProgramRef` DPCTLProgram_CreateFromOCLSource( __dpctl_keep const :ref:`DPCTLSyclContextRef` Ctx, __dpctl_keep const char* Source, __dpctl_keep const char* CompileOpts ) Create a Sycl program from an OpenCL kernel source string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Ctx - An opaque pointer to a sycl::context * - Source - OpenCL source string * - CompileOpts - Extra compiler flags (refer Sycl spec.) .. rubric:: Returns: A new SyclProgramRef pointer if the program creation succeeded, else returns NULL. .. index:: pair: function; DPCTLProgram_CreateFromSpirv .. _doxid-d3/d4f/group__ProgramInterface_1gade20300fcd7d69bdb6ae7cad54ee0f78: .. ref-code-block:: cpp :class: doxyrest-title-code-block DPCTL_API __dpctl_give :ref:`DPCTLSyclProgramRef` DPCTLProgram_CreateFromSpirv( __dpctl_keep const :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. .. rubric:: Returns: A new SyclProgramRef pointer if the program creation succeeded, else returns NULL. .. index:: pair: function; DPCTLProgram_Delete .. _doxid-d3/d4f/group__ProgramInterface_1ga29760f4984675c264bbdf11b92b89c08: .. ref-code-block:: cpp :class: doxyrest-title-code-block DPCTL_API void DPCTLProgram_Delete(__dpctl_take :ref:`DPCTLSyclProgramRef` PRef) Frees the DPCTLSyclProgramRef pointer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - PRef - Opaque pointer to a sycl::program .. index:: pair: function; DPCTLProgram_GetKernel .. _doxid-d3/d4f/group__ProgramInterface_1ga86fcd9c7af5bc38a056e237c89b3fa9c: .. ref-code-block:: cpp :class: doxyrest-title-code-block DPCTL_API __dpctl_give :ref:`DPCTLSyclKernelRef` DPCTLProgram_GetKernel( __dpctl_keep :ref:`DPCTLSyclProgramRef` PRef, __dpctl_keep const char* KernelName ) Returns the SyclKernel with given name from the program, if not found then return NULL. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - PRef - Opaque pointer to a sycl::program * - KernelName - Name of kernel .. rubric:: Returns: A SyclKernel reference if the kernel exists, else NULL .. index:: pair: function; DPCTLProgram_HasKernel .. _doxid-d3/d4f/group__ProgramInterface_1ga9c266676f09dd0ed681adfe2d6b1ff06: .. ref-code-block:: cpp :class: doxyrest-title-code-block DPCTL_API bool DPCTLProgram_HasKernel( __dpctl_keep :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - PRef - Opaque pointer to a sycl::program * - KernelName - Name of kernel .. rubric:: Returns: True if the kernel exists, else False