SWDEV-446123 - Match hipGetLastError behavior with CUDA using env var
Change-Id: Iaec697c1304d746376ecf2bfe2ad683b15ee189f
This commit is contained in:
@@ -439,7 +439,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) {
|
|||||||
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
|
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
|
||||||
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
|
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
|
||||||
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
|
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
|
||||||
return HIP_RETURN(hipErrorCapturedEvent);
|
HIP_RETURN(hipErrorCapturedEvent);
|
||||||
}
|
}
|
||||||
if (hip::Stream::StreamCaptureOngoing(e->GetCaptureStream()) == true) {
|
if (hip::Stream::StreamCaptureOngoing(e->GetCaptureStream()) == true) {
|
||||||
HIP_RETURN(hipErrorStreamCaptureUnsupported);
|
HIP_RETURN(hipErrorStreamCaptureUnsupported);
|
||||||
@@ -460,7 +460,7 @@ hipError_t ihipEventQuery(hipEvent_t event) {
|
|||||||
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
|
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
|
||||||
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
|
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
|
||||||
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
|
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
|
||||||
return HIP_RETURN(hipErrorCapturedEvent);
|
HIP_RETURN(hipErrorCapturedEvent);
|
||||||
}
|
}
|
||||||
return e->query();
|
return e->query();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,19 +164,34 @@ const char* ihipGetErrorName(hipError_t hip_error);
|
|||||||
HIP_RETURN(hipErrorNoDevice); \
|
HIP_RETURN(hipErrorNoDevice); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HIP_INIT_API_NO_RETURN(cid, ...) \
|
#define HIP_INIT_API_NO_RETURN(cid, ...) \
|
||||||
HIP_INIT_API_INTERNAL(1, cid, __VA_ARGS__)
|
HIP_INIT_API_INTERNAL(1, cid, __VA_ARGS__)
|
||||||
|
|
||||||
#define HIP_RETURN_DURATION(ret, ...) \
|
#define HIP_RETURN_DURATION(ret, ...) \
|
||||||
hip::tls.last_error_ = ret; \
|
hip::tls.last_command_error_ = ret; \
|
||||||
|
if (DEBUG_HIP_7_PREVIEW & amd::CHANGE_HIP_GET_LAST_ERROR) { \
|
||||||
|
if (ret != hipSuccess && ret != hipErrorNotReady) { \
|
||||||
|
hip::tls.last_error_ = ret; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
hip::tls.last_error_ = ret; \
|
||||||
|
} \
|
||||||
HIPPrintDuration(amd::LOG_INFO, amd::LOG_API, &startTimeUs, "%s: Returned %s : %s", __func__, \
|
HIPPrintDuration(amd::LOG_INFO, amd::LOG_API, &startTimeUs, "%s: Returned %s : %s", __func__, \
|
||||||
hip::ihipGetErrorName(hip::tls.last_error_), ToString(__VA_ARGS__).c_str()); \
|
hip::ihipGetErrorName(hip::tls.last_command_error_), \
|
||||||
return hip::tls.last_error_;
|
ToString(__VA_ARGS__).c_str()); \
|
||||||
|
return hip::tls.last_command_error_;
|
||||||
|
|
||||||
#define HIP_RETURN(ret, ...) \
|
#define HIP_RETURN(ret, ...) \
|
||||||
hip::tls.last_error_ = ret; \
|
hip::tls.last_command_error_ = ret; \
|
||||||
HIP_ERROR_PRINT(hip::tls.last_error_, __VA_ARGS__) \
|
if (DEBUG_HIP_7_PREVIEW & amd::CHANGE_HIP_GET_LAST_ERROR) { \
|
||||||
return hip::tls.last_error_;
|
if (ret != hipSuccess && ret != hipErrorNotReady) { \
|
||||||
|
hip::tls.last_error_ = ret; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
hip::tls.last_error_ = ret; \
|
||||||
|
} \
|
||||||
|
HIP_ERROR_PRINT(hip::tls.last_command_error_, __VA_ARGS__) \
|
||||||
|
return hip::tls.last_command_error_;
|
||||||
|
|
||||||
#define HIP_RETURN_ONFAIL(func) \
|
#define HIP_RETURN_ONFAIL(func) \
|
||||||
do { \
|
do { \
|
||||||
@@ -610,7 +625,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
Device* device_;
|
Device* device_;
|
||||||
std::stack<Device*> ctxt_stack_;
|
std::stack<Device*> ctxt_stack_;
|
||||||
hipError_t last_error_;
|
hipError_t last_error_, last_command_error_;
|
||||||
std::vector<hip::Stream*> capture_streams_;
|
std::vector<hip::Stream*> capture_streams_;
|
||||||
hipStreamCaptureMode stream_capture_mode_;
|
hipStreamCaptureMode stream_capture_mode_;
|
||||||
std::stack<ihipExec_t> exec_stack_;
|
std::stack<ihipExec_t> exec_stack_;
|
||||||
@@ -618,6 +633,7 @@ public:
|
|||||||
|
|
||||||
TlsAggregator(): device_(nullptr),
|
TlsAggregator(): device_(nullptr),
|
||||||
last_error_(hipSuccess),
|
last_error_(hipSuccess),
|
||||||
|
last_command_error_(hipSuccess),
|
||||||
stream_capture_mode_(hipStreamCaptureModeGlobal) {
|
stream_capture_mode_(hipStreamCaptureModeGlobal) {
|
||||||
}
|
}
|
||||||
~TlsAggregator() {
|
~TlsAggregator() {
|
||||||
|
|||||||
@@ -4621,7 +4621,7 @@ hipError_t hipExternalMemoryGetMappedMipmappedArray(
|
|||||||
hip::getNumChannels(mipmapDesc->formatDesc),
|
hip::getNumChannels(mipmapDesc->formatDesc),
|
||||||
mipmapDesc->flags};
|
mipmapDesc->flags};
|
||||||
if (!hip::CheckArrayFormat(mipmapDesc->formatDesc)) {
|
if (!hip::CheckArrayFormat(mipmapDesc->formatDesc)) {
|
||||||
return HIP_RETURN(hipErrorInvalidValue);
|
HIP_RETURN(hipErrorInvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIP_RETURN(ihipMipmapArrayCreate(mipmap, &allocateArray, mipmapDesc->numLevels,
|
HIP_RETURN(ihipMipmapArrayCreate(mipmap, &allocateArray, mipmapDesc->numLevels,
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ enum LogMask {
|
|||||||
LOG_ALWAYS = -1 //!< (0xFFFFFFFF) Log always even mask flag is zero
|
LOG_ALWAYS = -1 //!< (0xFFFFFFFF) Log always even mask flag is zero
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Flags to support backward incompatible changes before 7.0
|
||||||
|
enum BreakingHipChange7 {
|
||||||
|
CHANGE_HIP_GET_LAST_ERROR = 1, //!< (0x1) HIP_GET_LAST_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
//! \brief log file output
|
//! \brief log file output
|
||||||
extern FILE* outFile;
|
extern FILE* outFile;
|
||||||
|
|
||||||
|
|||||||
@@ -266,9 +266,12 @@ release(bool, DEBUG_CLR_SYSMEM_POOL, true, \
|
|||||||
release(bool, DEBUG_HIP_KERNARG_COPY_OPT, true, \
|
release(bool, DEBUG_HIP_KERNARG_COPY_OPT, true, \
|
||||||
"Enable/Disable multiple kern arg copies") \
|
"Enable/Disable multiple kern arg copies") \
|
||||||
release(bool, DEBUG_CLR_USE_STDMUTEX_IN_AMD_MONITOR, false, \
|
release(bool, DEBUG_CLR_USE_STDMUTEX_IN_AMD_MONITOR, false, \
|
||||||
"Use std::mutex in amd::monotor") \
|
"Use std::mutex in amd::monitor") \
|
||||||
release(bool, DEBUG_CLR_KERNARG_HDP_FLUSH_WA, false, \
|
release(bool, DEBUG_CLR_KERNARG_HDP_FLUSH_WA, false, \
|
||||||
"Toggle kernel arg copy workaround") \
|
"Toggle kernel arg copy workaround") \
|
||||||
|
release(uint, DEBUG_HIP_7_PREVIEW, 0, \
|
||||||
|
"Enables specific backward incompatible changes support before 7.0," \
|
||||||
|
"using the mask. By default the changes are disabled and is set to 0")\
|
||||||
|
|
||||||
namespace amd {
|
namespace amd {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user