Skip to content

Conversation

@jopperm
Copy link
Contributor

@jopperm jopperm commented Nov 18, 2024

This PR implements symbol table and property set extraction from the runtime-compiled module, based on the skeleton used by sycl-post-link, assuming that no splitting of the module is required and/or requested. We add the necessary plumbing to pass this information to the runtime, which then reuses existing sycl-jit infrastructure to create the necessary data structures for device binary images.

We don't use the properties yet during the creating of the kernel bundles, but the necessary information to feed the images into the program manager is there.

Signed-off-by: Julian Oppermann <[email protected]>
@jopperm jopperm changed the title [SYCL][RTC] Add minimum amount of post-link functionality to feed properties to program manager [SYCL][RTC] Add minimum amount of post-link functionality to extract symbol table and properties Nov 20, 2024
@jopperm jopperm marked this pull request as ready for review November 20, 2024 15:28
@jopperm jopperm requested review from a team as code owners November 20, 2024 15:28
@aelovikov-intel
Copy link
Contributor

I think @cperkinsintel is much more familiar with this code than I am, so I'll leave this review to him.

@sommerlukas sommerlukas removed the request for review from aelovikov-intel November 21, 2024 09:20
Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

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

Some stylistic nits.

Comment on lines 41 to 48
static JITResult errorToFusionResult(llvm::Error &&Err,
const std::string &Msg) {
return wrapError<JITResult>(std::move(Err), Msg);
}

static RTCResult errorToRTCResult(llvm::Error &&Err, const std::string &Msg) {
return wrapError<RTCResult>(std::move(Err), Msg);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we use wrapError directly (maybe with a different name)?

So, instead of errorToFusionResult or errorToRTCResult, we would call errorToResult<JITResult> and errorToResult<RTCResult>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

errorToResult<T> makes sense, I initially decided against that to keep the diff a bit cleaner.

Signed-off-by: Julian Oppermann <[email protected]>
Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

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

Few stylistic nits.

!F->use_empty()) {
// The element in "llvm.used" array has other users. That is Ok for
// specialization constants, but is wrong for kernels.
llvm::report_fatal_error("Unexpected usage of SYCL kernel");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we ever expect to hit this during user code compilation? If yes, we should probably fail more gracefully and report back through a failed RTCResult.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, however, I wasn't able to trigger the generation of llvm.used and llvm.compiler.used with the feature set we currently support. Hence I'm proposing to just assert that they're not present, and to drop the copied code from sycl-post-link for now.

Signed-off-by: Julian Oppermann <[email protected]>
Signed-off-by: Julian Oppermann <[email protected]>
@jopperm
Copy link
Contributor Author

jopperm commented Nov 25, 2024

@intel/llvm-gatekeepers Please merge this, thanks.

@sarnex sarnex merged commit 92ae661 into intel:sycl Nov 25, 2024
13 checks passed
@jopperm
Copy link
Contributor Author

jopperm commented Nov 25, 2024

Working on a fix for the post-commit failure.

@sarnex
Copy link
Contributor

sarnex commented Nov 25, 2024

Thanks, tag me when it's ready

sarnex pushed a commit that referenced this pull request Nov 25, 2024
Fixes post-commit failure due to an unused variable introduced by
#16109.

---------

Signed-off-by: Julian Oppermann <[email protected]>
@jopperm jopperm deleted the rtc-via-sycl-jit-post-link branch November 26, 2024 15:13
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.

5 participants