My question is if there is a way to call a function within the kernel with its parameters and if this is not possible, what options would be available to successfully do this?
I have toyed around with the idea of stripping the function down to its barebones and running that through the kernel though I do not know of that approach would work.
Any advice would be greatly appreciated.
Thanks for reaching out to us.
Yes, you can call a function within the kernel. SYCL supports multiple ways to express a kernel.
You can create a function within the source code and can access that inside the kernel or create a function in different file and include that file in your main program and then call the function inside a kernel with proper arguments.
There is also another way where you can call a function from within the kernel is by using “Interoperability with API-Defined Source Languages or kernel objects” which means , the contents of the kernel are described as source code or using an intermediate representation that is not defined by SYCL, but the kernel objects are still created using SYCL API calls.
Please follow the below link in which you can get a clear idea on different ways of calling a function inside kernel and some samples are also provided on how to call a function from within the kernel.
Let us know if it helps.
As we have not heard back from you, we assume that your issue has been resolved. We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.