Skip to content

[SYCL][NFC] Make UR_CHECK_ERROR a void return macro #11100

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 5 commits into from
Sep 22, 2023

Conversation

jchlanda
Copy link
Contributor

@jchlanda jchlanda commented Sep 7, 2023

UR_CHECK_ERROR was designed to return ur_result_t, however in practice it was guaranteed to only ever return UR_RESULT_SUCCESS, as other paths would either terminate, abort or throw.

This in turns leads to poor quality/error prone code, as the codebase was littered with:

  • statements not checking the return value - depending on the compiler generating a warning,
  • extra check on the return which was only ever going to be true.

Some care was required, as the codebase has a habit of accumulating err codes across branches, so depending on the use case the initial value of ur_result_t Results had to be set accordingly (now that UR_CHECK_ERROR does not return).

@jchlanda jchlanda requested review from a team as code owners September 7, 2023 09:30
@jchlanda jchlanda requested a review from npmiller September 7, 2023 09:30
@jchlanda jchlanda force-pushed the jakub/check_erro_tidy_up branch 2 times, most recently from b6e8cc6 to 8fd9577 Compare September 7, 2023 09:48
Copy link
Contributor

@isaacault isaacault left a comment

Choose a reason for hiding this comment

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

Couple comments, nothing big. Only reviewed the CUDA adapter.

PR title as commit message might be confusing as checkErrorUR still returns ur_result_t in CUDA adapter. Is it possible to remove this confusion? Even if just by making the title more vague i.e. "checkErrorUR usage clean up".

@jchlanda jchlanda force-pushed the jakub/check_erro_tidy_up branch from 0d78f19 to ee378d6 Compare September 18, 2023 07:49
@jchlanda
Copy link
Contributor Author

Couple comments, nothing big. Only reviewed the CUDA adapter.

PR title as commit message might be confusing as checkErrorUR still returns ur_result_t in CUDA adapter. Is it possible to remove this confusion? Even if just by making the title more vague i.e. "checkErrorUR usage clean up".

My bad, I was thinking about UR_CHECK_ERROR macro, but somehow checkErrorUR got through my keyboard, fixed now.

@jchlanda jchlanda force-pushed the jakub/check_erro_tidy_up branch from 679e81f to 626e794 Compare September 18, 2023 08:01
@jchlanda jchlanda changed the title [SYCL][NFC] Make checkErrorUR a void return function [SYCL][NFC] Make UR_CHECK_ERROR a void return function Sep 18, 2023
@jchlanda jchlanda changed the title [SYCL][NFC] Make UR_CHECK_ERROR a void return function [SYCL][NFC] Make UR_CHECK_ERROR a void return macro Sep 18, 2023
Copy link
Contributor

@npmiller npmiller left a comment

Choose a reason for hiding this comment

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

LGTM!

`UR_CHECK_ERROR` was designed to return `ur_result_t`, however in
practice it was guaranteed to only ever return `UR_RESULT_SUCCESS`, as
other paths would either terminate, abort or throw.

This in turns leads to poor quality/error prone code, as the codebase
was littered with:
* statements not checking the return value - depending on the compiler
  generating a warning,
* extra check on the return which was only ever going to be true.

Some care was required, as the codebase has a habit of accumulating err
codes across branches, so depending on the use case the initial value of
`ur_result_t Result`s had to be set accordingly (now that
`UR_CHECK_ERROR` does not return).
@jchlanda jchlanda force-pushed the jakub/check_erro_tidy_up branch from b790a03 to f010abe Compare September 21, 2023 10:13
@jchlanda jchlanda temporarily deployed to WindowsCILock September 21, 2023 11:17 — with GitHub Actions Inactive
@jchlanda
Copy link
Contributor Author

@intel/llvm-gatekeepers I believe the windows CI failure is a know issue, could we pleas merge this in?

@steffenlarsen steffenlarsen merged commit c7d3c00 into intel:sycl Sep 22, 2023
@steffenlarsen
Copy link
Contributor

@jchlanda - It seems that post-commit fails after this patch. Could you please address this ASAP?

@jchlanda
Copy link
Contributor Author

@jchlanda - It seems that post-commit fails after this patch. Could you please address this ASAP?

@steffenlarsen are you referring to: https://github.com/intel/llvm/actions/runs/6260277405/job/17000492765?pr=11100#step:12:1154
If so, it might take a while, whit it being on windows, not sure what would be the best way forward?

@steffenlarsen
Copy link
Contributor

@jchlanda - It seems that post-commit fails after this patch. Could you please address this ASAP?

@steffenlarsen are you referring to: https://github.com/intel/llvm/actions/runs/6260277405/job/17000492765?pr=11100#step:12:1154 If so, it might take a while, whit it being on windows, not sure what would be the best way forward?

I am referring to https://github.com/intel/llvm/actions/runs/6271609325/job/17031531293. The failures you linked were unrelated.

@jchlanda
Copy link
Contributor Author

@jchlanda - It seems that post-commit fails after this patch. Could you please address this ASAP?

@steffenlarsen are you referring to: https://github.com/intel/llvm/actions/runs/6260277405/job/17000492765?pr=11100#step:12:1154 If so, it might take a while, whit it being on windows, not sure what would be the best way forward?

I am referring to https://github.com/intel/llvm/actions/runs/6271609325/job/17031531293. The failures you linked were unrelated.

@steffenlarsen, right, that is a whole lot easier, was dreading those windows assert tests. Please see: #11269

Also apologias for letting this one slip in.

@aelovikov-intel
Copy link
Contributor

We still have failures - see https://github.com/intel/llvm/actions/runs/6275414567

fabiomestre pushed a commit to fabiomestre/llvm that referenced this pull request Sep 26, 2023
`UR_CHECK_ERROR` was designed to return `ur_result_t`, however in
practice it was guaranteed to only ever return `UR_RESULT_SUCCESS`, as
other paths would either terminate, abort or throw.

This in turns leads to poor quality/error prone code, as the codebase
was littered with:
* statements not checking the return value - depending on the compiler
generating a warning,
* extra check on the return which was only ever going to be true.

Some care was required, as the codebase has a habit of accumulating err
codes across branches, so depending on the use case the initial value of
`ur_result_t Result`s had to be set accordingly (now that
`UR_CHECK_ERROR` does not return).
veselypeta pushed a commit to veselypeta/llvm that referenced this pull request Sep 28, 2023
`UR_CHECK_ERROR` was designed to return `ur_result_t`, however in
practice it was guaranteed to only ever return `UR_RESULT_SUCCESS`, as
other paths would either terminate, abort or throw.

This in turns leads to poor quality/error prone code, as the codebase
was littered with:
* statements not checking the return value - depending on the compiler
generating a warning,
* extra check on the return which was only ever going to be true.

Some care was required, as the codebase has a habit of accumulating err
codes across branches, so depending on the use case the initial value of
`ur_result_t Result`s had to be set accordingly (now that
`UR_CHECK_ERROR` does not return).
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.

7 participants