-
Notifications
You must be signed in to change notification settings - Fork 807
ITT stubs and wrappers for SPIR-V devices. #3279
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
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a985517
ITT stubs and compiler wrappers for SPIR-V devices.
e2e60cb
clang-format
47a8102
Removed \t.
391d0e3
Moved declarations to spirv_vars.h
ea511ff
Renamed itt_cmplr_wrappers.cpp
ab8c04c
Cleaned up names and added user wrappers.
2d9c6c6
clang-format
089a806
Revert changes that uncovered __spirv_GlobalInvocationId_x issue.
b5b3ff1
Added documentation.
e80f1b4
Fomatting fixed.
0c091bb
Updated __itt_atomic_mem_order_t enum.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
ITT annotations support | ||
======================= | ||
|
||
This extension enables a set of functions implementing | ||
the Instrumentation and Tracing Technology (ITT) functionality | ||
in SYCL device code. | ||
|
||
There are three sets of functions defined by this extension, | ||
and they serve different purposes. | ||
|
||
User APIs | ||
--------- | ||
|
||
The user code calling these functions must include the corresponding header | ||
file(s) provided by `ittnotify` project (TBD: reference ITT repo here). | ||
|
||
These functions are named using `__itt_notify_` prefix. | ||
|
||
Stub APIs | ||
--------- | ||
|
||
These functions are not defined in any header file, and their declarations | ||
follow exactly the declarations of the corresponding user APIs, except that | ||
they have an extra `_stub` suffix in their names. | ||
|
||
These functions implement the ITT functionality in a way that allows | ||
the tools, such as Intel(R) Inspector, to recognize the ITT annotations | ||
and run their analysis methods based on that. | ||
|
||
For SYCL device code these functions are implemented as `noinline` and `optnone` | ||
functions so that the corresponding calls may be distinguished in the execution | ||
trace. This is just one way for implementing them, and the actual implementation | ||
may change in future. | ||
|
||
Compiler wrapper APIs | ||
--------------------- | ||
|
||
These functions are not defined in any header file, and they are supposed | ||
to be called from the compiler generated code. These thin wrappers | ||
just provide a convenient way for compilers to produce ITT annotations | ||
without generating too much code in the compilers' IR. | ||
|
||
These functions have `_wrapper` suffix in their names. | ||
|
||
Example | ||
~~~~~~~ | ||
|
||
.. code: c++ | ||
DEVICE_EXTERN_C void __itt_offload_wi_start_stub( | ||
size_t[3], size_t, uint32_t); | ||
|
||
DEVICE_EXTERN_C void __itt_offload_wi_start_wrapper() { | ||
if (__spirv_SpecConstant(0xFF747469, 0)) { | ||
size_t GroupID[3] = ...; | ||
size_t WIId = ...; | ||
uint32_t WGSize = ...; | ||
__itt_offload_wi_start_stub(GroupID, WIId, WGSize); | ||
} | ||
} | ||
|
||
A compiler may generate a simple call to `__itt_offload_wi_start_wrapper` | ||
to annotate a kernel entry point. Compare this to the code inside the wrapper | ||
function, which a compiler would have to generate if there were no such | ||
a wrapper. | ||
|
||
Conditional compilation | ||
----------------------- | ||
|
||
To minimize the effect of ITT annotations on the performance of the device code, | ||
the implementation is guarded with a specialization constant check. This allows | ||
users and tools to have one version of the annotated code that may be built | ||
with and without ITT annotations "enabled". When the ITT annotations are not | ||
enabled, we expect that the overall effect of the annotations will be minimized | ||
by the dead code elimination optimization(s) made by the device compilers. | ||
|
||
For this purpose we reserve a 1-byte specialization constant numbered | ||
`4285822057` (`0xFF747469`). The users/tools/runtimes should set this | ||
specialization constant to non-zero value to enable the ITT annotations | ||
in SYCL device code. |
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
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.
Uh oh!
There was an error while loading. Please reload this page.