Merge pull request #249 from bensander/warn_event

Add HIP_DB=warn + message if sync on dangerous event.

[ROCm/clr commit: 958ca62c63]
This commit is contained in:
Maneesh Gupta
2017-11-06 07:25:40 +05:30
committed by GitHub
2 changed files with 11 additions and 1 deletions
+8
View File
@@ -191,6 +191,10 @@ hipError_t hipEventSynchronize(hipEvent_t event)
{
HIP_INIT_SPECIAL_API(TRACE_SYNC, event);
if (!(event->_flags & hipEventReleaseToSystem)) {
tprintf(DB_WARN, "hipEventSynchronize on event without system-scope fence ; consider creating with hipEventReleaseToSystem\n");
}
if (event) {
if (event->_state == hipEventStatusUnitialized) {
return ihipLogStatus(hipErrorInvalidResourceHandle);
@@ -268,6 +272,10 @@ hipError_t hipEventQuery(hipEvent_t event)
{
HIP_INIT_SPECIAL_API(TRACE_QUERY, event);
if (!(event->_flags & hipEventReleaseToSystem)) {
tprintf(DB_WARN, "hipEventQuery on event without system-scope fence ; consider creating with hipEventReleaseToSystem\n");
}
if ((event->_state == hipEventStatusRecording) && !event->locked_isReady()) {
return ihipLogStatus(hipErrorNotReady);
} else {
+3 -1
View File
@@ -218,7 +218,8 @@ extern const char *API_COLOR_END;
#define DB_SYNC 1 /* 0x02 - trace synchronization pieces */
#define DB_MEM 2 /* 0x04 - trace memory allocation / deallocation */
#define DB_COPY 3 /* 0x08 - trace memory copy and peer commands. . */
#define DB_MAX_FLAG 4
#define DB_WARN 4 /* 0x10 - warn about sub-optimal or shady behavior */
#define DB_MAX_FLAG 5
// When adding a new debug flag, also add to the char name table below.
//
//
@@ -235,6 +236,7 @@ static const DbName dbName [] =
{KYEL, "sync"},
{KCYN, "mem"},
{KMAG, "copy"},
{KRED, "warn"},
};