Skip to content

[SYCL] Split invalid work-group size error handling #1216

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

Merged

Conversation

steffenlarsen
Copy link
Contributor

The current error handling for PI_INVALID_WORK_GROUP_SIZE is very specific to OpenCL.

This PR splits the error handling of PI_INVALID_WORK_GROUP_SIZE into an OpenCL specific handler function and a general one that is used if the BE is not OpenCL.

Signed-off-by: Steffen Larsen [email protected]

@bader bader requested review from garimagu and AlexeySachkov and removed request for garimagu March 2, 2020 11:09
garimagu
garimagu previously approved these changes Mar 2, 2020
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

Sorry, one more nitpick

@steffenlarsen steffenlarsen force-pushed the steffen/invalid-wg-size-handling branch from 653723d to c1a11f9 Compare March 4, 2020 17:28
@bader bader merged commit 38b321a into intel:sycl Mar 6, 2020
@AlexeySachkov
Copy link
Contributor

The current error handling for PI_INVALID_WORK_GROUP_SIZE is very specific to OpenCL.

We had a discussion with @alexbatashev related to this in #860, a quick recap:

@AlexeySachkov I have a more general question. This WG size logic is valid for OpenCL. But PI does not require you to have an OpenCL backend. And these checks may become invalid. Should we delegate such logic to plugins, so that every plugin implements its very own rules

Fair enough, but at this point I don't see a clear way how this can be achieved:

  • There is no special spec for PI: I was told to assume that each PI call that has OpenCL equivalent should behave in this manner. (If this is not true, please correct me)
  • If I understand correctly, PI has C interface, not C++. So, verbose exceptions I generated, cannot cross the border between PI plugin and SYCL RT
  • Any PI plugin routine might be called from different places and contexts and it might be not always clear which error to report or whenever to report error at all: some unusual error checking might be required. (speculating here, don't have actual examples)

Tagging @smaslov-intel here

My current understanding is that each PI call that has OpenCL equivalent should behave in this manner and therefore, there cannot be too OpenCL-specific error handling. Note: mine understanding might not be correct and I've already tried to reach @smaslov-intel to confirm it, but unsuccessfully so far.

I just trying to understand whether we really need to some infrastructure for per-plugin error handling or we just need to be sure that behavior of all plugins is aligned to some common denominator (for example, OpenCL spec or some special document for Plugin Interface)

@steffenlarsen
Copy link
Contributor Author

Another option is to expand the repertoire of failures, so in addition to PI_INVALID_WORK_GROUP_SIZE have e.g. PI_NON_UNIFORM_WORK_GROUP_SIZE that can be used when devices don't allow non-uniform work group sizes. The failing enqueue kernel call will then have to determine which of these are the cause of their failure, thus keeping it in the backend.

Many of these will of course be somewhat backend and/or device specific, and to some extent the error messages will bloat slightly, but the error handling won't appear BE specific nor will we need a PI call for handling this error.

@steffenlarsen
Copy link
Contributor Author

Note that PI_NON_UNIFORM_WORK_GROUP_SIZE was just an example based on the first failure I found in the OpenCL version of the handler function. There would of course be plenty others.

@smaslov-intel
Copy link
Contributor

My current understanding is that each PI call that has OpenCL equivalent should behave in this manner

Yes, this is the default assumption. Everything that diverges from that should be documented in PI API. But we should be open to adjust PI API behavior, and offload some of the functionalities to plugins, where it really makes sense.

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.

6 participants