Compilers doesn't see assert as a usage of the variables, I added [[maybe_unused]] to the variables that are used only in assert to make sure that the compiler is skipping them in the check. Note: [[maybe_unused]] is introduced in C++17
Change-Id: I96bb53cb2ab55ee7120681c2d279271c0075095d
[ROCm/roctracer commit: 78869032ad]
A trace buffer is used to efficiently store synchronous event records
so that they can be processed later, possibly in a different thread,
when the buffer is flushed. This helps reduce the latency added by
tracing API calls.
The API does not need to use trace buffers as synchronous events are
directly reported to the client with callbacks, and asynchronous events
(activities) are saved in memory pools.
The implentation of HSA asynchronous memory copy activities was using
a trace buffer shared with the tracer tool to write the records to a
file (async_copy_trace.txt), instead of using a memory pool and
reporting the activity to the client.
Removed the asynchronous memory copies trace buffer, and updated
hsa_async_copy_handler to use the pool specified when the activity
was enabled.
Updated the tracer tool to read HSA_OP_ID_COPY records out of the
default memory pool and write them to async_copy_trace.txt.
Move trace_buffer.h to test/tool as tracer_tool.cpp is now the only
file using it.
Change-Id: Ida95aba2eaf3c3f2a979ed6c2b060374017b7424
[ROCm/roctracer commit: 61f35b0204]
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
[ROCm/roctracer commit: 5963363484]
There's a typo in RegisterApiCallback, roctx::cb_table.Get should be
roctx::cb_table.Set.
Change-Id: I47ec8ac666f783ff4e03f35d13e375e645899900
[ROCm/roctracer commit: 0d7d56eea5]
The proxy queue implements packet interception to enable timestamps
collection. As it is, the roctracer is not intercepting packets, and
instead relies on the rocprofiler tool to collect the timestamps for
kernel dispatches.
This is an issue as the roctracer API does not implement HSA_OPS
activities for kernel dispatches. This will be addressed in a future
commit.
Change-Id: Ib6a778a513410bec4579f223a9d9e9fd9b6054df
[ROCm/roctracer commit: 6b06322578]
Building with -DLIBRARY_TYPE=STATIC fails with 3 undefined symbols.
Add weak symbols to satisfy the linker (mirror what is done for the
other Loader symbols).
Change-Id: I8a2878def21d5f500b0764ceacb4e5255e1111c5
[ROCm/roctracer commit: b352eedac6]
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
[ROCm/roctracer commit: e4569c41fe]
Before this change, when a producer was blocked by a flush operation,
no other producer could write to the memory pool. This change allows
other producer threads to continue to write by releasing the producer
lock before waiting on the consumer condition variable.
Change-Id: Idc1c07173d2edb18fbe1a61961f10c02e7ca8c20
[ROCm/roctracer commit: dc8717a6b5]
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
[ROCm/roctracer commit: 121a84b449]
The HCC runtime is no longer used, so move all the remaining
activities in the HipApi loader and remove the HccLoader.
Change-Id: I845c04ca275a474526840315bae0ad1a4ce02257
[ROCm/roctracer commit: 85552ea3a0]
roctracer_hip.h now contains the definitions for the HCC_OPS domain.
Change-Id: I132c993110254050aaa68828f3ca80f368ad24bc
[ROCm/roctracer commit: d3b166cf01]
It only defines one class (hip_act_cb_tracker_t) that is only used
by roctracer.cpp.
Change-Id: I375a25bd363770d70a7b3b713223484a498cc3d1
[ROCm/roctracer commit: c009df3327]
Use the standard concurrent support library (std::thread, std::mutex,
st::condition_variable) instead of pthread.
Fix a mismatched memory allocation/deallocation when a custom allocator
is provided. The MemoryPool destructor was always using the default
allocator (using malloc/realloc/free) even if the pool memory was
allocated with the custom allocator.
Fix various thread safety issues and inefficiencies (spin loops).
Change-Id: I97592caa947f63463041bf43e00af9ebb5ff5886
[ROCm/roctracer commit: 9d728f74a1]
Move roctracer_cb_table.h to the src/core directory, as it should not
be exposed as a public header, and rename it callback_table.h
Change-Id: Ib448cbd32a275df0268d53bd8d1da0bdc9201470
[ROCm/roctracer commit: cd62d841fa]
This reverts commit 35ea06abd0.
Reason for revert: Merged by mistake
Change-Id: I8c39c823d92cc20a238ca6120dde4b2fa9121e85
[ROCm/roctracer commit: 57add1a6fa]
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: Ida25d3bfc72047afaa27326d697be76d97564334
[ROCm/roctracer commit: e7327aaac7]
Changing pthread_yield() to sched_yield() as pthread_yield() is deprecated in CentOS 9
Change-Id: I2961b61374e36995d0835f0e65b26c35f5eb8715
[ROCm/roctracer commit: 43a36f8dd5]
Changing correlation_id_map to static instance instead of being a pointer and fixing the corresponding references
Change-Id: Id8a481a90b46831f91985a7e0523fd2869991aeb
[ROCm/roctracer commit: 1e3ed06a9a]
Use HIP_API_ID_NONE to detect unsupported API instead of
HIP_API_ID_NUMBER which can grow with a new version of the API.
This HIP_API_ID_NONE enum has a fixed value of 0 so the
HIP_API_IDs really start at FIRST.
Change-Id: I760aa50ddf6fa6d46bf20555ad7d429335a53f97
[ROCm/roctracer commit: b04dfd5fdf]
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
[ROCm/roctracer commit: 297b613604]
As this snippet shows, HCC is no longer supported by roctracer:
#if HIP_VDI
...
#else
#error HCC support dropped
#endif
Removed HIP_VDI from the CMakeLists.txt, and the source code.
Change-Id: Ib273da2a5af6d67fa1b021a7eca3ff785c8b9c73
[ROCm/roctracer commit: 8fb3cdb30b]
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
[ROCm/roctracer commit: 38009bfba4]