Set event->_stream on hipHccModuleLaunchKernel path if start/stop used

Ensure _stream is always non-null in recorded events.
Fixes isDefaultStream fault.
Этот коммит содержится в:
Ben Sander
2017-05-30 21:54:33 -05:00
родитель 997ed19bb8
Коммит 6cc5dc0326
3 изменённых файлов: 7 добавлений и 4 удалений
+3 -1
Просмотреть файл
@@ -42,11 +42,13 @@ ihipEvent_t::ihipEvent_t(unsigned flags)
// Attach to an existing completion future:
void ihipEvent_t::attachToCompletionFuture(const hc::completion_future *cf, ihipEventType_t eventType)
void ihipEvent_t::attachToCompletionFuture(const hc::completion_future *cf,
hipStream_t stream, ihipEventType_t eventType)
{
_state = hipEventStatusRecording;
_marker = *cf;
_type = eventType;
_stream = stream;
}
+2 -1
Просмотреть файл
@@ -538,6 +538,7 @@ public:
const ihipDevice_t * getDevice() const;
ihipCtx_t * getCtx() const;
// Before calling this function, stream must be resolved from "0" to the actual stream:
bool isDefaultStream() const { return _id == 0; };
public:
@@ -602,7 +603,7 @@ enum ihipEventType_t {
class ihipEvent_t {
public:
ihipEvent_t(unsigned flags);
void attachToCompletionFuture(const hc::completion_future *cf, ihipEventType_t eventType);
void attachToCompletionFuture(const hc::completion_future *cf, hipStream_t stream, ihipEventType_t eventType);
void setTimestamp();
uint64_t timestamp() const { return _timestamp; } ;
ihipEventType_t type() const { return _type; };
+2 -2
Просмотреть файл
@@ -455,10 +455,10 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
if (startEvent) {
startEvent->attachToCompletionFuture(&cf, hipEventTypeStartCommand);
startEvent->attachToCompletionFuture(&cf, hStream, hipEventTypeStartCommand);
}
if (stopEvent) {
stopEvent->attachToCompletionFuture (&cf, hipEventTypeStopCommand);
stopEvent->attachToCompletionFuture (&cf, hStream, hipEventTypeStopCommand);
}