SWDEV-477584 - Match hipGetLastError behavior with CUDA using env var

Change-Id: I4c5acff180ae904028f7c5fdf4e109ffd1f0c4ef


[ROCm/clr commit: e3b8754448]
Tento commit je obsažen v:
Satyanvesh Dittakavi
2024-11-11 14:09:14 +00:00
rodič bfc89974e0
revize 5a16db0cd5
6 změnil soubory, kde provedl 45 přidání a 13 odebrání
+6
Zobrazit soubor
@@ -2,6 +2,12 @@
Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs.amd.com/projects/HIP/en/latest/index.html)
## HIP 6.4 (For ROCm 6.4)
### Changed
* Added new environment variable
- `DEBUG_HIP_7_PREVIEW` This is used for enabling the backward incompatible changes before the next major ROCm release 7.0. By default this is set to 0. Users can set this variable to 0x1, to match the behavior of hipGetLastError with its corresponding CUDA API.
## HIP 6.3 for ROCm 6.3
### Changed
+2 -2
Zobrazit soubor
@@ -439,7 +439,7 @@ hipError_t hipEventSynchronize(hipEvent_t event) {
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
return HIP_RETURN(hipErrorCapturedEvent);
HIP_RETURN(hipErrorCapturedEvent);
}
if (hip::Stream::StreamCaptureOngoing(e->GetCaptureStream()) == true) {
HIP_RETURN(hipErrorStreamCaptureUnsupported);
@@ -460,7 +460,7 @@ hipError_t ihipEventQuery(hipEvent_t event) {
hip::Stream* s = reinterpret_cast<hip::Stream*>(e->GetCaptureStream());
if ((s != nullptr) && (s->GetCaptureStatus() == hipStreamCaptureStatusActive)) {
s->SetCaptureStatus(hipStreamCaptureStatusInvalidated);
return HIP_RETURN(hipErrorCapturedEvent);
HIP_RETURN(hipErrorCapturedEvent);
}
return e->query();
}
+27 -9
Zobrazit soubor
@@ -164,19 +164,36 @@ const char* ihipGetErrorName(hipError_t hip_error);
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__)
#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 (hip::tls.last_command_error_ != hipSuccess && \
hip::tls.last_command_error_ != hipErrorNotReady) { \
hip::tls.last_error_ = hip::tls.last_command_error_; \
} \
} else { \
hip::tls.last_error_ = hip::tls.last_command_error_; \
} \
HIPPrintDuration(amd::LOG_INFO, amd::LOG_API, &startTimeUs, "%s: Returned %s : %s", __func__, \
hip::ihipGetErrorName(hip::tls.last_error_), ToString(__VA_ARGS__).c_str()); \
return hip::tls.last_error_;
hip::ihipGetErrorName(hip::tls.last_command_error_), \
ToString(__VA_ARGS__).c_str()); \
return hip::tls.last_command_error_;
#define HIP_RETURN(ret, ...) \
hip::tls.last_error_ = ret; \
HIP_ERROR_PRINT(hip::tls.last_error_, __VA_ARGS__) \
return hip::tls.last_error_;
#define HIP_RETURN(ret, ...) \
hip::tls.last_command_error_ = ret; \
if (DEBUG_HIP_7_PREVIEW & amd::CHANGE_HIP_GET_LAST_ERROR) { \
if (hip::tls.last_command_error_ != hipSuccess && \
hip::tls.last_command_error_ != hipErrorNotReady) { \
hip::tls.last_error_ = hip::tls.last_command_error_; \
} \
} else { \
hip::tls.last_error_ = hip::tls.last_command_error_; \
} \
HIP_ERROR_PRINT(hip::tls.last_command_error_, __VA_ARGS__) \
return hip::tls.last_command_error_;
#define HIP_RETURN_ONFAIL(func) \
do { \
@@ -610,7 +627,7 @@ public:
public:
Device* device_;
std::stack<Device*> ctxt_stack_;
hipError_t last_error_;
hipError_t last_error_, last_command_error_;
std::vector<hip::Stream*> capture_streams_;
hipStreamCaptureMode stream_capture_mode_;
std::stack<ihipExec_t> exec_stack_;
@@ -618,6 +635,7 @@ public:
TlsAggregator(): device_(nullptr),
last_error_(hipSuccess),
last_command_error_(hipSuccess),
stream_capture_mode_(hipStreamCaptureModeGlobal) {
}
~TlsAggregator() {
+1 -1
Zobrazit soubor
@@ -4621,7 +4621,7 @@ hipError_t hipExternalMemoryGetMappedMipmappedArray(
hip::getNumChannels(mipmapDesc->formatDesc),
mipmapDesc->flags};
if (!hip::CheckArrayFormat(mipmapDesc->formatDesc)) {
return HIP_RETURN(hipErrorInvalidValue);
HIP_RETURN(hipErrorInvalidValue);
}
HIP_RETURN(ihipMipmapArrayCreate(mipmap, &allocateArray, mipmapDesc->numLevels,
+5
Zobrazit soubor
@@ -68,6 +68,11 @@ enum LogMask {
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
extern FILE* outFile;
+4 -1
Zobrazit soubor
@@ -266,9 +266,12 @@ release(bool, DEBUG_CLR_SYSMEM_POOL, false, \
release(bool, DEBUG_HIP_KERNARG_COPY_OPT, true, \
"Enable/Disable multiple kern arg copies") \
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, \
"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 {