Skip to content

[SYCL] Don't copy string when tracing is not enabled #16596

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 2 commits into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions sycl/source/detail/persistent_device_code_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,23 @@ class PersistentDeviceCodeCache {
const ur_program_handle_t &NativePrg);

/* Sends message to std:cerr stream when SYCL_CACHE_TRACE environemnt is set*/
static void trace(const std::string &msg, std::string path = "") {
static void trace(const std::string &msg, const std::string &path = "") {
static const bool traceEnabled =
SYCLConfig<SYCL_CACHE_TRACE>::isTraceDiskCache();
if (traceEnabled) {
std::replace(path.begin(), path.end(), '\\', '/');
std::cerr << "[Persistent Cache]: " << msg << path << std::endl;
auto outputPath = path;
std::replace(outputPath.begin(), outputPath.end(), '\\', '/');
std::cerr << "[Persistent Cache]: " << msg << outputPath << std::endl;
}
}
static void trace_KernelCompiler(const std::string &msg,
std::string path = "") {
const std::string &path = "") {
static const bool traceEnabled =
SYCLConfig<SYCL_CACHE_TRACE>::isTraceKernelCompiler();
if (traceEnabled) {
std::replace(path.begin(), path.end(), '\\', '/');
std::cerr << "[kernel_compiler Persistent Cache]: " << msg << path
auto outputPath = path;
std::replace(outputPath.begin(), outputPath.end(), '\\', '/');
std::cerr << "[kernel_compiler Persistent Cache]: " << msg << outputPath
<< std::endl;
}
}
Expand Down
Loading