dpctl.program¶
Data Parallel Control Program
dpctl.program module provides a way to create a SYCL kernel from either a source string or SPIR-V binary file.
Classes¶
-
class
dpctl.program.SyclKernel¶ -
addressof_ref()¶ Returns the address of the C API
DPCTLSyclKernelRefpointer as asize_t.- Returns
The address of the
DPCTLSyclKernelRefpointer used to create thisdpctl.SyclKernelobject cast to asize_t.
-
get_function_name()¶ Returns the name of the
sycl::kernelfunction.
-
get_num_args()¶ Returns the number of arguments for this kernel function.
-
-
class
dpctl.program.SyclProgram¶ Wraps a
sycl::programobject created from an OpenCL interoperability program.SyclProgram exposes the C API from
dpctl_sycl_program_interface.h. A SyclProgram can be created from either a source string or a SPIR-V binary file.-
addressof_ref()¶ Returns the address of the C API DPCTLSyclProgramRef pointer as a long.
- Returns
The address of the
DPCTLSyclProgramRefpointer used to create thisdpctl.SyclProgramobject cast to asize_t.
-
get_sycl_kernel()¶
-
has_sycl_kernel()¶
-
Exceptions¶
-
exception
dpctl.program.SyclProgramCompilationError¶ This exception is raised when a
sycl::programcould not be built from either a SPIR-V binary file or a string source.
Functions¶
-
dpctl.program.create_program_from_source()¶ Creates a Sycl interoperability program from an OpenCL source string.
We use the
DPCTLProgram_CreateFromOCLSource()C API function to create asycl::programfrom an OpenCL source program that can contain multiple kernels. Note currently only supported for OpenCL.- Parameters
q (SyclQueue) – The
SyclQueuefor which theSyclProgramis going to be built.src (unicode) – Source string for an OpenCL program.
copts (unicode) – Optional compilation flags that will be used when compiling the program.
- Returns
A
SyclProgramobject wrapping thesycl::programreturned by the C API.- Return type
program (SyclProgram)
- Raises
SyclProgramCompilationError – If a SYCL program could not be created.
-
dpctl.program.create_program_from_spirv()¶ Creates a Sycl interoperability program from an SPIR-V binary.
We use the
DPCTLProgram_CreateFromOCLSpirv()C API function to create asycl::programobject from an compiled SPIR-V binary file.- Parameters
q (SyclQueue) – The
SyclQueuefor which theSyclProgramis going to be built.(const char[ (IL) – ]) : SPIR-V binary IL file for an OpenCL program.
copts (unicode) – Optional compilation flags that will be used when compiling the program.
- Returns
A
SyclProgramobject wrapping thesycl::programreturned by the C API.- Return type
program (SyclProgram)
- Raises
SyclProgramCompilationError – If a SYCL program could not be created.