Instead of dlopen'ing RTLD_NOLOAD a library (for example libamdhip64.so)
and rely on the dynamic linker search path, search through the already
loaded shared objects for a library with a matching name.
Change-Id: I3e74d432bd7ca68df8927ca435b290e86aaaf9e9
Make error codes more informative and have negative values. This is an
ABI break but it does not appear known tools are relying on the exact
error codes.
Use logging for all errors so that roctracer_error_string will be able
to return last error message.
Make internal errors fatal and abort.
Do not use the tracer API exceptions in the tracer tool.
Change-Id: Ie8ed3d50e5ad26625ac9d1263f7e048edb5584c0
Replace EXC_ABORT() checks with assertions.
Rewrite the exception class to use std::runtime_error (as it
already handles the std::string/char* message argument).
Change-Id: I48e31924f3aea1328e6562ab6bb06ec373fd5d5e
Removing DEBUG_TRACES and the unnecessary use of roctracer_op_string, made the MS app reporting 78 to 81 stable samples per second, depending on the type of the trace, while the main app without rocprof reports 100 to 106. More detailed numbers will be posted in the ticket.
Change-Id: Ifbc529278cea54dd23e6086aa9b9ea2df952d5dd
HCC_EXC_RAISING and HIP_EXC_RAISING don't add much value, so to
simplify, only keep EXC_RAISING and EXC_ABORT.
Change-Id: Ifdc54981bb682fe68b418cdc95ecebe668e3dcf6
In HsaTimer::correlated_pair_ns, the time ID should be used to
select the clock ID passed to clock_gettime.
In MemoryPool::allocator_default, pass the correct value to realloc.
Change-Id: I5d10c0994c07fdeadd99c81deba4e71a4f579523
On Ubuntu 20.04, in Release mode, gcc fails with this error:
In file included from /usr/include/string.h:495,
from /opt/rocm/include/hsa/hsa_api_trace.h:57,
from ../roctracer/src/util/hsa_rsrc_factory.h:29,
from ../roctracer/src/util/hsa_rsrc_factory.cpp:25:
In function ‘char* strncpy(char*, const char*, size_t)’,
inlined from ‘const util::AgentInfo* util::HsaRsrcFactory::AddAgentInfo(hsa_agent_t)’ at ../roctracer/src/util/hsa_rsrc_factory.cpp:323:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: ‘char* __builtin___strncpy_chk(char*, const char*, long unsigned int, long unsigned int)’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../roctracer/src/util/hsa_rsrc_factory.cpp: In member function ‘const util::AgentInfo* util::HsaRsrcFactory::AddAgentInfo(hsa_agent_t)’:
../roctracer/src/util/hsa_rsrc_factory.cpp:322:39: note: length computed here
322 | const int gfxip_label_len = strlen(agent_info->name) - 2;
| ~~~~~~^~~~~~~~~~~~~~~~~~
The error is caused by the following 2 lines:
const int gfxip_label_len = strlen(agent_info->name) - 2;
strncpy(agent_info->gfxip, agent_info->name, gfxip_label_len);
The size argument to strncpy should not depend on the input string.
Since the terminating character is not considered (the copy is at
most len - 2 bytes), using memcpy is preferable. Also, make sure
the destination does not overflow by clamping the size.
Change-Id: I37c5c45418e7c31a017581b6c16e5d47cd61aec5