Skip to content

Conversation

@sarnex
Copy link
Contributor

@sarnex sarnex commented Sep 26, 2024

We need to know if a module is an ESIMD split or not split at all to set some image properties.

Right now we compute if a module is ESIMD or not by looking at the functions in the module and checking they are all ESIMD, except for allowed exceptions.

A new exception was found related to using assert in user code where there is a scalar SYCL function that correctly remains in the ESIMD split. The end result is we don't set the ESIMD property because we don't think this is the ESIMD split and do the wrong thing at runtime. Instead of just adding this new exception to the list, I reworked what I consider to be flaky logic (that I wrote originally, whoops) to figure out the splits.

Just save metadata in the module of what kind of split it is before we try to compute module properties.

We already do something similar for the spec constant default split, and I moved that to a centralized place as part of this change.

The reason we don't just pass in the ModuleDesc object as an argument is because we want to untie properties creation from the sycl-post-link tool so that it can be called in other places (which we will do for thinLTO).

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
// symbols are usually removed at backend lowering, but this is handled here
// for SPIR-V since SYCL compilation uses llvm-spirv, not the SPIR-V backend.
if (auto Triple = M->getTargetTriple().find("spir") != std::string::npos)
if (M->getTargetTriple().find("spir") != std::string::npos)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not related to this change but fixes an unused variable warning.

@sarnex sarnex marked this pull request as ready for review September 27, 2024 14:52
@sarnex sarnex requested a review from a team as a code owner September 27, 2024 14:52
void ModuleDesc::saveSplitInformationAsMetadata() {
// Add metadata to the module so we can identify what kind of SYCL/ESIMD split
// later.
auto *SplitMD = M->getOrInsertNamedMetadata(SYCL_ESIMD_SPLIT_MD_NAME);
Copy link
Contributor

Choose a reason for hiding this comment

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

A nit:
If we are planning to add more metadata like this in the future, may be it will help to add a helper function?
Not a blocker though

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't expect it to grow that much, the things we check in module properties is limited and doesn't grow that often. If it does blow up we can just move each MD to a function, sure, thanks.


namespace module_split {

constexpr char SYCL_ESIMD_SPLIT_MD_NAME[] = "sycl-split-status";
Copy link
Contributor

Choose a reason for hiding this comment

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

May be sycl-esimd-split-status?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will rename, thanks.

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. Minor unblocking nit. Thanks for working on this.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
@sarnex
Copy link
Contributor Author

sarnex commented Sep 27, 2024

thanks for the review!

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
@sarnex sarnex merged commit 314fcb4 into intel:sycl Sep 30, 2024
12 checks passed
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.

2 participants