Skip to content

[ESIMD][NFC] Extract ESIMD handling from sycl-post-link to library. #18684

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

Open
wants to merge 3 commits into
base: sycl
Choose a base branch
from

Conversation

maksimsab
Copy link
Contributor

This change extracts handleESIMD from sycl-post-link to SYCLPostLink component for reuse in NewOffloading compilation flow in clang and for reuse in sycl-jit.

The body of handleESIMD function is refactored for better readability.

The documentation of lowerESIMDConstructs is fixed and the argument name is changed to more straightforward.

This change extracts handleESIMD from sycl-post-link to SYCLPostLink
component for reuse in NewOffloading compilation flow in clang and for
reuse in sycl-jit.

The documentation of lowerESIMDConstructs are fixed and the argument
name is changed to more straightforward.
@maksimsab maksimsab requested a review from a team as a code owner May 27, 2025 16:04
@maksimsab maksimsab requested a review from sarnex May 27, 2025 16:04
"Split modules aren't expected to be more than 2.");
if (Result.size() == 2 && SplitOccurred &&
SplitMode == module_split::SPLIT_PER_KERNEL && !SplitESIMD)
return createStringError("SYCL and ESIMD entry points detected with "
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand this error message. Does it mean that if the modules contain both SYCL and ESIMD entry points, then split-mode=per-kernel and split-esimd=false are incompatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

size == 2 means that we have at least 1 ESIMD entry point and at least 1 non-ESIMD entry point.
-split-esimd=false would lead to linking 2 entry points into common module.
SPLIT_PER_KERNEL dictates that one module should contain only 1 entry point.
This is a controversial state that has been initially mentioned in the comment. However, there is a aspect that it has been initially a warning while my PR makes this an error which is not NFC. I could consider to leave it as a warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not against the error, but the wording is quite confusing to me. I'd go for something like "--split-esimd=false is incompatible with split-mode=per-kernel".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, -split-esimd=false is compatible with split by kernel in terms of input arguments. The problem in that place is a combination of factors: Result.size() == 2, -split-esimd=false and split-mode=per-kernel.
The following combination is alright: Result.size() == 1, split-esimd=false, split-mode=per-kernel.

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.

LGTM overall. Minor nit.
I also have a question. Will it be reasonable to add a unittest for testing this functionality?
(location: llvm/unittests)
Not a blocker though.

Thanks

@maksimsab
Copy link
Contributor Author

Speaking of the testing, different parts are being tested by LIT tests by sycl-post-link. Linking is tested independently from sycl. Lowering is tested by LITs. The control flow of handleESIMD is difficult to test by unittests.

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.

4 participants