File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -203,10 +203,15 @@ void libkineto_init(bool cpuOnly, bool logOnError) {
203
203
libkineto::api ().registerProfilerFactory ([]() -> std::unique_ptr<IActivityProfiler> {
204
204
auto returnCode = ptiViewGPULocalAvailable ();
205
205
if (returnCode != PTI_SUCCESS) {
206
- std::string errCode = std::to_string (returnCode);
207
- std::string errMsg (
206
+ std::string errPrefixMsg (
208
207
" Fail to enable Kineto Profiler on XPU due to error code: " );
209
- throw std::runtime_error (errMsg + errCode);
208
+ errPrefixMsg = errPrefixMsg + std::to_string (returnCode);
209
+ #if PTI_VERSION_MAJOR > 0 || PTI_VERSION_MINOR > 9
210
+ std::string errMsg (ptiResultTypeToString (returnCode));
211
+ throw std::runtime_error (errPrefixMsg + std::string (" . The detailed error message is: " ) + errMsg);
212
+ #else
213
+ throw std::runtime_error (errPrefixMsg);
214
+ #endif
210
215
}
211
216
return std::make_unique<XPUActivityProfiler>();
212
217
});
Original file line number Diff line number Diff line change @@ -11,6 +11,20 @@ namespace KINETO_NAMESPACE {
11
11
12
12
using namespace libkineto ;
13
13
14
+ #if PTI_VERSION_MAJOR > 0 || PTI_VERSION_MINOR > 9
15
+ #define XPUPTI_CALL (returnCode ) \
16
+ { \
17
+ if (returnCode != PTI_SUCCESS) { \
18
+ std::string funcMsg (__func__); \
19
+ std::string codeMsg = std::to_string (returnCode); \
20
+ std::string HeadMsg (" Kineto Profiler on XPU got error from function " ); \
21
+ std::string Msg (" . The error code is " ); \
22
+ std::string detailMsg (" . The detailed error message is " ); \
23
+ detailMsg = detailMsg + std::string (ptiResultTypeToString (returnCode)); \
24
+ throw std::runtime_error (HeadMsg + funcMsg + Msg + codeMsg + detailMsg); \
25
+ } \
26
+ }
27
+ #else
14
28
#define XPUPTI_CALL (returnCode ) \
15
29
{ \
16
30
if (returnCode != PTI_SUCCESS) { \
@@ -21,6 +35,7 @@ using namespace libkineto;
21
35
throw std::runtime_error (HeadMsg + funcMsg + Msg + codeMsg); \
22
36
} \
23
37
}
38
+ #endif
24
39
25
40
class XpuptiActivityApi ;
26
41
using DeviceIndex_t = int8_t ;
You can’t perform that action at this time.
0 commit comments