SYCLomatic icon indicating copy to clipboard operation
SYCLomatic copied to clipboard

[SYCLomatic] Block Load headers core

Open abhilash1910 opened this issue 2 years ago • 4 comments

In Progress PR for Load/Store header functions for Block API (related later to #1305 ) cc @yihanwg @danhoeflinger @mmichel11

abhilash1910 avatar Jan 18 '24 12:01 abhilash1910

Thinking about the design in more depth, I do not think these APIs should be implemented as free functions. Rather, I think they should be implemented as classes which overload the function call operator or have a member function that invokes the load operation.

My reasoning for this is that certain applications during migration may need to pass a "load" object to a separate function / routine in a kernel. If they are implemented as classes, then an object can be passed to the function where it could then be used:

load_striped<...> obj;
my_func(obj);

However, if they are implemented as free functions, then they would need to be passed as function pointers:

auto func_obj = &load_striped<...>;
my_func(func_obj);

which is not supported in the SYCL programming model. To make this work, load_striped would have to be called directly from my_func which I think may be difficult from the migration perspective.

What I think we should do is have two classes work_group_load and sub_group_load and then have some enum type dictating the strategy (ex: striped, blocked, etc). We could then have have specializations of this class to implement each strategy and maybe have some helpers to reduce code duplication.

mmichel11 avatar Feb 02 '24 18:02 mmichel11

Do you have a matching test branch / PR for this that you are working with? If so, please ensure that it has appropriate coverage and post it. It would help to understand how this is meant to be used and to ensure correctness.

Yes it is in PR https://github.com/oneapi-src/SYCLomatic-test/pull/619 . This needs to be updated with the changes in this PR.

abhilash1910 avatar Feb 12 '24 10:02 abhilash1910

Yes made necessary changes, for now if looks good, we can go ahead with this PR , and I will add to #1784 following other apis. PR test https://github.com/oneapi-src/SYCLomatic-test/pull/619 needs some discussion and checks.

abhilash1910 avatar Mar 28 '24 11:03 abhilash1910

This PR looks to be in good shape for me. However, I think the outstanding comments in https://github.com/oneapi-src/SYCLomatic-test/pull/619 need to be addressed, so we can have confidence in the implementation's correctness.

mmichel11 avatar Apr 30 '24 02:04 mmichel11

This PR is now tested with https://github.com/oneapi-src/SYCLomatic-test/pull/619 and all tests are passing. Tested on application side as well, working as expected.

abhilash1910 avatar May 08 '24 17:05 abhilash1910