Dateien
rocm-systems/rocclr/runtime/device/gpu/gputhreadtrace.cpp
T

62 Zeilen
1.5 KiB
C++

2014-07-04 16:17:05 -04:00
//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#include "device/gpu/gputhreadtrace.hpp"
#include "device/gpu/gpuvirtual.hpp"
namespace gpu {
CalThreadTraceReference::~CalThreadTraceReference() {
// The thread trace object is always associated with a particular queue,
// so we have to lock just this queue
amd::ScopedLock lock(gpu_.execution());
2014-07-04 16:17:05 -04:00
if (0 != threadTrace_) {
// gpu().cs()->destroyQuery(gslThreadTrace());
}
2014-07-04 16:17:05 -04:00
}
ThreadTrace::~ThreadTrace() {
if (calRef_ == NULL) {
return;
}
for (uint i = 0; i < amdThreadTraceMemObjsNum_; ++i) {
threadTraceBufferObjs_[i]->attachMemObject(gpu().cs(), NULL, 0, 0, 0, i);
gpu().cs()->destroyShaderTraceBuffer(threadTraceBufferObjs_[i]);
}
2014-07-04 16:17:05 -04:00
// Release the thread trace reference object
// calRef_->release();
2014-07-04 16:17:05 -04:00
}
bool ThreadTrace::create(CalThreadTraceReference* calRef) {
assert(&gpu() == &calRef->gpu());
2014-07-04 16:17:05 -04:00
calRef_ = calRef;
threadTrace_ = calRef->gslThreadTrace();
2014-07-04 16:17:05 -04:00
return true;
2014-07-04 16:17:05 -04:00
}
bool ThreadTrace::info(uint infoType, uint* info, uint infoSize) const {
switch (infoType) {
2014-07-04 16:17:05 -04:00
case CL_THREAD_TRACE_BUFFERS_SIZE: {
if (infoSize < amdThreadTraceMemObjsNum_) {
LogError("The amount of buffers should be equal to the amount of Shader Engines");
2014-07-04 16:17:05 -04:00
return false;
} else {
gslThreadTrace()->GetResultAll(gpu().cs(), info);
}
break;
2014-07-04 16:17:05 -04:00
}
default:
LogError("Wrong ThreadTrace::getInfo parameter");
return false;
}
return true;
2014-07-04 16:17:05 -04:00
}
} // namespace gpu