| 1448 | #endif |
| 1449 | |
| 1450 | template <typename Tp> void ToolsInit(Tp* table) { |
| 1451 | #if HIP_ROCPROFILER_REGISTER > 0 |
| 1452 | auto table_array = std::array<void*, 1>{static_cast<void*>(table)}; |
| 1453 | auto lib_id = rocprofiler_register_library_indentifier_t{}; |
| 1454 | auto rocp_reg_status = rocprofiler_register_library_api_table( |
| 1455 | dispatch_table_info<Tp>::name, dispatch_table_info<Tp>::import_func, |
| 1456 | dispatch_table_info<Tp>::version, table_array.data(), table_array.size(), &lib_id); |
| 1457 | |
| 1458 | // TODO(jrmadsen): check environment variable? Does this need to compile on Windows? |
| 1459 | bool report_register_errors = false; |
| 1460 | if (report_register_errors && rocp_reg_status != ROCP_REG_SUCCESS) |
| 1461 | fprintf(stderr, "rocprofiler-register failed for %s with error code %i: %s\n", |
| 1462 | dispatch_table_info<Tp>::name, rocp_reg_status, |
| 1463 | rocprofiler_register_error_string(rocp_reg_status)); |
| 1464 | #else |
| 1465 | (void)table; |
| 1466 | #endif |
| 1467 | } |
| 1468 | |
| 1469 | template <typename Tp> Tp& GetDispatchTableImpl() { |
| 1470 | // using a static inside a function prevents static initialization fiascos |
no test coverage detected