dispatch vs profiling packets signals race fixed
Change-Id: I7f250d01f3d45f3f8ec2539b2187ab99503850aa
이 커밋은 다음에 포함됨:
+27
-12
@@ -8,6 +8,7 @@
|
||||
#include <dirent.h>
|
||||
#include <hsa.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@@ -243,10 +244,15 @@ void output_group(FILE* file, const rocprofiler_group_t* group, const char* str)
|
||||
}
|
||||
|
||||
// Dump stored context profiling output data
|
||||
void dump_context(context_entry_t* entry) {
|
||||
bool dump_context(context_entry_t* entry) {
|
||||
hsa_status_t status = HSA_STATUS_ERROR;
|
||||
|
||||
if (entry->valid) {
|
||||
const rocprofiler_dispatch_record_t* record = entry->data.record;
|
||||
if (record) {
|
||||
if (record->complete == 0) return false;
|
||||
}
|
||||
|
||||
++context_collected;
|
||||
entry->valid = 0;
|
||||
const uint32_t index = entry->index;
|
||||
@@ -254,18 +260,22 @@ void dump_context(context_entry_t* entry) {
|
||||
const rocprofiler_feature_t* features = entry->features;
|
||||
const unsigned feature_count = entry->feature_count;
|
||||
|
||||
fprintf(file_handle, "dispatch[%u], queue_index(%lu), kernel_name(\"%s\"), time(%lu,%lu,%lu,%lu)\n",
|
||||
fprintf(file_handle, "dispatch[%u], queue_index(%lu), kernel_name(\"%s\")",
|
||||
index,
|
||||
entry->data.queue_index,
|
||||
entry->data.kernel_name,
|
||||
entry->data.record->dispatch,
|
||||
entry->data.record->begin,
|
||||
entry->data.record->end,
|
||||
entry->data.record->complete);
|
||||
entry->data.kernel_name);
|
||||
if (record) fprintf(file_handle, ", time(%lu,%lu,%lu,%lu)",
|
||||
record->dispatch,
|
||||
record->begin,
|
||||
record->end,
|
||||
record->complete);
|
||||
fprintf(file_handle, "\n");
|
||||
fflush(file_handle);
|
||||
|
||||
delete entry->data.record;
|
||||
entry->data.record = NULL;
|
||||
if (record) {
|
||||
delete record;
|
||||
entry->data.record = NULL;
|
||||
}
|
||||
|
||||
rocprofiler_group_t& group = entry->group;
|
||||
if (group.context != NULL) {
|
||||
@@ -285,6 +295,8 @@ void dump_context(context_entry_t* entry) {
|
||||
rocprofiler_close(group.context);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Dump all stored contexts profiling output data
|
||||
@@ -303,8 +315,9 @@ void dump_context_array() {
|
||||
}
|
||||
|
||||
// Profiling completion handler
|
||||
void handler(rocprofiler_group_t group, void* arg) {
|
||||
bool handler(rocprofiler_group_t group, void* arg) {
|
||||
context_entry_t* entry = reinterpret_cast<context_entry_t*>(arg);
|
||||
bool ret = false;
|
||||
|
||||
if (pthread_mutex_lock(&mutex) != 0) {
|
||||
perror("pthread_mutex_lock");
|
||||
@@ -312,14 +325,16 @@ void handler(rocprofiler_group_t group, void* arg) {
|
||||
}
|
||||
|
||||
if (context_array->find(entry->index) != context_array->end()) {
|
||||
dump_context(entry);
|
||||
dealloc_context_entry(entry);
|
||||
if (dump_context(entry)) dealloc_context_entry(entry);
|
||||
else ret = true;
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&mutex) != 0) {
|
||||
perror("pthread_mutex_unlock");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Kernel disoatch callback
|
||||
|
||||
+1
-2
@@ -40,7 +40,6 @@
|
||||
<metric name="TCC_MC_WRREQ_STALL" block=TCC event=28 descr="Number of cycles a write request was stalled."></metric>
|
||||
|
||||
<metric name="TCP_TA_DATA_STALL_CYCLES" block=TCP event=3 descr="TCP stalls TA data interface. Now Windowed."></metric>
|
||||
<metric name="TCP_TCP_TA_DATA_STALL_CYCLES" block=TCP event=3 descr="TCP stalls TA data interface. Not Windowed."></metric>
|
||||
|
||||
<metric name=CPC_ALWAYS_COUNT block=CPC event=0 ></metric>
|
||||
<metric name=CPC_ME1_STALL_WAIT_ON_RCIU_READ block=CPC event=8 ></metric>
|
||||
@@ -86,7 +85,7 @@
|
||||
<metric name=TCC_EA_RDREQ block=TCC event=41 ></metric>
|
||||
<metric name=TCC_EA_RDREQ_32B block=TCC event=42 ></metric>
|
||||
|
||||
<metric name=TCP_TA_DATA_STALL_CYCLES block=TCP event=6 descr="TCP stalls TA data interface. Now Windowed."></metric>
|
||||
<metric name="TCP_TA_DATA_STALL_CYCLES" block=TCP event=6 descr="TCP stalls TA data interface. Now Windowed."></metric>
|
||||
|
||||
<metric name=CPC_ALWAYS_COUNT block=CPC event=0 ></metric>
|
||||
<metric name=CPC_ME1_STALL_WAIT_ON_RCIU_READ block=CPC event=8 ></metric>
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@
|
||||
<metric
|
||||
name="MemUnitStalled"
|
||||
descr="The percentage of GPUTime the memory unit is stalled. Try reducing the number or size of fetches and writes if possible. Value range: 0% (optimal) to 100% (bad)."
|
||||
expr=100*max(TCP_TCP_TA_DATA_STALL_CYCLES,16)/GRBM_GUI_ACTIVE/SE_NUM
|
||||
expr=100*max(TCP_TA_DATA_STALL_CYCLES,16)/GRBM_GUI_ACTIVE/SE_NUM
|
||||
></metric>
|
||||
|
||||
# WriteUnitStalled The percentage of GPUTime the Write unit is stalled. Value range: 0% to 100% (bad).
|
||||
|
||||
새 이슈에서 참조
사용자 차단