kfd trace fix: disbale recursive callback; disable open/close API tracing;

[ROCm/roctracer commit: 8475e25e7a]
Этот коммит содержится в:
Evgeny
2019-12-03 09:43:50 -06:00
родитель ee740ba45d
Коммит 3b897c2e31
2 изменённых файлов: 6 добавлений и 3 удалений
+2 -3
Просмотреть файл
@@ -406,8 +406,7 @@ class API_DescrParser:
call_id = self.api_id[call];
ret_type = struct['ret']
self.content_h += ret_type + ' ' + call + '_callback(' + struct['args'] + ') {\n' # 'static ' +
if call == 'hsaKmtOpenKFD':
self.content_h += ' if (' + name + '_table == NULL) intercept_KFDApiTable();\n'
self.content_h += ' if (' + name + '_table == NULL) intercept_KFDApiTable();\n'
self.content_h += ' kfd_api_data_t api_data{};\n'
for var in struct['alst']:
self.content_h += ' api_data.args.' + call + '.' + var.replace("[]","") + ' = ' + var.replace("[]","") + ';\n'
@@ -525,7 +524,7 @@ class API_DescrParser:
self.content_cpp += ' return true;\n';
self.content_cpp += '}\n\n';
if call != '-':
if call != '-' and call != 'hsaKmtCloseKFD' and call != 'hsaKmtOpenKFD':
self.content_cpp += 'PUBLIC_API ' + struct['ret'] + " " + call + '(' + struct['args'] + ') { return roctracer::kfd_support::' + call + '_callback('
for i in range(0,len(struct['alst'])):
if i == (len(struct['alst'])-1):
+4
Просмотреть файл
@@ -435,6 +435,7 @@ void hcc_activity_callback(const char* begin, const char* end, void* arg) {
// KFD API tracing
// KFD API callback function
static thread_local bool in_kfd_api_callback = false;
void kfd_api_callback(
uint32_t domain,
uint32_t cid,
@@ -442,6 +443,8 @@ void kfd_api_callback(
void* arg)
{
(void)arg;
if (in_kfd_api_callback) return;
in_kfd_api_callback = true;
const kfd_api_data_t* data = reinterpret_cast<const kfd_api_data_t*>(callback_data);
if (data->phase == ACTIVITY_API_PHASE_ENTER) {
kfd_begin_timestamp = timer->timestamp_fn_ns();
@@ -451,6 +454,7 @@ void kfd_api_callback(
os << kfd_begin_timestamp << ":" << end_timestamp << " " << GetPid() << ":" << GetTid() << " " << kfd_api_data_pair_t(cid, *data);
fprintf(kfd_api_file_handle, "%s\n", os.str().c_str());
}
in_kfd_api_callback = false;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////