Skip to content

[SYCL] Host pipe runtime implementation #7468

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 59 commits into from
Mar 30, 2023

Conversation

zibaiwan
Copy link
Contributor

@zibaiwan zibaiwan commented Nov 21, 2022

Disclaimer:

This work is a continuation of a previous approved Sherry's PR: #5766 and her draft work #5894.

We are implementing Hostpipes based on the Spec here. OpenCL spec is here.

The following is the outline of the design.

  1. The host pipe properties need to be added to the device image (probably similar to the previous change here a9ad3af)

2.The frontend calls the registration of device image, maybe similar to this code: which is where the host pipe information is available. This is where the mapping from host pipe name to host pipe pointer is extracted.

  1. The frontend also calls host_pipe_map::add to register/initialize the host pipes. This is the new function. We are not sure about the ordering of registration of device image / registration of host pipe. for which ever one that comes later, it need to initialize the remaining attribute of host pipe (such as its properties).

  2. The opencl runtime will need to get a cl_program object, which is typically not available until the first kernel launch. To get a program object early on, the host pipe name/pointer to device image mapping is cached during registration. And when the specific host pipe is needed, build the program and get its ocl runtime representation. This is done in the first couple commits.

  3. Since a host pipe read/write need to depend on other write operation finishing before it (including the inter kernel write). This means the pipe needs to know the dependency of kernel execution. For this reason, the host pipe read and write ocl function cannot be called with no dep event. therefore, it is implemented with handler , which is aware of the event that it is supposed to wait upon. This is done in the "Register new command group .." commit.

  4. Unit test

    • mock a fake device image.
    • register the fake device image
    • register fake pipe with some name you specified
    • fake the opencl functionality, this can be done with unittest::PiMock::redefine

@zibaiwan zibaiwan force-pushed the sycl-hostpipe-runtime branch 5 times, most recently from 00c823c to a754b91 Compare November 23, 2022 20:18
@zibaiwan zibaiwan changed the title [Draft][WIP][SYCL] Implement initial host_pipe registration [Draft][WIP][SYCL] Implement host_pipe Nov 23, 2022
@zibaiwan zibaiwan force-pushed the sycl-hostpipe-runtime branch from a754b91 to 13e24ee Compare November 23, 2022 20:39
@zibaiwan zibaiwan force-pushed the sycl-hostpipe-runtime branch 4 times, most recently from e590e72 to 9123db6 Compare December 7, 2022 19:44
@zibaiwan zibaiwan changed the title [Draft][WIP][SYCL] Implement host_pipe [WIP][SYCL] Host pipe runtime implementation Dec 8, 2022
@zibaiwan zibaiwan marked this pull request as ready for review December 8, 2022 13:38
@zibaiwan zibaiwan requested review from a team as code owners December 8, 2022 13:38
Copy link
Contributor

@asudarsa asudarsa left a comment

Choose a reason for hiding this comment

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

I do not see any changes relevant to dpcpp-tools.

Thanks

@zibaiwan
Copy link
Contributor Author

@steffenlarsen, can you please take a look at this PR when you have a chance? Any feedback is much appreciated!

@steffenlarsen
Copy link
Contributor

Converted to draft to avoid accidental merge.

@zibaiwan zibaiwan force-pushed the sycl-hostpipe-runtime branch from ff1912a to e6e3e99 Compare February 3, 2023 17:48
@zibaiwan zibaiwan temporarily deployed to aws February 3, 2023 17:54 — with GitHub Actions Inactive
@zibaiwan zibaiwan temporarily deployed to aws February 3, 2023 18:24 — with GitHub Actions Inactive
bader pushed a commit that referenced this pull request Feb 7, 2023
…8009)

Implementation of host pipes outlined in the design document in this PR:

#5850

1. Generation a unique pipe id for GVs marked with the new
"sycl-host-pipe" attribute. Id generation utilizes the same method as
used for name generation for device global.
2. Added a host pipe map to map the addresses of marked GVs with the
unique id. This host pipe map is generated by a constructor and method
calls added to the header and footer.
3. Modified the sycl-post-link tool to generate compile time properties
metadata for these GVs. This metadata contains the unique id generated
for the GV to be consumed by the device backend compiler.

PR for accompanying runtime changes:
#7468

---------

Co-authored-by: Alexey Sachkov <alexey.sachkov@intel.com>
@zibaiwan
Copy link
Contributor Author

/testwin

@zibaiwan
Copy link
Contributor Author

/testwin

@zibaiwan zibaiwan temporarily deployed to aws March 29, 2023 17:42 — with GitHub Actions Inactive
@zibaiwan
Copy link
Contributor Author

/testwin

@zibaiwan
Copy link
Contributor Author

/testwin

@zibaiwan
Copy link
Contributor Author

CI Status from the earlier commit: [839d7ee] (839d7ee) is valid for this PR as the following two are just two empty commits.

@zibaiwan zibaiwan temporarily deployed to aws March 30, 2023 02:40 — with GitHub Actions Inactive
@zibaiwan
Copy link
Contributor Author

The CI for the latest code commit passed: https://github.com/intel/llvm/actions/runs/4556840235/jobs/8043028160, except for the known failures. @steffenlarsen , this PR is ready to be merged now. Thank you very much for your help.

@zibaiwan zibaiwan temporarily deployed to aws March 30, 2023 08:23 — with GitHub Actions Inactive
steffenlarsen added a commit that referenced this pull request Mar 30, 2023
#8789)

A continuation of #5838. Accompanying runtime change is #7468.

Add a memory order parameter to device-side read/write members and
default to sycl::memory_order::seq_cst. This parameter is in place but
not being used at this moment, it's intended for the future work.

Add host pipe read/write members with additional sycl::queue parameter.

---------

Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor

steffenlarsen commented Mar 30, 2023

Failed Tests (2):
SYCL :: AtomicRef/atomic_memory_order_acq_rel.cpp - Reported in #8847
SYCL :: GroupAlgorithm/reduce_sycl2020.cpp - Fixed in #8860

@steffenlarsen steffenlarsen merged commit 992ef06 into intel:sycl Mar 30, 2023
steffenlarsen added a commit to steffenlarsen/llvm that referenced this pull request Mar 30, 2023
This commit fixes unusued variable warnings after
intel#7468. Additionally it replaces
asserts in the unittests with EXPECT_EQ.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
steffenlarsen added a commit that referenced this pull request Mar 30, 2023
This commit fixes unusued variable warnings after
#7468. Additionally it replaces
asserts in the unittests with EXPECT_EQ.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
steffenlarsen pushed a commit that referenced this pull request Mar 30, 2023
This patch fixes post-commit failure introduced in
#7468:

```
/Users/runner/work/llvm/llvm/src/sycl/source/detail/program_manager/program_manager.cpp:1324:9: error: 'lock_guard' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
        std::lock_guard HostPipesGuard(m_HostPipesMutex);
        ^
```
steffenlarsen added a commit that referenced this pull request May 2, 2023
Pipe properties support was added in this PR:
#7468
(sycl/ext/intel/experimental/pipe_properties.hpp). This is the
accompanying spec.

---------

Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
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.

10 participants