P4 to Git Change 1151415 by jatang@jatang-opencl-hsa-stg1 on 2015/05/15 11:06:22
EPR #412821 - Fix a crash when the ThreadTrace Object is freed before a ThreadTrace command is processed.
Also change 'None' to 'Undefined', since 'None' is a macro defined in X.h.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#77 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/threadtrace.hpp#5 edit
[ROCm/clr commit: 5da96e702c]
This commit is contained in:
@@ -23,6 +23,8 @@
|
|||||||
#include "device/device.hpp"
|
#include "device/device.hpp"
|
||||||
#include "utils/concurrent.hpp"
|
#include "utils/concurrent.hpp"
|
||||||
#include "platform/memory.hpp"
|
#include "platform/memory.hpp"
|
||||||
|
#include "platform/perfctr.hpp"
|
||||||
|
#include "platform/threadtrace.hpp"
|
||||||
|
|
||||||
#include "CL/cl_ext.h"
|
#include "CL/cl_ext.h"
|
||||||
|
|
||||||
@@ -1043,7 +1045,18 @@ public:
|
|||||||
: Command(queue, 0, eventWaitList)
|
: Command(queue, 0, eventWaitList)
|
||||||
, counterList_(counterList)
|
, counterList_(counterList)
|
||||||
, state_(state)
|
, state_(state)
|
||||||
{ }
|
{
|
||||||
|
for (uint i = 0; i < counterList_.size(); ++i) {
|
||||||
|
counterList_[i]->retain();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void releaseResources() {
|
||||||
|
for (uint i = 0; i < counterList_.size(); ++i) {
|
||||||
|
counterList_[i]->release();
|
||||||
|
}
|
||||||
|
Command::releaseResources();
|
||||||
|
}
|
||||||
|
|
||||||
//! Gets the number of PerfCounter objects
|
//! Gets the number of PerfCounter objects
|
||||||
size_t getNumCounters() const { return counterList_.size(); }
|
size_t getNumCounters() const { return counterList_.size(); }
|
||||||
@@ -1090,9 +1103,11 @@ public:
|
|||||||
obj->retain();
|
obj->retain();
|
||||||
memObjects_[i] = obj;
|
memObjects_[i] = obj;
|
||||||
}
|
}
|
||||||
|
threadTrace_.retain();
|
||||||
}
|
}
|
||||||
//! Release all resources associated with this command
|
//! Release all resources associated with this command
|
||||||
void releaseResources() {
|
void releaseResources() {
|
||||||
|
threadTrace_.release();
|
||||||
for(std::vector<amd::Memory*>::const_iterator itr = memObjects_.begin();
|
for(std::vector<amd::Memory*>::const_iterator itr = memObjects_.begin();
|
||||||
itr != memObjects_.end(); itr++) {
|
itr != memObjects_.end(); itr++) {
|
||||||
(*itr)->release();
|
(*itr)->release();
|
||||||
@@ -1143,7 +1158,7 @@ public:
|
|||||||
Resume = 3 //!< Issue a resume command
|
Resume = 3 //!< Issue a resume command
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Construct a new PerfCounterCommand
|
//! Construct a new ThreadTraceCommand
|
||||||
ThreadTraceCommand(
|
ThreadTraceCommand(
|
||||||
HostQueue& queue,
|
HostQueue& queue,
|
||||||
const EventWaitList& eventWaitList,
|
const EventWaitList& eventWaitList,
|
||||||
@@ -1160,6 +1175,13 @@ public:
|
|||||||
if (threadTraceConfig_) {
|
if (threadTraceConfig_) {
|
||||||
memcpy(threadTraceConfig_, threadTraceConfig, size);
|
memcpy(threadTraceConfig_, threadTraceConfig, size);
|
||||||
}
|
}
|
||||||
|
threadTrace_.retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Release all resources associated with this command
|
||||||
|
void releaseResources() {
|
||||||
|
threadTrace_.release();
|
||||||
|
Command::releaseResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Get the thread trace object
|
//! Get the thread trace object
|
||||||
@@ -1176,7 +1198,7 @@ public:
|
|||||||
void* threadTraceConfig() const { return threadTraceConfig_; }
|
void* threadTraceConfig() const { return threadTraceConfig_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThreadTrace& threadTrace_; //!< The list of performance counters
|
ThreadTrace& threadTrace_; //!< The list of performance counters
|
||||||
State state_; //!< State of the issued command
|
State state_; //!< State of the issued command
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ThreadTrace : public RuntimeObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum State {
|
enum State {
|
||||||
None,
|
Undefined,
|
||||||
MemoryBound,
|
MemoryBound,
|
||||||
Begin,
|
Begin,
|
||||||
End,
|
End,
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
const Device& device) //!< device object
|
const Device& device) //!< device object
|
||||||
: deviceThreadTrace_(NULL)
|
: deviceThreadTrace_(NULL)
|
||||||
,device_(device)
|
,device_(device)
|
||||||
,state_(None)
|
,state_(Undefined)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//! Get the thread trace's associated device
|
//! Get the thread trace's associated device
|
||||||
|
|||||||
Reference in New Issue
Block a user