99// ===----------------------------------------------------------------------===//
1010
1111#include " common.hpp"
12+ #include " logger/ur_logger.hpp"
1213
1314#include < cuda.h>
1415
@@ -41,22 +42,18 @@ void checkErrorUR(CUresult Result, const char *Function, int Line,
4142 return ;
4243 }
4344
44- if (std::getenv (" SYCL_PI_SUPPRESS_ERROR_MESSAGE" ) == nullptr &&
45- std::getenv (" UR_SUPPRESS_ERROR_MESSAGE" ) == nullptr ) {
46- const char *ErrorString = nullptr ;
47- const char *ErrorName = nullptr ;
48- cuGetErrorName (Result, &ErrorName);
49- cuGetErrorString (Result, &ErrorString);
50- std::stringstream SS;
51- SS << " \n UR CUDA ERROR:"
52- << " \n\t Value: " << Result
53- << " \n\t Name: " << ErrorName
54- << " \n\t Description: " << ErrorString
55- << " \n\t Function: " << Function << " \n\t Source Location: " << File
56- << " :" << Line << " \n "
57- << std::endl;
58- std::cerr << SS.str ();
59- }
45+ const char *ErrorString = nullptr ;
46+ const char *ErrorName = nullptr ;
47+ cuGetErrorName (Result, &ErrorName);
48+ cuGetErrorString (Result, &ErrorString);
49+ std::stringstream SS;
50+ SS << " \n UR CUDA ERROR:"
51+ << " \n\t Value: " << Result
52+ << " \n\t Name: " << ErrorName
53+ << " \n\t Description: " << ErrorString
54+ << " \n\t Function: " << Function << " \n\t Source Location: " << File
55+ << " :" << Line << " \n " ;
56+ logger::error (" {}" , SS.str ());
6057
6158 if (std::getenv (" PI_CUDA_ABORT" ) != nullptr ||
6259 std::getenv (" UR_CUDA_ABORT" ) != nullptr ) {
@@ -72,16 +69,11 @@ void checkErrorUR(ur_result_t Result, const char *Function, int Line,
7269 return ;
7370 }
7471
75- if (std::getenv (" SYCL_PI_SUPPRESS_ERROR_MESSAGE" ) == nullptr &&
76- std::getenv (" UR_SUPPRESS_ERROR_MESSAGE" ) == nullptr ) {
77- std::stringstream SS;
78- SS << " \n UR ERROR:"
79- << " \n\t Value: " << Result
80- << " \n\t Function: " << Function << " \n\t Source Location: " << File
81- << " :" << Line << " \n "
82- << std::endl;
83- std::cerr << SS.str ();
84- }
72+ std::stringstream SS;
73+ SS << " \n UR ERROR:"
74+ << " \n\t Value: " << Result << " \n\t Function: " << Function
75+ << " \n\t Source Location: " << File << " :" << Line << " \n " ;
76+ logger::error (" {}" , SS.str ());
8577
8678 if (std::getenv (" PI_CUDA_ABORT" ) != nullptr ) {
8779 std::abort ();
@@ -101,7 +93,7 @@ std::string getCudaVersionString() {
10193}
10294
10395void detail::ur::die (const char *Message) {
104- std::cerr << " ur_die: " << Message << std::endl ;
96+ logger::always ( " ur_die:{} " , Message) ;
10597 std::terminate ();
10698}
10799
@@ -110,10 +102,6 @@ void detail::ur::assertion(bool Condition, const char *Message) {
110102 die (Message);
111103}
112104
113- void detail::ur::cuPrint (const char *Message) {
114- std::cerr << " ur_print: " << Message << std::endl;
115- }
116-
117105// Global variables for ZER_EXT_RESULT_ADAPTER_SPECIFIC_ERROR
118106thread_local ur_result_t ErrorMessageCode = UR_RESULT_SUCCESS;
119107thread_local char ErrorMessage[MaxMessageSize];
0 commit comments