Skip to content
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

[UR] Improve handling of error cases in urProgramLink #1458

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

RossBrunton
Copy link
Contributor

Note that this change includes a specification change: urProgramLink now requires the output parameter to contain either nullptr or some unspecified binary on failure.

As well as this change, a number of bugs have been fixed:

  • The Level Zero adapter now correctly returns UR_RESULT_ERROR_PROGRAM_LINK_FAILURE when linking fails, rather than UR_RESULT_ERROR_UNKNOWN.
  • A workaround has been added for some OpenCL devices that return CL_INVALID_BINARY rather than CL_LINK_PROGRAM_FAILURE on linker failure.
  • The phProgram handle is wrapped in a loader handle by the loader even if an error would be returned. This is required by Level Zero, which outputs a "dummy" program to store the linker log.

Conformance tests have also been added.

@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 0% with 59 lines in your changes are missing coverage. Please review.

Project coverage is 12.41%. Comparing base (78ef1ca) to head (da9d876).
Report is 190 commits behind head on main.

Files Patch % Lines
test/conformance/program/urProgramLink.cpp 0.00% 33 Missing ⚠️
source/loader/ur_ldrddi.cpp 0.00% 10 Missing ⚠️
source/adapters/null/ur_nullddi.cpp 0.00% 4 Missing ⚠️
source/loader/layers/tracing/ur_trcddi.cpp 0.00% 4 Missing ⚠️
source/loader/layers/validation/ur_valddi.cpp 0.00% 4 Missing ⚠️
source/loader/ur_libapi.cpp 0.00% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1458      +/-   ##
==========================================
- Coverage   14.82%   12.41%   -2.41%     
==========================================
  Files         250      241       -9     
  Lines       36220    36293      +73     
  Branches     4094     4124      +30     
==========================================
- Hits         5369     4506     -863     
- Misses      30800    31783     +983     
+ Partials       51        4      -47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RossBrunton RossBrunton force-pushed the ross/linkerror branch 2 times, most recently from da9d876 to 0922999 Compare March 21, 2024 11:04
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Mar 21, 2024
@RossBrunton RossBrunton marked this pull request as ready for review March 21, 2024 11:09
@RossBrunton RossBrunton requested review from a team as code owners March 21, 2024 11:09
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

HIP and CUDA changes LGTM. Just a few nits.

include/ur_api.h Outdated Show resolved Hide resolved
test/conformance/device_code/linker_error.cpp Show resolved Hide resolved
test/conformance/device_code/linker_error.cpp Show resolved Hide resolved
@RossBrunton RossBrunton marked this pull request as draft April 10, 2024 11:47
@kbenzie kbenzie added loader Loader related feature/bug conformance Conformance test suite issues. specification Changes or additions to the specification level-zero L0 adapter specific issues cuda CUDA adapter specific issues hip HIP adapter specific issues opencl OpenCL adapter specific issues native-cpu Native CPU adapter specific issues labels Apr 10, 2024
Copy link
Contributor

@nrspruit nrspruit left a comment

Choose a reason for hiding this comment

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

LGTM for level zero.

@RossBrunton RossBrunton force-pushed the ross/linkerror branch 2 times, most recently from 4f47751 to 8da2cf1 Compare May 22, 2024 10:48
@github-actions github-actions bot added the experimental Experimental feature additions/changes/specification label May 22, 2024
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request May 22, 2024
@RossBrunton RossBrunton marked this pull request as ready for review June 5, 2024 16:25
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Jun 5, 2024
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Jun 7, 2024
@kbenzie
Copy link
Contributor

kbenzie commented Jul 8, 2024

this has merged conflicts, please fix

@RossBrunton RossBrunton marked this pull request as draft July 8, 2024 14:08
@RossBrunton
Copy link
Contributor Author

this has merged conflicts, please fix

Unfortunately the job in intel/llvm#13085 is failing, so I'll need to look into that first when I get the chance.

@kbenzie
Copy link
Contributor

kbenzie commented Jul 8, 2024

this has merged conflicts, please fix

Unfortunately the job in intel/llvm#13085 is failing, so I'll need to look into that first when I get the chance.

I don't see how rebasing this PR requires investigation into the intel/llvm failures. Sure, to get it merged they would need to not fail but that shouldn't be a blocker for rebasing this PR.

RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Jul 9, 2024
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Jul 9, 2024
Note that this change includes a specification change:
urProgramLink now requires the output parameter to contain either
nullptr or some unspecified binary on failure.

As well as this change, a number of bugs have been fixed:
* The Level Zero adapter now correctly returns
  `UR_RESULT_ERROR_PROGRAM_LINK_FAILURE` when linking fails, rather
  than `UR_RESULT_ERROR_UNKNOWN`.
* A workaround has been added for some OpenCL devices that return
  `CL_INVALID_BINARY` rather than `CL_LINK_PROGRAM_FAILURE` on
  linker failure.
* The `phProgram` handle is wrapped in a loader handle by the
  loader even if an error would be returned. This is required by
  Level Zero, which outputs a "dummy" program to store the linker
  log.

Conformance tests have also been added.
RossBrunton added a commit to RossBrunton/intel-llvm that referenced this pull request Jul 9, 2024
Pre-commit PR for oneapi-src/unified-runtime#1458

The wrapper logic for urProgramLink has also been updated to handle
the change.
@RossBrunton RossBrunton marked this pull request as ready for review July 9, 2024 15:15
@kbenzie
Copy link
Contributor

kbenzie commented Jul 9, 2024

@oneapi-src/unified-runtime-native-cpu-write please review

Copy link
Contributor

@PietroGhg PietroGhg left a comment

Choose a reason for hiding this comment

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

lgtm, thank you

@kbenzie kbenzie added the ready to merge Added to PR's which are ready to merge label Jul 9, 2024
@kbenzie kbenzie merged commit 8cc2b87 into oneapi-src:main Jul 10, 2024
52 of 54 checks passed
martygrant pushed a commit to intel/llvm that referenced this pull request Jul 10, 2024
Pre-commit PR for
oneapi-src/unified-runtime#1458

---------

Co-authored-by: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conformance Conformance test suite issues. cuda CUDA adapter specific issues experimental Experimental feature additions/changes/specification hip HIP adapter specific issues level-zero L0 adapter specific issues loader Loader related feature/bug native-cpu Native CPU adapter specific issues opencl OpenCL adapter specific issues ready to merge Added to PR's which are ready to merge specification Changes or additions to the specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants