-
Notifications
You must be signed in to change notification settings - Fork 787
Add sycl ext intel kernel queries extension #16834
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
Merged
sarnex
merged 28 commits into
intel:sycl
from
kurapov-peter:sycl_ext_intel_kernel_queries
Mar 6, 2025
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5434020
Add extension doc draft
kurapov-peter ae3d216
Specify UR version to inlude upcoming changes
kurapov-peter 94dea19
Add a draft implementation for the extension
kurapov-peter cd0b7be
Update specification
gmlueck 20e364c
Change names to spell out memory
kurapov-peter 519e2b1
Change the return type to size_t
kurapov-peter 1d2f7bc
Move spill_memory_size to kernel_device_specific
kurapov-peter 2029e2b
Update UR tag
kurapov-peter 51b9c0c
fixup! Update UR tag
kurapov-peter 4f4e4db
fix formatting
kurapov-peter ea46e7c
Remove the bogus metadata test
kurapov-peter 03ba27d
Check for the aspect presence before testing the kernel info
kurapov-peter 58d392d
Fix undef variable
kurapov-peter b0f2b27
Add get_info declaration for the new device-specific traits
kurapov-peter 36cf3bd
Add the exported symbol to abi checks
kurapov-peter 3cf5c72
Add the exported symbol on windows
kurapov-peter 79f35f7
[UR] Return spills for all ZE kernels in UR kernel via v1 level_zero …
kurapov-peter f47ba21
fix formatting
kurapov-peter 7e7a422
Merge branch 'sycl' into sycl_ext_intel_kernel_queries
kurapov-peter 07a3b7c
Fix merge conflict error
kurapov-peter 597e5f0
Remove an empty line
kurapov-peter 106b1e2
Inline UR_KERNEL_INFO_SPILL_MEM_SIZE
kurapov-peter 34f24f3
Rename Result to Device2SpillMap
kurapov-peter 13ff634
Update sycl/source/detail/kernel_info.hpp
kurapov-peter fd68f4d
Format the updated comment
kurapov-peter 3443815
Format the renaming
kurapov-peter 7402507
Merge remote-tracking branch 'upstream/sycl' into sycl_ext_intel_kern…
kurapov-peter d918044
Merge remote-tracking branch 'upstream/sycl' into sycl_ext_intel_kern…
kurapov-peter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
sycl/doc/extensions/supported/sycl_ext_intel_kernel_queries.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
= sycl_ext_intel_kernel_queries | ||
|
||
:source-highlighter: coderay | ||
:coderay-linenums-mode: table | ||
|
||
// This section needs to be after the document title. | ||
:doctype: book | ||
:toc2: | ||
:toc: left | ||
:encoding: utf-8 | ||
:lang: en | ||
:dpcpp: pass:[DPC++] | ||
:endnote: —{nbsp}end{nbsp}note | ||
|
||
// Set the default source code type in this document to C++, | ||
// for syntax highlighting purposes. This is needed because | ||
// docbook uses c++ and html5 uses cpp. | ||
:language: {basebackend@docbook:c++:cpp} | ||
|
||
|
||
== Notice | ||
|
||
[%hardbreaks] | ||
Copyright (C) 2025 Intel Corporation. All rights reserved. | ||
|
||
Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks | ||
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by | ||
permission by Khronos. | ||
|
||
|
||
== Contact | ||
|
||
To report problems with this extension, please open a new issue at: | ||
|
||
https://github.com/intel/llvm/issues | ||
|
||
|
||
== Dependencies | ||
|
||
This extension is written against the SYCL 2020 revision 9 specification. | ||
All references below to the "core SYCL specification" or to section numbers in | ||
the SYCL specification refer to that revision. | ||
|
||
|
||
== Status | ||
|
||
This extension is implemented and fully supported by {dpcpp}. | ||
|
||
|
||
== Overview | ||
|
||
This extension contains a collection of queries that provide low-level | ||
information about kernels. | ||
These queries generally forward directly to the backend and expose concepts that | ||
are specific to a particular implementation. | ||
As a result, these queries may not be supported for all devices. | ||
Each query has an associate device aspect, which tells whether the query is | ||
supported on that device. | ||
|
||
|
||
== Specification | ||
|
||
=== Feature test macro | ||
|
||
This extension provides a feature-test macro as described in the core SYCL | ||
specification. | ||
An implementation supporting this extension must predefine the macro | ||
`SYCL_EXT_INTEL_KERNEL_QUERIES` to one of the values defined in the table below. | ||
Applications can test for the existence of this macro to determine if the | ||
implementation supports this feature, or applications can test the macro's value | ||
to determine which of the extension's features the implementation supports. | ||
|
||
[%header,cols="1,5"] | ||
|=== | ||
|Value | ||
|Description | ||
|
||
|1 | ||
|Initial version of this extension. | ||
|=== | ||
|
||
=== Spill memory size | ||
|
||
This query returns the kernel's spill memory size that is allocated by the | ||
compiler, as reported by Level Zero. | ||
|
||
==== New device aspect | ||
|
||
This extension adds the following new device aspect. | ||
|
||
[source,c++] | ||
---- | ||
namespace sycl { | ||
|
||
enum class aspect { | ||
ext_intel_spill_memory_size | ||
|
||
// ... | ||
}; | ||
|
||
} | ||
---- | ||
|
||
''' | ||
|
||
`*ext_intel_spill_memory_size*` | ||
|
||
Indicates that the `spill_memory_size` kernel information descriptor may be used | ||
to query kernels for this device. | ||
|
||
''' | ||
|
||
==== New device specific kernel information descriptor | ||
|
||
This extension adds the following information descriptor that can be used with | ||
`kernel::get_info(const device&)`. | ||
|
||
''' | ||
|
||
`*ext::intel::info::kernel_device_specific::spill_memory_size*` | ||
|
||
[source,c++] | ||
---- | ||
namespace sycl::ext::intel::info::kernel_device_specific { | ||
struct spill_memory_size { | ||
using return_type = size_t; | ||
}; | ||
} // namespace sycl::ext::intel::info::kernel_device_specific | ||
---- | ||
|
||
_Remarks:_ Template parameter to `kernel::get_info(const device&)`. | ||
|
||
_Returns:_ The spill memory size that is allocated by the compiler for this | ||
kernel for the given device. | ||
|
||
_Throws:_ An `exception` with the `errc::feature_not_supported` error code if | ||
the device does not have `aspect::ext_intel_spill_memory_size`. | ||
|
||
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__SYCL_PARAM_TRAITS_SPEC(ext::intel, kernel_device_specific, spill_memory_size, size_t, UR_KERNEL_INFO_SPILL_MEM_SIZE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There might be a better way to test the thing. This would just return zero. Any suggestions? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is L0 important here?
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.
Normally, we would not define a SYCL API in terms of a particular backend like this. However, it seemed to me that "spill memory size" is too vaguely defined. The reality is that SYCL is just returning whatever value comes from Level Zero. If people have questions about what it means, I'd rather direct them to Level Zero.
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.
fair enough