Support SYCL source compilation#2206
Conversation
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/2206/index.html |
|
Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_65 ran successfully. |
|
Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_66 ran successfully. |
9d64cb8 to
22475d9
Compare
|
Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_104 ran successfully. |
75969ce to
be75a7e
Compare
cf56032 to
7a58ef7
Compare
43d385b to
788fdd2
Compare
788fdd2 to
4656feb
Compare
b610ee3 to
dd74214
Compare
4656feb to
cae6959
Compare
cfe7f1f to
417c4a0
Compare
Enable SYCL source compilation, but only for DPC++ versions that actually support the compilation, based on the __SYCL_COMPILER_VERSION reported. Uses the correct naming for the property based on DPC++ version, detected through C++ type traits to check which property actually refers to a fully defined type. This commit also works around a bug in DPC++ version 2025.1. The constructor with no parameter of class `include_files` was only declared, but never defined. Calling it when creating a SYCL source kernel bundle therefore leads to references to undefined symbols with DPC++ version 2025.1. This change works around this issue by calling an alternative constructor, which is defined in the release. Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
417c4a0 to
ece9fa0
Compare
| :class:`.SyclKernelBundle` is going to be built. | ||
| source (unicode) | ||
| SYCL source code string. | ||
| headers (list) |
There was a problem hiding this comment.
According to the description below, it should be headers (list, optional), right?
| documentation of the ``registered_names`` property in the DPC++ | ||
| ``kernel_compiler`` extension for more information. | ||
| Default: [] | ||
| copts (list) |
| cdef bytes bContent | ||
| cdef const char* sContent | ||
| cdef const char* buildLogContent | ||
| for opt in copts: |
There was a problem hiding this comment.
This fails when copts is None (the default value)
dpctl.program.create_kernel_bundle_from_sycl_source(q, sycl_source)
# out : TypeError: 'NoneType' object is not iterable.
There was a problem hiding this comment.
Since this is repeated in the loops below, it make sense to add something like:
if copts is None:
copts = []
if registered_names is None:
registered_names = []
if headers is None:
headers = []
| DPCTLBuildOptionList_Append(BuildOpts, sOpt) | ||
|
|
||
| cdef DPCTLKernelNameListRef KernelNames = DPCTLKernelNameList_Create() | ||
| for name in registered_names: |
| cdef DPCTLVirtualHeaderListRef VirtualHeaders | ||
| VirtualHeaders = DPCTLVirtualHeaderList_Create() | ||
|
|
||
| for name, content in headers: |
| __dpctl_keep const DPCTLSyclContextRef Ctx, | ||
| __dpctl_keep const DPCTLSyclDeviceRef Dev, | ||
| __dpctl_keep const char *Source, | ||
| __dpctl_keep DPCTLVirtualHeaderListRef Headers, | ||
| __dpctl_keep DPCTLKernelNameListRef Names, | ||
| __dpctl_keep DPCTLBuildOptionListRef BuildOptions, | ||
| __dpctl_keep DPCTLKernelBuildLogRef BuildLog) |
There was a problem hiding this comment.
Can any of these parameters be nullptr?
If so , should we add a nullptr check below?
| DPCTLBuildOptionList_Delete(BuildOpts) | ||
| DPCTLKernelNameList_Delete(KernelNames) | ||
| DPCTLVirtualHeaderList_Delete(VirtualHeaders) | ||
| DPCTLKernelBuildLog_Delete(BuildLog) | ||
|
|
There was a problem hiding this comment.
This may leak if an unexpected exception is raised earlier
|
|
||
| create_kernel_bundle_from_source | ||
| create_kernel_bundle_from_spirv | ||
| create_kernel_bundle_from_sycl_source |
There was a problem hiding this comment.
is_sycl_source_compilation_available is missing
| Optional list of kernel names to register. See the | ||
| documentation of the ``registered_names`` property in the DPC++ | ||
| ``kernel_compiler`` extension for more information. | ||
| Default: [] |
There was a problem hiding this comment.
The default value is None
This PR adds support for creating an executable
kernel_bundlefrom SYCL source code todpctlusing thekernel_compilerDPC++ extensionSupersedes gh-2049