-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL] Enhance PI tracing with printing output (pointer) arguments #1523
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 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e58f60b
[SYCL] enhanced PI tracing to print output (pointer) arguments
smaslov-intel 064f325
Merge remote-tracking branch 'origin/sycl' into enhanced_pi_tracing
againull 80791c8
Address review comments
againull 614608a
Fix clang-format issue
againull 77ab42a
Fix clang-format issue
againull 74d0886
Merge remote-tracking branch 'origin/sycl' into enhanced_pi_tracing
againull ef6d325
Fix scalar_vec_access.cpp test: add missing sync point
againull 57ec09d
Revert "Fix scalar_vec_access.cpp test: add missing sync point"
againull c694eba
Add test for enhanced tracing
againull 996338a
Fix formatting
againull 29e522f
Merge remote-tracking branch 'origin/sycl' into enhanced_pi_tracing
againull 73a4961
Fix regexp for Windows
againull b793315
For formatting issues and hex regexp
againull 0feff82
Merge remote-tracking branch 'origin/sycl' into enhanced_pi_tracing
againull 6391472
Merge remote-tracking branch 'origin/sycl' into restore
againull d4790ab
Address review comments
againull 7b27624
Fix test
againull b07cfed
Remove tests. They will be added to llvm-test-suite
againull bc71484
Merge remote-tracking branch 'origin/sycl' into enhanced_pi_tracing
againull 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
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,171 @@ | ||
//==--------- plugin_printers.hpp - Printers for the Plugin Interface ------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// Print functions used for the Plguin Interface tracing. | ||
|
||
#pragma once | ||
|
||
#include <CL/sycl/detail/pi.hpp> | ||
|
||
__SYCL_INLINE_NAMESPACE(cl) { | ||
namespace sycl { | ||
namespace detail { | ||
namespace pi { | ||
|
||
template <typename T> inline void print(T val) { | ||
vladimirlaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::cout << "<unknown> : " << val << std::endl; | ||
} | ||
|
||
template <> inline void print<>(PiPlatform val) { | ||
std::cout << "pi_platform : " << val << std::endl; | ||
} | ||
|
||
template <> inline void print<>(PiEvent val) { | ||
std::cout << "pi_event : " << val << std::endl; | ||
} | ||
|
||
template <> inline void print<>(PiMem val) { | ||
std::cout << "pi_mem : " << val << std::endl; | ||
} | ||
|
||
template <> inline void print<>(PiEvent *val) { | ||
std::cout << "pi_event * : " << val; | ||
if (val) | ||
std::cout << "[ " << *val << " ... ]"; | ||
else | ||
std::cout << "[ nullptr ]"; | ||
std::cout << std::endl; | ||
} | ||
|
||
template <> inline void print<>(const PiEvent *val) { | ||
std::cout << "const pi_event * : " << val; | ||
if (val) | ||
std::cout << "[ " << *val << " ... ]"; | ||
else | ||
std::cout << "[ nullptr ]"; | ||
std::cout << std::endl; | ||
} | ||
|
||
template <> inline void print<>(pi_buffer_region rgn) { | ||
std::cout << "pi_buffer_region origin/size : " << rgn->origin << "/" | ||
<< rgn->size << std::endl; | ||
} | ||
|
||
template <> inline void print<>(pi_buff_rect_region rgn) { | ||
std::cout << "pi_buff_rect_region width_bytes/height/depth : " | ||
<< rgn->width_bytes << "/" << rgn->height_scalar << "/" | ||
<< rgn->depth_scalar << std::endl; | ||
} | ||
|
||
template <> inline void print<>(pi_buff_rect_offset off) { | ||
std::cout << "pi_buff_rect_offset x_bytes/y/z : " << off->x_bytes << "/" | ||
<< off->y_scalar << "/" << off->z_scalar << std::endl; | ||
} | ||
|
||
template <> inline void print<>(pi_image_region rgn) { | ||
std::cout << "pi_image_region width/height/depth : " << rgn->width << "/" | ||
<< rgn->height << "/" << rgn->depth << std::endl; | ||
} | ||
|
||
template <> inline void print<>(pi_image_offset off) { | ||
std::cout << "pi_image_offset x/y/z : " << off->x << "/" << off->y << "/" | ||
<< off->z << std::endl; | ||
} | ||
|
||
template <> inline void print<>(const pi_image_desc *desc) { | ||
std::cout << "image_desc w/h/d : " << desc->image_width << " / " | ||
<< desc->image_height << " / " << desc->image_depth | ||
<< " -- arrSz/row/slice : " << desc->image_array_size << " / " | ||
<< desc->image_row_pitch << " / " << desc->image_slice_pitch | ||
<< " -- num_mip_lvls/num_smpls/image_type : " | ||
<< desc->num_mip_levels << " / " << desc->num_samples << " / " | ||
<< desc->image_type << std::endl; | ||
} | ||
|
||
template <> inline void print<>(PiResult val) { | ||
std::cout << "pi_result : "; | ||
if (val == PI_SUCCESS) | ||
std::cout << "PI_SUCCESS" << std::endl; | ||
else | ||
std::cout << val << std::endl; | ||
} | ||
|
||
// cout does not resolve a nullptr. | ||
template <> inline void print<>(std::nullptr_t) { | ||
std::cout << "<nullptr>" << std::endl; | ||
} | ||
|
||
template <> inline void print<>(char *val) { | ||
std::cout << "<char * > : " << static_cast<void *>(val) << std::endl; | ||
} | ||
|
||
template <> inline void print<>(const char *val) { | ||
std::cout << "<const char *>: " << val << std::endl; | ||
} | ||
|
||
inline void printArgs(void) {} | ||
template <typename Arg0, typename... Args> | ||
void printArgs(Arg0 arg0, Args... args) { | ||
std::cout << "\t"; | ||
print(arg0); | ||
pi::printArgs(std::forward<Args>(args)...); | ||
} | ||
|
||
template <typename T> struct printOut { | ||
printOut(T val) {} | ||
}; // Do nothing | ||
|
||
template <> struct printOut<PiEvent *> { | ||
printOut(PiEvent *val) { | ||
std::cout << "\t[out]pi_event * : " << val; | ||
if (val) | ||
std::cout << "[ " << *val << " ... ]"; | ||
else | ||
std::cout << "[ nullptr ]"; | ||
std::cout << std::endl; | ||
} | ||
}; | ||
|
||
template <> struct printOut<PiMem *> { | ||
printOut(PiMem *val) { | ||
std::cout << "\t[out]pi_mem * : " << val; | ||
if (val) | ||
std::cout << "[ " << *val << " ... ]"; | ||
else | ||
std::cout << "[ nullptr ]"; | ||
std::cout << std::endl; | ||
} | ||
}; | ||
|
||
template <> struct printOut<void *> { | ||
printOut(void *val) { std::cout << "\t[out]void * : " << val << std::endl; } | ||
}; | ||
|
||
template <typename T> struct printOut<T **> { | ||
printOut(T **val) { | ||
std::cout << "\t[out]<unknown> ** : " << val; | ||
if (val) | ||
std::cout << "[ " << *val << " ... ]"; | ||
else | ||
std::cout << "[ nullptr ]"; | ||
std::cout << std::endl; | ||
} | ||
}; | ||
|
||
inline void printOuts(void) {} | ||
template <typename Arg0, typename... Args> | ||
void printOuts(Arg0 arg0, Args... args) { | ||
using T = decltype(arg0); | ||
printOut<T> a(arg0); | ||
printOuts(std::forward<Args>(args)...); | ||
} | ||
|
||
} // namespace pi | ||
} // namespace detail | ||
} // namespace sycl | ||
} // __SYCL_INLINE_NAMESPACE(cl) |
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.