Skip to content

Conversation

AlexeySachkov
Copy link
Contributor

With sycl_ext_oneapi_virtual_functions extensions we would like to allow certain kernels to perform virtual function calls. That is if they were submitted with the right properties.

That means that instead of simply checking for presence of virtual function calls in device code, we need to analyze call chain to see how exactly a kernel performing such call is defined.

This is not a task for the front-end and therefore the diagnostics mechanism is moved to a pass, as suggested by the implementation design proposed in #10540

With `sycl_ext_oneapi_virtual_functions` extensions we would like to
allow certain kernels to perform virtual function calls. That is if they
were submitted with the right properties.

That means that instead of simply checking for presence of virtual
function calls in device code, we need to analyze call chain to see how
exactly a kernel performing such call is defined.

This is not a task for the front-end and therefore the diagnostics
mechanism is moved to a pass, as suggested by the implementation design
proposed in intel#10540
AlexeySachkov added a commit that referenced this pull request Jul 12, 2024
This commit is a part of virtual functions extension implementation that
is proposed in #10540.

As part of the feature, we would like to achieve both:
- allow virtual function calls from SYCL kernels that are submitted with
the right properties as described in the language extension
specification
- disallow virtual function calls from SYCL kernels that do not use any
(or the right) properties to conform with the core SYCL 2020
specification

Implementing such diagnostics will require call graph traversal to
understand the origin of the call and that is not what's easy to do in
FE. Therefore, the implementation design for virtual functions proposes
that such diagnostic is offloaded to a pass. The draft of the analysis
pass implementation can be seen in #14141

This commit is a preparations for it: it introduces an attribute to all
virtual function calls in device code so they can be easily detected and
not confused with plain function pointer calls (for which we don't have
a language specification and therefore well-defined behavior yet).

Note that the new approach will relax virtual function call diagnostics,
because it will allow non-virtual calls to virtual functions to be
performed from kernels. This is in line with discussion in
KhronosGroup/SYCL-Docs#565 about relaxing current SYCL 2020 restrictions
about virtual functions.
@AlexeySachkov AlexeySachkov marked this pull request as ready for review July 16, 2024 11:59
@AlexeySachkov AlexeySachkov requested review from a team as code owners July 16, 2024 11:59
Copy link
Contributor

@sarnex sarnex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just minor comments!

Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@AlexeySachkov AlexeySachkov merged commit ea2111c into intel:sycl Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants