Skip to content

[SYCL] Implement more verbose error handling. #4013

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
merged 16 commits into from
Jul 10, 2021
Merged

Conversation

rbegam
Copy link
Contributor

@rbegam rbegam commented Jun 28, 2021

This ensures that no exception is silently ignored by sycl. This
also includes API names and error codes in the error messages.

Signed-off-by: rehana begam [email protected]

@rbegam rbegam requested review from smaslov-intel and a team as code owners June 28, 2021 19:45
This ensures that no exception is silently ignored by sycl. This
also includes API names and error codes in the error messages.

Signed-off-by: rehana begam <[email protected]>
Signed-off-by: rehana begam <[email protected]>
@smaslov-intel smaslov-intel requested a review from s-kanaev June 28, 2021 22:41
@smaslov-intel
Copy link
Contributor

includes API names and error codes in the error messages.

I am not sure it is a good idea to show PI API names to the user since they aren't documented anywhere.
Should we instead give the name of SYCL method where that fail occurs?

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.

LGTM if comments related to reportPIError are fixed.

smaslov-intel
smaslov-intel previously approved these changes Jul 8, 2021
@@ -362,7 +362,8 @@ void program_impl::create_cl_program_with_source(const std::string &Source) {
}

if (Err != PI_SUCCESS) {
Plugin.reportPiError(Err, "create_cl_program_with_source()");
std::string CallingFunction = "create_cl_program_with_source()";
Plugin.reportPiError(Err, CallingFunction);
Copy link
Contributor

Choose a reason for hiding this comment

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

what's wrong with prev version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there were compile errors as std::string & requires a lvalue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use std::string_view?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is kind of ugly that you cannot pass C-string directly, either use string_view or just "const char*"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. how about using std::string instead of std::string &? that will resolve the lvalue issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

This way there would be a copy made during the call. How about using "std::string &" but passing as string("bla-bla-bla")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this didn't work either. i am using const char*

@rbegam
Copy link
Contributor Author

rbegam commented Jul 9, 2021

@@ -362,7 +362,8 @@ void program_impl::create_cl_program_with_source(const std::string &Source) {
}

if (Err != PI_SUCCESS) {
Plugin.reportPiError(Err, "create_cl_program_with_source()");
std::string CallingFunction = "create_cl_program_with_source()";
Plugin.reportPiError(Err, CallingFunction);
Copy link
Contributor

Choose a reason for hiding this comment

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

it is kind of ugly that you cannot pass C-string directly, either use string_view or just "const char*"

@bader bader merged commit 84ee39a into intel:sycl Jul 10, 2021
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