Skip to content

[SYCL][Bindless][2/4] Add experimental implementation of SYCL bindless images extension #10112

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

isaacault
Copy link
Contributor

@isaacault isaacault commented Jun 28, 2023

Experimental Implementation of SYCL Bindless Images Extension

This commit stands as the second commit of four to make code review easier, implementing revision 4 of the bindless images extension proposal.

Scope

This PR covers changes made to the PI and the UR. This includes

Following Split PRs

  • [3/4] Implement the user-facing SYCL extension
  • [4/4] Add tests

Authors

Co-authored-by: Isaac Ault isaac.ault@codeplay.com
Co-authored-by: Hugh Bird hugh.bird@codeplay.com
Co-authored-by: Duncan Brawley duncan.brawley@codeplay.com
Co-authored-by: Przemek Malon przemek.malon@codeplay.com
Co-authored-by: Chedy Najjar chedy.najjar@codeplay.com
Co-authored-by: Sean Stirling sean.stirling@codeplay.com
Co-authored-by: Peter Zuzek peter@codeplay.com

@isaacault isaacault requested review from a team as code owners June 28, 2023 13:25
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch 2 times, most recently from f74cf46 to a450cd7 Compare June 28, 2023 13:52
@isaacault isaacault temporarily deployed to aws June 28, 2023 13:57 — with GitHub Actions Inactive
…s images extension

This commit stands as the second commit of four to make code review easier,
covering the changes made to the PI.

Co-authored-by: Isaac Ault <isaac.ault@codeplay.com>
Co-authored-by: Hugh Bird <hugh.bird@codeplay.com>
Co-authored-by: Duncan Brawley <duncan.brawley@codeplay.com>
Co-authored-by: Przemek Malon <przemek.malon@codeplay.com>
Co-authored-by: Chedy Najjar <chedy.najjar@codeplay.com>
Co-authored-by: Sean Stirling <sean.stirling@codeplay.com>
Co-authored-by: Peter Zuzek <peter@codeplay.com>

