Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions sycl/doc/EnvironmentVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ variables in production code.</span>
| `SYCL_HOST_UNIFIED_MEMORY` | Integer | Enforce host unified memory support or lack of it for the execution graph builder. If set to 0, it is enforced as not supported by all devices. If set to 1, it is enforced as supported by all devices. |
| `SYCL_CACHE_TRACE` | Any(\*) | If the variable is set, messages are sent to std::cerr when caching events or non-blocking failures happen (e.g. unable to access cache item file). |
| `SYCL_PARALLEL_FOR_RANGE_ROUNDING_TRACE` | Any(\*) | Enables tracing of `parallel_for` invocations with rounded-up ranges. |
| `SYCL_PI_SUPPRESS_ERROR_MESSAGE` | Any(\*) | Suppress printing of error message, only used for CI in order not to interrupt errors generated by underlying toolchains; note that the variable only modifies the printing of the error message (error value, name, description and location), the handling of error return code and aborting/throwing behaviour remains unchanged. |

`(*) Note: Any means this environment variable is effective when set to any non-null value.`

Expand Down
26 changes: 15 additions & 11 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,21 @@ pi_result check_error(CUresult result, const char *function, int line,
return PI_SUCCESS;
}

const char *errorString = nullptr;
const char *errorName = nullptr;
cuGetErrorName(result, &errorName);
cuGetErrorString(result, &errorString);
std::cerr << "\nPI CUDA ERROR:"
<< "\n\tValue: " << result
<< "\n\tName: " << errorName
<< "\n\tDescription: " << errorString
<< "\n\tFunction: " << function
<< "\n\tSource Location: " << file << ":" << line << "\n"
<< std::endl;
if (std::getenv("SYCL_PI_SUPPRESS_ERROR_MESSAGE") == nullptr) {
const char *errorString = nullptr;
const char *errorName = nullptr;
cuGetErrorName(result, &errorName);
cuGetErrorString(result, &errorString);
std::stringstream ss;
ss << "\nPI CUDA ERROR:"
<< "\n\tValue: " << result
<< "\n\tName: " << errorName
<< "\n\tDescription: " << errorString
<< "\n\tFunction: " << function << "\n\tSource Location: " << file
<< ":" << line << "\n"
<< std::endl;
std::cerr << ss.str();
}

if (std::getenv("PI_CUDA_ABORT") != nullptr) {
std::abort();
Expand Down
26 changes: 15 additions & 11 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,21 @@ pi_result check_error(hipError_t result, const char *function, int line,
return PI_SUCCESS;
}

const char *errorString = nullptr;
const char *errorName = nullptr;
errorName = hipGetErrorName(result);
errorString = hipGetErrorString(result);
std::cerr << "\nPI HIP ERROR:"
<< "\n\tValue: " << result
<< "\n\tName: " << errorName
<< "\n\tDescription: " << errorString
<< "\n\tFunction: " << function
<< "\n\tSource Location: " << file << ":" << line << "\n"
<< std::endl;
if (std::getenv("SYCL_PI_SUPPRESS_ERROR_MESSAGE") == nullptr) {
const char *errorString = nullptr;
const char *errorName = nullptr;
errorName = hipGetErrorName(result);
errorString = hipGetErrorString(result);
std::stringstream ss;
ss << "\nPI HIP ERROR:"
<< "\n\tValue: " << result
<< "\n\tName: " << errorName
<< "\n\tDescription: " << errorString
<< "\n\tFunction: " << function << "\n\tSource Location: " << file
<< ":" << line << "\n"
<< std::endl;
std::cerr << ss.str();
}

if (std::getenv("PI_HIP_ABORT") != nullptr) {
std::abort();
Expand Down