normalizing C API

[ROCm/roctracer commit: 077f8ec6b6]
Dieser Commit ist enthalten in:
Evgeny
2019-12-26 06:40:49 -06:00
Ursprung 0f95193082
Commit bca4e77df9
15 geänderte Dateien mit 162 neuen und 103 gelöschten Zeilen
+5 -3
Datei anzeigen
@@ -284,7 +284,6 @@ class API_DescrParser:
self.content_h += '#include <string.h>\n'
self.content_h += '#include \"roctracer_kfd.h\"\n'
self.content_h += '#include \"hsakmt.h\"\n'
self.content_h += '#include \"cb_table.h\"\n'
self.content_h += '#define PUBLIC_API __attribute__((visibility(\"default\")))\n'
@@ -293,6 +292,7 @@ class API_DescrParser:
self.content_h += '\n'
self.content_h += '#if PROF_API_IMPL\n'
self.content_h += '#include \"cb_table.h\"\n'
self.content_h += 'namespace roctracer {\n'
self.content_h += 'namespace kfd_support {\n'
@@ -372,7 +372,7 @@ class API_DescrParser:
# generate API args structure
def gen_arg_struct(self, n, name, call, struct):
if n == -1:
self.content_h += 'struct kfd_api_data_t {\n'
self.content_h += 'typedef struct kfd_api_data_s {\n'
self.content_h += ' uint64_t correlation_id;\n'
self.content_h += ' uint32_t phase;\n'
if len(self.api_rettypes) != 0:
@@ -394,7 +394,7 @@ class API_DescrParser:
self.content_h += ' } ' + call + ';\n'
else:
self.content_h += ' } args;\n'
self.content_h += '};\n'
self.content_h += '} kfd_api_data_t;\n'
# generate API callbacks
def gen_callbacks(self, n, name, call, struct):
@@ -476,6 +476,7 @@ class API_DescrParser:
# generate stream operator
def gen_out_stream(self, n, name, call, struct):
if n == -1:
self.content_h += '#ifdef __cplusplus\n'
self.content_h += 'typedef std::pair<uint32_t, kfd_api_data_t> kfd_api_data_pair_t;\n'
self.content_h += 'inline std::ostream& operator<< (std::ostream& out, const kfd_api_data_pair_t& data_pair) {\n'
self.content_h += ' const uint32_t cid = data_pair.first;\n'
@@ -509,6 +510,7 @@ class API_DescrParser:
self.content_h += ' }\n'
self.content_h += ' return out;\n'
self.content_h += '}\n'
self.content_h += '#endif\n'
self.content_cpp += 'inline std::ostream& operator<< (std::ostream& out, const HsaMemFlags& v) { out << "HsaMemFlags"; return out; }\n'
# generate PUBLIC_API for all API fcts