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 DPCTLSyclKernelRef pointer as a size_t.
- Returns
The address of the DPCTLSyclKernelRef object used to create this SyclKernel cast to a size_t.
-
get_function_name
()¶ Returns the name of the Kernel function.
-
get_num_args
()¶ Returns the number of arguments for this kernel function.
-
-
class
dpctl.program.
SyclProgram
¶ Wraps a sycl::program object 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 DPCTLSyclProgramRef object used to create this SyclProgram cast to a long.
-
get_sycl_kernel
()¶
-
has_sycl_kernel
()¶
-
Exceptions¶
-
exception
dpctl.program.
SyclProgramCompilationError
¶ This exception is raised when a SYCL program could 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 a Sycl progrma from an OpenCL source program that can contain multiple kernels. Note currently only supported for OpenCL.
- Parameters
q (SyclQueue) – The
SyclQueue
for which theSyclProgram
is 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
SyclProgram
object wrapping the sycl::program returned 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 a Sycl progrma from an compiled SPIR-V binary file.
- Parameters
q (SyclQueue) – The
SyclQueue
for which theSyclProgram
is 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
SyclProgram
object wrapping the sycl::program returned by the C API.- Return type
program (SyclProgram)
- Raises
SyclProgramCompilationError – If a SYCL program could not be created.