Add a new flag for profilingInfo to record gpu TS

Add a flag to record gpu TS in a marker, also disable marker flush
if there was already a marker submitted before.

Change-Id: I9cdf8e49137690c0050fe9370764dd059855a2f8


[ROCm/clr commit: db7ed1a78c]
Esse commit está contido em:
Saleel Kudchadker
2020-10-17 10:18:45 -07:00
commit c43e5d83dd
2 arquivos alterados com 21 adições e 17 exclusões
+19 -16
Ver Arquivo
@@ -138,26 +138,29 @@ hipError_t Event::streamWait(amd::HostQueue* hostQueue, uint flags) {
}
void Event::addMarker(amd::HostQueue* queue, amd::Command* command, bool record) {
amd::ScopedLock lock(lock_);
if (command == nullptr) {
command = queue->getLastQueuedCommand(true);
if (queue->properties().test(CL_QUEUE_PROFILING_ENABLE)) {
if (command == nullptr) {
command = queue->getLastQueuedCommand(true);
if ((command == nullptr) || (command->type() == 0)) {
// if lastEnqueuedCommand is user invisible command(command->type() == 0),
// which is only used for sync, create a new amd:Marker
// and release() lastEnqueuedCommand
if (command != nullptr) {
command->release();
}
command = new amd::Marker(*queue, kMarkerDisableFlush);
command->enqueue();
bool cmdNullOrMarker = (command == nullptr) || (command->type() == 0);
// If lastQueuedCommand is user invisible command(command->type() == 0),
// Always submit a marker if queue profiling is not explicitly enabled else
// submit a normal marker. Disable queue flush to batch commands
if (!queue->properties().test(CL_QUEUE_PROFILING_ENABLE)) {
if (command != nullptr) {
command->release();
}
command = new hip::ProfileMarker(*queue, cmdNullOrMarker, true);
command->enqueue();
} else if (cmdNullOrMarker) {
if (command != nullptr) {
command->release();
}
command = new amd::Marker(*queue, kMarkerDisableFlush);
command->enqueue();
}
} else if (command == nullptr) {
command = new hip::ProfileMarker(*queue, false);
command->enqueue();
}
amd::ScopedLock lock(lock_);
if (event_ == &command->event()) return;
+2 -1
Ver Arquivo
@@ -28,10 +28,11 @@ namespace hip {
class ProfileMarker: public amd::Marker {
public:
ProfileMarker(amd::HostQueue& queue, bool disableFlush)
ProfileMarker(amd::HostQueue& queue, bool disableFlush, bool markerTs)
: amd::Marker(queue, disableFlush) {
profilingInfo_.enabled_ = true;
profilingInfo_.callback_ = nullptr;
profilingInfo_.marker_ts_ = markerTs;
profilingInfo_.clear();
}
};