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

[SPEC] Add urProgramGetGlobalVariablePointer entrypoint #1255

Merged

Conversation

fabiomestre
Copy link
Contributor

@fabiomestre fabiomestre commented Jan 16, 2024

  • Adds new entrypoint urProgramGetGlobalVariablePointer.
  • Adds conformance tests for the new entrypoint.
  • Adds OpenCL, CUDA, HIP and Level Zero implementations for urProgramGetGlobalVariablePointer
  • Fixes existing testing urEnqueueDeviceGetGlobalVariableRead by adding the required metadata and sycl properties to the kernel.

intel/llvm#12496

Closes: #1214

@fabiomestre fabiomestre force-pushed the fabio/add_global_variable_pointer branch from bb3aea9 to 716f0bc Compare January 16, 2024 14:42
@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2024

Codecov Report

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

Project coverage is 12.47%. Comparing base (78ef1ca) to head (6297b7f).
Report is 151 commits behind head on main.

Files Patch % Lines
include/ur_print.hpp 0.00% 32 Missing ⚠️
...ance/program/urProgramGetGlobalVariablePointer.cpp 0.00% 23 Missing ⚠️
source/loader/layers/validation/ur_valddi.cpp 12.50% 21 Missing ⚠️
source/loader/layers/tracing/ur_trcddi.cpp 23.07% 10 Missing ⚠️
source/loader/ur_ldrddi.cpp 9.09% 10 Missing ⚠️
source/loader/ur_libapi.cpp 0.00% 8 Missing ⚠️
test/conformance/testing/include/uur/fixtures.h 0.00% 8 Missing ⚠️
source/adapters/null/ur_nullddi.cpp 12.50% 7 Missing ⚠️
source/loader/ur_print.cpp 0.00% 4 Missing ⚠️
test/conformance/source/environment.cpp 0.00% 4 Missing ⚠️
... and 1 more

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1255      +/-   ##
==========================================
- Coverage   14.82%   12.47%   -2.36%     
==========================================
  Files         250      240      -10     
  Lines       36220    36126      -94     
  Branches     4094     4097       +3     
==========================================
- Hits         5369     4506     -863     
- Misses      30800    31616     +816     
+ Partials       51        4      -47     

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

@fabiomestre fabiomestre force-pushed the fabio/add_global_variable_pointer branch 7 times, most recently from f5e3493 to 0fc432c Compare January 16, 2024 21:41
@fabiomestre fabiomestre marked this pull request as ready for review January 16, 2024 21:42
@fabiomestre fabiomestre requested review from a team as code owners January 16, 2024 21:42
Copy link
Contributor

@hdelan hdelan left a comment

Choose a reason for hiding this comment

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

Thanks for changes. CUDA/HIP adapters LGTM

@fabiomestre fabiomestre force-pushed the fabio/add_global_variable_pointer branch from 15bc0e9 to 7d5ad11 Compare January 22, 2024 13:33
@fabiomestre
Copy link
Contributor Author

Gentle ping for reviews from @oneapi-src/unified-runtime-maintain / @oneapi-src/unified-runtime-opencl-write / @oneapi-src/unified-runtime-level-zero-write

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

CLContext, cl_ext::ExtFuncPtrCache->clGetDeviceGlobalVariablePointerCache,
cl_ext::GetDeviceGlobalVariablePointerName, &FuncT));

if (!FuncT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this already gets checked in getExtFuncFromContext

Comment on lines 12 to 13
TEST_P(urProgramGetGlobalVariablePointerTest, Success) {

size_t global_variable_size = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TEST_P(urProgramGetGlobalVariablePointerTest, Success) {
size_t global_variable_size = 0;
TEST_P(urProgramGetGlobalVariablePointerTest, Success) {
size_t global_variable_size = 0;

@fabiomestre fabiomestre added ready to merge Added to PR's which are ready to merge and removed ready to merge Added to PR's which are ready to merge labels Jan 25, 2024
@fabiomestre fabiomestre force-pushed the fabio/add_global_variable_pointer branch from be161f2 to f7bf99b Compare January 25, 2024 17:08
@fabiomestre fabiomestre added the ready to merge Added to PR's which are ready to merge label Jan 29, 2024
@zhaomaosu
Copy link
Contributor

Hi, when can this PR be merged? We're implementing device sanitizer related features, and this new API can simplify our design.

@kbenzie
Copy link
Contributor

kbenzie commented Feb 23, 2024

@fabiomestre could you pull in the latest changes from main and resolve the conflicts?

@fabiomestre fabiomestre force-pushed the fabio/add_global_variable_pointer branch from 2f52e17 to 27ce154 Compare February 23, 2024 13:50
@fabiomestre
Copy link
Contributor Author

@fabiomestre could you pull in the latest changes from main and resolve the conflicts?

I have rebased and re-run the end to end tests. There is some failures there but it seems that's because the upstream branch is broken at the moment.

@kbenzie
Copy link
Contributor

kbenzie commented Feb 26, 2024

To actually use this in the SYCL RT there should also be a piextProgramGetGlobalVariablePointer which calls urProgramGetGlobalVariablePointer otherwise this will be unusable there.

@fabiomestre
Copy link
Contributor Author

To actually use this in the SYCL RT there should also be a piextProgramGetGlobalVariablePointer which calls urProgramGetGlobalVariablePointer otherwise this will be unusable there.

Yes, I forgot about the SYCL RT side. I will update the intel-llvm PR with the new pi entrypoint

@fabiomestre
Copy link
Contributor Author

To actually use this in the SYCL RT there should also be a piextProgramGetGlobalVariablePointer which calls urProgramGetGlobalVariablePointer otherwise this will be unusable there.

Yes, I forgot about the SYCL RT side. I will update the intel-llvm PR with the new pi entrypoint

It's updated now in intel/llvm#12496

@kbenzie
Copy link
Contributor

kbenzie commented Feb 27, 2024

Hi, when can this PR be merged? We're implementing device sanitizer related features, and this new API can simplify our design.

@zhaomaosu its waiting for approvals on intel/llvm#12496 and a couple of other UR PR's to merge first.

@kbenzie kbenzie added the v0.9.x Include in the v0.9.x release label Mar 11, 2024
@kbenzie
Copy link
Contributor

kbenzie commented Mar 11, 2024

Please pull in the main branch to have up to date testing, also update the tag in the intel/llvm PR.

@fabiomestre fabiomestre requested a review from a team as a code owner March 11, 2024 17:42
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.

Changes for native cpu lgtm, thank you

@kbenzie kbenzie self-assigned this Mar 14, 2024
@kbenzie kbenzie force-pushed the fabio/add_global_variable_pointer branch from 1bc658a to 6297b7f Compare March 14, 2024 22:02
@kbenzie kbenzie force-pushed the fabio/add_global_variable_pointer branch from 6297b7f to ca3da5a Compare March 18, 2024 20:05
@kbenzie kbenzie merged commit 4d0183a into oneapi-src:main Mar 18, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Added to PR's which are ready to merge v0.9.x Include in the v0.9.x release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request to add a new UR API to retrieve global variable pointer from Module
8 participants