dpctl.program¶
dpctl.program provides a way to create a SYCL kernel
from an OpenCL* program source code represented as a string, SYCL
source code represented as a string, or a SPIR-V binary file.
It implements creation of interoperability
sycl::kernel_bundle<sycl::bundle_state_executable> (a collection of kernels),
as well as creation of individual sycl::kernel, suitable for submission for
execution via dpctl.SyclQueue.submit().
Creates a Sycl interoperability kernel bundle from an OpenCL source string. |
|
Creates a Sycl interoperability kernel bundle from an SPIR-V binary. |
|
Creates an executable SYCL kernel_bundle from SYCL source code. |
|
This function is a deprecated alias for |
|
This function is a deprecated alias for |
|
Returns True if dpctl was built with compiler that supports the DPC++ kernel_compiler extension API used by |
Wraps a |
|
Python class representing SYCL specialization constants that can be used when creating a |
This exception is raised when a |
dpctl.program.utils¶
- dpctl.program.utils.parse_spirv_specializations(spv_bytes: bytes | bytearray | memoryview) tuple[dpctl.program.utils._utils.SpecializationConstantInfo][source]¶
Parses SPIR-V byte stream to extract information about specializations, including the specialization IDs, types, names, and default values.
Note that the dtype information may be imprecise, as the compiler may choose to, for example, represent a bool as char, or may represent both signed and unsigned integers as unsigned integer bit buckets of the same length.
- Parameters:
spv_bytes (bytes | bytearray | memoryview) – the SPIR-V byte stream.
- Returns:
a tuple of parsed constants and their information represented by SpecializationConstantInfo objects, sorted by their specialization IDs. The length of the tuple is equal to the number of specialization constants found. Each SpecializationConstantInfo object contains the following attributes:
spec_id (int): The specialization ID.
dtype (str): A NumPy style string representing the data type.
- itemsize (int): The size of the specialization constant in
bytes.
- name (str): The variable name. If not preserved in the binary,
a default name in the format unnamed_spec_const_{spec_id} is used.
- default_value (int | float | bool | None): The default value of
the specialization constant. If not specified, None is used.
- Return type: