-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Improve the error mechanism of llvm-no-spir-kernel #1068
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
[SYCL] Improve the error mechanism of llvm-no-spir-kernel #1068
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have objections against the patch. But I do not see purpose of these changes (as well as the purpose of the tool). The commit message is confusing:
This patch improves the tool's diagnostic upon finding a
SPIR kernel within an LLVM module. Despite that the tool's
only current use is within the SYCL FPGA flow, it's important
to make the message target-agnostic - this way, the tool retains
the potential to be re-used for other targets with an LLVM-based
backend.
What exactly do you mean here? If other targets is other programming models I do not see how it can be reused for other targets, it checks SPIR_KERNEL calling convention, AFAIK it appears only in spir-based IR targets which is used only by OpenCL/SYCL. But if under other targets you mean non-FPGA targets SYCL, I don't see why it cannot be used for them now.
This tool is called by the Clang driver in the FPGA flow. Before an object file is linked against an archive that contains AOT-compiled device code, the tool can detects the presence of a SPIRKernel-calling convention function in the object file. This would mean that the device code from the object file was not AOT-compiled, neither stored in the archive. Terminating the compilation in such case and requesting the archive re-compilation to include all device code is better than letting the user run into a runtime error due to an "unknown kernel". The purpose of these changes is to provide a helpful diagnostic message to the user - from within the tool, we can reach the name of the missing function, and include it in the diagnostic. The other "half" of the diagnostic will be provided by the Clang driver, giving a more detailed explanation with FPGA specifics. I will be uploading the driver patch shortly.
Yes, non-FPGA SYCL targets are implied.
It can. The point was "let's not affect the tool's re-usability for non-FPGA targets by adding FPGA-specific diagnostics". I'll reformulate the commit message into something less confusing. |
e7db7ce
to
fce0c2c
Compare
Updated the commit message & the PR description. |
I'd say that I do not see why we do that. This relies on presence of only one module with device code. But we could support cases when there are multiple device modules.
Are you sure that
It feels a bit better now. |
Combined with the intended Clang driver changes, it should make sense. I've decided to split the changes into the two patches as per the "one commit - one component" policy. I'll provide the link to the driver PR ASAP. |
In the SYCL FPGA flow, a separate |
I think there is some misunderstanding. Why do you think user can see a runtime error due to an "unknown kernel", if not all modules are stored in archive? |
My earlier comment:
Since JIT is not supported for the targeted FPGA devices, it would not be possible to JIT a kernel from an outside object file. Any request to execute such a kernel from the in-archive host code would lead to the "unknown kernel" error. |
|
ac83a32
to
1308471
Compare
1308471
to
3f96bbf
Compare
This patch improves the tool's diagnostic upon finding a SPIR kernel within an LLVM module. Despite that the tool's only current use is within the SYCL FPGA flow, it's important to make the message target-agnostic, so that the tool is not tied to a particular device BE. A related commit to the Clang driver has extended these diagnostics with SYCL FPGA specifics without affecting the tool itself. This patch also introduces testing for the return code value. For example, this should allow the Clang driver users/developers to differentiate between the two possible causes of llvm-no-spir-kernel failure. Signed-off-by: Artem Gindinson <[email protected]>
8261f4e
to
21b1e16
Compare
Squashed & updated the main commit message. |
Signed-off-by: Artem Gindinson <[email protected]>
Signed-off-by: Artem Gindinson <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Note: the Linux failure is an unrelated |
@asavonic, IIRC, you were going to fix this. Any updates? |
…_int_headers * origin/sycl: [SYCL] Improve the error mechanism of llvm-no-spir-kernel (intel#1068)
After intel#1068 has included the Demangle header, this fix to CMakeLists should guarantee successful builds in all configurations Signed-off-by: Artem Gindinson <[email protected]>
After #1068 has included the Demangle header, this fix to CMakeLists should guarantee successful builds in all configurations Signed-off-by: Artem Gindinson <[email protected]>
…ages_docs * origin/sycl: (1092 commits) [CI] Add clang-format checker to pre-commit checks (intel#1163) [SYCL][CUDA] Initial CUDA backend support (intel#1091) [USM] Align OpenCL USM extension header with the specification (intel#1162) [SYCL][NFC] Fix unreferenced variable warning (intel#1158) [SYCL] Fix __spirv_GroupBroadcast overloads (intel#1152) [SYCL] Add llvm/Demangle link dependency for llvm-no-spir-kernel (intel#1156) [SYCL] LowerWGScope pass should not be skipped when -O0 is used [SYCL][Doc][USM] Add refactored pointer and device queries to USM spec (intel#1118) [SYCL] Update the kernel parameter rule to is-trivially-copy-construc… (intel#1144) [SYCL] Move internal headers to source dir (intel#1136) [SYCL] Forbid declaration of non-const static variables inside kernels (intel#1141) [SYCL][NFC] Remove idle space (intel#1148) [SYCL] Improve the error mechanism of llvm-no-spir-kernel (intel#1068) [SYCL] Added CTS test config (intel#1063) [SYCL] Implement check-sycl-deploy target (intel#1142) [SYCL] Preserve original message and code of kernel/program build result (intel#1108) [SYCL] Fix LIT after LLVM change in community Translate LLVM's cmpxchg instruction to SPIR-V Add volatile qualifier for atom_ builtins Fix -Wunused-variable warnings ...
This patch improves the tool's diagnostic upon finding a
SPIR kernel within an LLVM module. Despite that the tool's
only current use is within the SYCL FPGA flow, it's important
to make the message target-agnostic, so that the tool is not
tied to a particular device BE.
A related commit to the Clang driver has extended these diagnostics
with SYCL FPGA specifics without affecting the tool itself.
This patch also introduces testing for the return code value. For
example, this should allow the Clang driver users/developers to
differentiate between the two possible causes of llvm-no-spir-kernel
failure.
Signed-off-by: Artem Gindinson [email protected]