-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] PI interface. #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] PI interface. #208
Conversation
Signed-off-by: Vlad Romanov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The concept is super useful.
We need this to have SYCL more general!
But SYCL is about modern C++ and reimplementing a C-like ICD in SYCL seems not like the right abstraction in 2019. OpenCL is written in C with its limitations...
You are reimplementing dynamic polymorphism in C while it is already available in C++.
An alternative approach can be to have the SYCL implementation classes inheriting from some more or less abstract classes and the SYCL runtime can just use transparently a launch kernel virtual member function of the device class to redirect to the actual kernel launch.
The ICD C-like method does not solve well the adaptation problem because it forces at the first place to encapsulate any runtime (even when written in C++!) to the same low-level C method...
I planned to come with an example of this in triSYCL about using dynamic polymorphism for these extensions triSYCL/triSYCL#237 but we are late... I made some presentation in the SYCL committee with some ideas and in triSYCL there is already the use of dynamic polymorphism but without the ability to inject different runtime on the fly yet...
Your plug-in mechanism can be a class inheriting from the runtime interface and implementing various operations or customization points.
A multilayered abstraction seems better suited than going directly down to the metal, because probably some SYCL implementation parts will be common to some classes of devices or API (for example some devices require eager buffer allocation, other lazy late allocation, and this does not fit well is a low-level only approach).
uint16_t Version; | ||
/// the kind of offload model the image employs; must be 4 for SYCL | ||
uint8_t Kind; | ||
/// format of the image data - SPIRV, LLVMIR bitcode,... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks to me like the start of the idea of a virtual table... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is how C-interface implements it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please review #222 and leave any further comments there.
pi_device_image **selected_image) { | ||
// TODO dummy implementation. | ||
// Real implementaion will use the same mechanism OpenCL ICD dispatcher | ||
// uses. Somthing like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be kidding, I guess... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenCL ICD exists just because it is implemented in C according to 1970's techniques...
SYCL is about modern C++...
Your method can work actually, just by reusing the OpenCL ICD or the OpenCL intercepting layer from Intel.
But then do it there, not inside the SYCL implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment moved to #222 for any further discussion there.
Hi Ronan, Thank you for your comments! We had to completely rework the patch, new patch is here #222. Some of your |
Signed-off-by: Vlad Romanov [email protected]