Implement revision 4 of the bindless images extension proposal: intel#9842
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch from a450cd7 to fc60063 Compare June 28, 2023 14:05
@isaacault isaacault temporarily deployed to aws June 28, 2023 14:10 — with GitHub Actions Inactive
Comment on lines 2805 to 2808
case UR_IMAGE_CHANNEL_ORDER_A: {
PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_A;
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about something like

#define MAP(FROM, TO)                 \
case FROM: {                          \
  PiFormat->image_channel_order = TO; \
  break;                              \
}

And if we can change the spelling for enum entries in cases like

  case UR_IMAGE_CHANNEL_ORDER_RX: {
    PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_Rx;

then even FROM/TO could be replaced with a single argument...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a MAP macro as you've specified. One for each of channel_order and channel_data_type.

Copy link
Contributor

Choose a reason for hiding this comment

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

While we are at it, the helpers could also be done in the MAP manner, for example pi2urImageDesc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -873,6 +873,85 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: {
return ReturnValue(int32_t{1});
}
case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: {
// On CUDA bindless images are supported
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
// On CUDA bindless images are supported
// On CUDA bindless images are supported.

Same elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added punctuation to comments throughout.

@isaacault isaacault changed the title [SYCL][Bindless][2/4] Add experimental implementation of SYCL bindless images extension [SYCL][Bindless][ABI-break][2/4] Add experimental implementation of SYCL bindless images extension Jun 29, 2023
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch 2 times, most recently from 5aa5702 to 082a6f4 Compare June 29, 2023 10:55
* [[maybe_unused]] flag added to pi_level_zero
* pi_hip piSamplerCreate updated for API change
* Macro used for image format switch cases
* Added punctuation to comments
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch from 082a6f4 to 109414b Compare June 29, 2023 11:05
@isaacault isaacault temporarily deployed to aws June 29, 2023 12:14 — with GitHub Actions Inactive
@isaacault isaacault temporarily deployed to aws June 29, 2023 13:41 — with GitHub Actions Inactive
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch from d0c3261 to 07320a2 Compare June 29, 2023 13:53
@isaacault isaacault force-pushed the codeplay/bindless_images_pi_ur branch from 07320a2 to 031107f Compare June 29, 2023 13:54
Comment on lines 1115 to 1118
case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT: {
InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP;
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can use MAP here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Applied to add cases for this statement.

Comment on lines 73 to 76
case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8:
cuda_format = CU_AD_FORMAT_UNORM_INT8X1;
PixelTypeSizeBytes = 1;
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Three-operand MAP/CASE macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 134 to 136
case CU_AD_FORMAT_UNSIGNED_INT8:
*return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8;
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

MAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@isaacault isaacault temporarily deployed to aws June 29, 2023 14:39 — with GitHub Actions Inactive
@przemektmalon przemektmalon temporarily deployed to aws July 14, 2023 16:58 — with GitHub Actions Inactive
@przemektmalon przemektmalon temporarily deployed to aws July 14, 2023 18:18 — with GitHub Actions Inactive
@przemektmalon przemektmalon temporarily deployed to aws July 17, 2023 10:26 — with GitHub Actions Inactive
@przemektmalon
Copy link
Contributor

@jandres742 We have incorporated the latest UR changes related to interop resource handles. These are now represented by structs and passed to the UR through pNext chains, instead of the explicit int types that were passed previously.

Can you confirm whether you are happy with the changes, and if so, could you please give your approval on this PR?

@przemektmalon przemektmalon temporarily deployed to aws July 17, 2023 11:53 — with GitHub Actions Inactive
@jandres742
Copy link
Contributor

@jandres742 We have incorporated the latest UR changes related to interop resource handles. These are now represented by structs and passed to the UR through pNext chains, instead of the explicit int types that were passed previously.

Can you confirm whether you are happy with the changes, and if so, could you please give your approval on this PR?

Thanks @przemektmalon .

I think we need to define the export API. Even if there were no support, we are defining here the extension, so it should include the export APIs, so whenever support is added to the backends, the SYCL and PI support is already there.

what do you think? does it make sense?

@jbrodman
Copy link
Contributor

@jandres742 We have incorporated the latest UR changes related to interop resource handles. These are now represented by structs and passed to the UR through pNext chains, instead of the explicit int types that were passed previously.
Can you confirm whether you are happy with the changes, and if so, could you please give your approval on this PR?

Thanks @przemektmalon .

I think we need to define the export API. Even if there were no support, we are defining here the extension, so it should include the export APIs, so whenever support is added to the backends, the SYCL and PI support is already there.

what do you think? does it make sense?

Let's defer additions to future PRs so we can unblock this. It is now ready to merge, correct?

@Ruyk
Copy link
Contributor

Ruyk commented Jul 18, 2023

This is OK from the CP team perspective, we have addressing all comments and concerns.

@steffenlarsen steffenlarsen merged commit 380453d into intel:sycl Jul 18, 2023
@aelovikov-intel
Copy link
Contributor

It seems this broke post-commit: https://github.com/intel/llvm/actions/runs/5589657189/jobs/10218527948.

@jandres742
Copy link
Contributor

@jandres742 We have incorporated the latest UR changes related to interop resource handles. These are now represented by structs and passed to the UR through pNext chains, instead of the explicit int types that were passed previously.
Can you confirm whether you are happy with the changes, and if so, could you please give your approval on this PR?

Thanks @przemektmalon .
I think we need to define the export API. Even if there were no support, we are defining here the extension, so it should include the export APIs, so whenever support is added to the backends, the SYCL and PI support is already there.
what do you think? does it make sense?

Let's defer additions to future PRs so we can unblock this. It is now ready to merge, correct?

Thanks @jbrodman . Sure, if the API to export will be added shortly after, no concerns.

@steffenlarsen
Copy link
Contributor

It seems this broke post-commit: https://github.com/intel/llvm/actions/runs/5589657189/jobs/10218527948.

@isaacault | @przemektmalon - Could you please address the post-commit failure ASAP?

przemektmalon added a commit to codeplaysoftware/intel-llvm-mirror that referenced this pull request Jul 19, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: intel#10112
@przemektmalon
Copy link
Contributor

It seems this broke post-commit: https://github.com/intel/llvm/actions/runs/5589657189/jobs/10218527948.

@isaacault | @przemektmalon - Could you please address the post-commit failure ASAP?

Created PR 10464 to address this.

dm-vodopyanov pushed a commit that referenced this pull request Jul 19, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: #10112
steffenlarsen pushed a commit that referenced this pull request Aug 2, 2023
…CL bindless images extension (#10500)

# Experimental Implementation of SYCL Bindless Images Extension

This commit stands as the fourth, and final, commit of four to make code
review easier, covering the additional tests for bindless images to the
e2e test suite. Implementing [revision 4 of the bindless images
extension proposal](#9842).

This will not compile or run until
[PR3](#10454) has been merged.
However, it can be reviewed simultaneously with PR3.

## Overview

The bindless images extension provides a new interface for allocating,
creating, and accessing images in SYCL. Image memory allocation is
seperated from image handle creation, and image handles can be passed to
kernels without requesting access through accessors. This approach
provides much more flexibility to the user, as well as enabling programs
to implement features that were impossible to implement using standard
SYCL images, such as a texture atlas. In addition to providing a new
interface for images, this extension also provides initial experimental
support for importing external memory into SYCL.

## Previous PRs
* [1/4] [libclc](#9808)
* [2/4] [PI/UR](#10112)
* [3/4] [SYCL API](#10454)
* [4/4] Tests <--- This one

## Authors
Co-authored-by: Isaac Ault isaac.ault@codeplay.com
Co-authored-by: Hugh Bird hugh.bird@codeplay.com
Co-authored-by: Duncan Brawley duncan.brawley@codeplay.com
Co-authored-by: Przemek Malon przemek.malon@codeplay.com
Co-authored-by: Chedy Najjar chedy.najjar@codeplay.com
Co-authored-by: Sean Stirling sean.stirling@codeplay.com
Co-authored-by: Peter Zuzek peter@codeplay.com
Co-authored-by: SYCL Unbound Team <sycl.unbound@codeplay.com>
veselypeta pushed a commit to veselypeta/llvm that referenced this pull request Sep 21, 2023
…s images extension (intel#10112)

# Experimental Implementation of SYCL Bindless Images Extension

This commit stands as the second commit of four to make code review
easier, implementing revision 4 of the [bindless images extension
proposal](intel#9842).

## Scope

This PR covers changes made to the PI and the UR. This includes

- Extending PI with extension functions
- Updating UR FetchContent commit and implementing [UR bindless images
experimental
features](https://oneapi-src.github.io/unified-runtime/core/EXP-BINDLESS-IMAGES.html)
on the CUDA adaptor

## Following Split PRs

- [3/4] Implement the user-facing SYCL extension
- [4/4] Add tests

## Authors

Co-authored-by: Isaac Ault <isaac.ault@codeplay.com>
Co-authored-by: Hugh Bird <hugh.bird@codeplay.com>
Co-authored-by: Duncan Brawley <duncan.brawley@codeplay.com>
Co-authored-by: Przemek Malon <przemek.malon@codeplay.com>
Co-authored-by: Chedy Najjar <chedy.najjar@codeplay.com>
Co-authored-by: Sean Stirling <sean.stirling@codeplay.com>
Co-authored-by: Peter Zuzek <peter@codeplay.com>
fabiomestre pushed a commit to fabiomestre/llvm that referenced this pull request Sep 26, 2023
…s images extension (intel#10112)

# Experimental Implementation of SYCL Bindless Images Extension

This commit stands as the second commit of four to make code review
easier, implementing revision 4 of the [bindless images extension
proposal](intel#9842).

## Scope

This PR covers changes made to the PI and the UR. This includes

- Extending PI with extension functions
- Updating UR FetchContent commit and implementing [UR bindless images
experimental
features](https://oneapi-src.github.io/unified-runtime/core/EXP-BINDLESS-IMAGES.html)
on the CUDA adaptor

## Following Split PRs

- [3/4] Implement the user-facing SYCL extension
- [4/4] Add tests

## Authors

Co-authored-by: Isaac Ault <isaac.ault@codeplay.com>
Co-authored-by: Hugh Bird <hugh.bird@codeplay.com>
Co-authored-by: Duncan Brawley <duncan.brawley@codeplay.com>
Co-authored-by: Przemek Malon <przemek.malon@codeplay.com>
Co-authored-by: Chedy Najjar <chedy.najjar@codeplay.com>
Co-authored-by: Sean Stirling <sean.stirling@codeplay.com>
Co-authored-by: Peter Zuzek <peter@codeplay.com>
fabiomestre pushed a commit to fabiomestre/llvm that referenced this pull request Sep 26, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: intel#10112
fabiomestre pushed a commit to fabiomestre/unified-runtime that referenced this pull request Sep 26, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: intel/llvm#10112
fabiomestre pushed a commit to oneapi-src/unified-runtime that referenced this pull request Sep 27, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: intel/llvm#10112
mdtoguchi pushed a commit to mdtoguchi/llvm that referenced this pull request Oct 18, 2023
…CL bindless images extension (intel#10500)

# Experimental Implementation of SYCL Bindless Images Extension

This commit stands as the fourth, and final, commit of four to make code
review easier, covering the additional tests for bindless images to the
e2e test suite. Implementing [revision 4 of the bindless images
extension proposal](intel#9842).

This will not compile or run until
[PR3](intel#10454) has been merged.
However, it can be reviewed simultaneously with PR3.

## Overview

The bindless images extension provides a new interface for allocating,
creating, and accessing images in SYCL. Image memory allocation is
seperated from image handle creation, and image handles can be passed to
kernels without requesting access through accessors. This approach
provides much more flexibility to the user, as well as enabling programs
to implement features that were impossible to implement using standard
SYCL images, such as a texture atlas. In addition to providing a new
interface for images, this extension also provides initial experimental
support for importing external memory into SYCL.

## Previous PRs
* [1/4] [libclc](intel#9808)
* [2/4] [PI/UR](intel#10112)
* [3/4] [SYCL API](intel#10454)
* [4/4] Tests <--- This one

## Authors
Co-authored-by: Isaac Ault isaac.ault@codeplay.com
Co-authored-by: Hugh Bird hugh.bird@codeplay.com
Co-authored-by: Duncan Brawley duncan.brawley@codeplay.com
Co-authored-by: Przemek Malon przemek.malon@codeplay.com
Co-authored-by: Chedy Najjar chedy.najjar@codeplay.com
Co-authored-by: Sean Stirling sean.stirling@codeplay.com
Co-authored-by: Peter Zuzek peter@codeplay.com
Co-authored-by: SYCL Unbound Team <sycl.unbound@codeplay.com>
omarahmed1111 pushed a commit to omarahmed1111/unified-runtime that referenced this pull request Oct 23, 2023
- Fixed compiler errors/warnings related to unused and uninitialized
variables and parameters.

Post-commit fix for PR: intel/llvm#10112
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.