63 | 65 | source code for a kernel, which it can then compile and enqueue to a device. | |
64 | The APIs allow a kernel to be written in any of several possible languages, | ||
65 | where support for each of these languages is defined by a separate extension. | ||
66 | As a result, this extension provides a framework of APIs for online compilation | ||
67 | of kernels, but it does not define the details for any specific kernel language. | ||
68 | These details are provided by other extensions. | ||
66 | This extension provides support for kernels written in SYCL according to the | ||
67 | "free function kernel" syntax defined in | ||
68 | link:../proposed/sycl_ext_oneapi_free_function_kernels.asciidoc[ |
Is this available somewhere?
No, it's not implemented yet. I expect that we will implement that extension at the same time as the new additions to "sycl_ext_oneapi_kernel_compiler" that are described in this PR.
Runtime compilation is an urgently needed feature of SYCL in project development. Thanks for your specification. Also out of curiosity, may the kernel compiler support using inline PTX assembly in SYCL kernel? opencl example. Inline Assembly makes rich low-level hardware features available to programmers.
Runtime compilation is an urgently needed feature of SYCL in project development. Thanks for your specification. Also out of curiosity, may the kernel compiler support using inline PTX assembly in SYCL kernel? opencl example. Inline Assembly makes rich low-level hardware features available to programmers.
Hi @DongBaiYue, I think this is not strongly related to this extension. Runtime compilation should work for kernels that use any of the SYCL features that available in normal kernels. I'm not sure if normal SYCL kernels can contain PTX assembly, but @AerialMantis might know.
Attention reviewers: I do not plan any more changes to this PR. If you have more comments, please make them soon.
Marking this PR as "draft" only to prevent it from being merged until after these new APIs have been implemented.
This is a new process I'm trying out for cases where we make proposed changes to an extension specification that is already implemented. When these new changes are implemented, we can merge this PR. That way, the extension specification in the repo will always reflect what is currently implemented.
329 | include_files(const std::string &name, const std::string &content); (1) | ||
330 | include_files(const std::vector<std::string> &names, (2) | ||
331 | const std::vector<std::string> &contents); | ||
332 | }; |
I have some reservations about this include_files struct.
We know for the first implementation that we are likely going to have to write out a temporary .cpp file and invoke clang++ -fsycl
on it. So now we have to also write out the include files? What about #include "path/to/file.h"
? Will we then be parsing this and instantiating directories?
I presume we need to disambiguate #include "local/path.h"
from #include <system/path.h>
?
Users can't link in libraries ( even if has a header ), and there is only the one TU. Supporting #include
suggests the opposite. Maybe a note proscribing it is needed?
I do see the value in that if a user has a simple function that they want to both use in the host application and call from their kernel, this allows them to do so. And, if clang were to ever have an invocation API (like ocloc) then I guess this aligns with that.
One of the reasons we added the include_files
property is for parity with CUDA, which has a similar feature in NVRTC. By adding the feature to SYCL, we make it easier to migrate code automatically using the SYCLomatic tool.
I was thinking that our implementation could create a temporary "include" directory and then write out the include_files
header files into that directory. When we invoke clang, we can add a -I
switch pointing at the temporary include directory.
Note that you don't need to parse any #include
strings from the source code to get the file name paths. The include_files
properties contains a list of (Name, Content) pairs. Each Name is the relative pathname of an include file, so you can just use this Name string verbatim.
Just some minor questions to make sure the extension is robust. Looking really good already
Thanks for the careful review! See responses below.
Current text looks good to me 👍
This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be automatically closed in 30 days.
Merging this extension, as the core functionality is implemented now that #17032 has been merged.
Smaller tweaks to API naming and implementation-specific notes will be added through follow-up PRs.
Login to write a write a comment.
Update the proposed specification for the kernel compiler to allow
kernels to be written in the SYCL language, using the new proposed
"free function kernel" format.
This PR also adds some more features to the kernel compiler for
parity with cuda's nvrtc.