286 Υποβολές

Συγγραφέας SHA1 Μήνυμα Ημερομηνία
Ammar ELWazir 5f2a988464 SWDEV-335490: Unused variables
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]
2022-05-04 11:24:28 -04:00
Laurent Morichetti 8502571ab7 Move trace_buffer.h to the tool directory
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]
2022-05-03 21:56:28 -04:00
Laurent Morichetti 6eb1d34cda Fix assertions
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]
2022-04-27 11:24:26 -07:00
Laurent Morichetti 576554dcea Fix a SEGV when running --roctx-trace
There's a typo in RegisterApiCallback, roctx::cb_table.Get should be
roctx::cb_table.Set.

Change-Id: I47ec8ac666f783ff4e03f35d13e375e645899900


[ROCm/roctracer commit: 0d7d56eea5]
2022-04-27 12:14:32 -04:00
Laurent Morichetti 6d8edf929f Fix typos/spelling errors
Change-Id: Idec1cb8fab91c30f99563bc7dd4db1faeb2db954


[ROCm/roctracer commit: 18f60efe05]
2022-04-26 12:39:38 -07:00
Laurent Morichetti 159a56ffff Remove unused proxy utilities
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]
2022-04-26 15:26:26 -04:00
Laurent Morichetti 4a50f3b88f Fix the static library build
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]
2022-04-26 15:26:10 -04:00
Ammar ELWazir 9dd5a58e3e SWDEV-295522: Fixing Performance Issue
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]
2022-04-22 18:51:49 -04:00
Laurent Morichetti 0fd8cd7895 Allow MemoryPool::Write while Flushing
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]
2022-04-22 11:22:23 -07:00
Laurent Morichetti 1aaed4c508 Remove HCC_EXC_RAISING and HIP_EXC_RAISING
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]
2022-04-22 11:22:23 -07:00
Laurent Morichetti 14f1d48482 Move the HccLoader activities into the HipLoader
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]
2022-04-22 11:22:07 -07:00
Laurent Morichetti 33d8437801 Use ACTIVITY_DOMAIN_HIP_OPS instead of ACTIVITY_DOMAIN_HCC_OPS
Change-Id: I43fbac3d02011f74bf7b597519148ed0bd68ff98


[ROCm/roctracer commit: abf1b90017]
2022-04-20 22:00:59 -07:00
Laurent Morichetti 83cf22a698 Remove roctracer_hcc.h
roctracer_hip.h now contains the definitions for the HCC_OPS domain.

Change-Id: I132c993110254050aaa68828f3ca80f368ad24bc


[ROCm/roctracer commit: d3b166cf01]
2022-04-20 22:00:59 -07:00
Laurent Morichetti 57304225d9 Remove hip_act_cb_tracker.h
It only defines one class (hip_act_cb_tracker_t) that is only used
by roctracer.cpp.

Change-Id: I375a25bd363770d70a7b3b713223484a498cc3d1


[ROCm/roctracer commit: c009df3327]
2022-04-20 19:48:24 -07:00
Laurent Morichetti 3c18fb9f01 Simplify memory_pool.h
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]
2022-04-20 19:48:24 -07:00
Laurent Morichetti 45deedf43a Make roctracer_cb_table.h a private header
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]
2022-04-20 19:47:43 -07:00
Laurent Morichetti 2a2852048f Address review comments from previous commit
Change-Id: I6629dd911de0d7fd08d7a863c172ec73f35fa3d1


[ROCm/roctracer commit: dc22139977]
2022-04-20 22:46:15 -04:00
Laurent Morichetti 23528f51e0 Run clang-format on all source files
Change-Id: Ifb52ca306286b6b2d473821bed9db28e9f616d50


[ROCm/roctracer commit: 15ab5d9cda]
2022-04-20 22:45:54 -04:00
Laurent Morichetti b9bbce0017 Simplify journal.h
Simplify implementation of journal.h.

Change-Id: I9e2e93fd3cd3391fdf182249f5c4c5ef3debae03


[ROCm/roctracer commit: 89f6880371]
2022-04-20 19:43:16 -07:00
Laurent Morichetti 80c01a27c0 Fix copyright headers
Change-Id: I380d867fa5fb04e68b5b332e9abf33fbeb1e9418


[ROCm/roctracer commit: 06a3da7c63]
2022-04-19 09:30:45 -07:00
Ammar Elwazir d69070a133 Revert "SWDEV-295522: Fixing Performance Issue"
This reverts commit 35ea06abd0.

Reason for revert: Merged by mistake

Change-Id: I8c39c823d92cc20a238ca6120dde4b2fa9121e85


[ROCm/roctracer commit: 57add1a6fa]
2022-04-07 06:55:34 -04:00
Ammar ELWazir 35ea06abd0 SWDEV-295522: Fixing Performance Issue
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]
2022-04-07 00:07:24 +00:00
Ammar ELWazir 1029cc418e SWDEV-328300: supporting centos-9 for roctracer
Changing pthread_yield() to sched_yield() as pthread_yield() is deprecated in CentOS 9

Change-Id: I2961b61374e36995d0835f0e65b26c35f5eb8715


[ROCm/roctracer commit: 43a36f8dd5]
2022-03-18 01:26:39 +00:00
Ranjith Ramakrishnan a3c738ff30 SWDEV-291455: Prefer rocm include path to hip include path
Change-Id: I1fa96e72169fac689a3a2ed38e988d7f5d18bf04


[ROCm/roctracer commit: ebda880c4a]
2022-02-14 14:21:32 -08:00
Saurabh Verma 3b16547bf6 SWDEV-295878 Fix for seg fault when using --trace-start off
Change-Id: Ic76d814b3591f72db18319d78f34596dae1ddfee


[ROCm/roctracer commit: a7cd80b716]
2021-08-31 16:46:59 -05:00
Ammar ELWazir fe9f4c9d87 SWDEV-294248 (Fixing Race Conditions):
Fixing race conditions that happened when enabling trace-period feature on the following code:
#include <hip/hip_runtime.h>
__global__ void
kernel ()
{
}
int
main (int argc, char **argv)
{
  for (size_t i = 0; i < 10000; ++i) {
    hipLaunchKernelGGL (kernel, 1, 1, 0, 0);
    hipDeviceSynchronize ();
  }
  return 0;
}

Change-Id: I4eb88a4a71efbad0f6483e7fb6e8e0c6a662860b


[ROCm/roctracer commit: 513460bd41]
2021-08-11 22:48:55 -04:00
Ammar Elwazir 8b48f6ad7e Merge "Fixing correlation_id_map" into amd-staging
[ROCm/roctracer commit: 53fa06ad66]
2021-08-11 21:44:59 -04:00
Ammar Elwazir e52fc25af9 Merge "Cosmetic change" into amd-staging
[ROCm/roctracer commit: 682ebba1c2]
2021-08-11 20:47:53 -04:00
Ammar ELWazir 77ef6e38dc Cosmetic change
Fixing variable names and removing un-needed references

Change-Id: I3ed2cee89e7dc599caf1726fe1eab1a913e5a93d


[ROCm/roctracer commit: b02586c587]
2021-08-09 14:13:57 -04:00
Ammar ELWazir fec4a850bb Fixing correlation_id_map
Changing correlation_id_map to static instance instead of being a pointer and fixing the corresponding references

Change-Id: Id8a481a90b46831f91985a7e0523fd2869991aeb


[ROCm/roctracer commit: 1e3ed06a9a]
2021-08-09 14:05:52 -04:00
Christophe Paquot a9f6522a41 SWDEV-295205 - Remove KFD domain from roctracer
Change-Id: I2771cf43aa115bb466531bf887f7cc75e187f2ef


[ROCm/roctracer commit: e5e1258ef8]
2021-07-22 10:12:45 -07:00
Christophe Paquot ae9c760305 SWDEV-281658 - Preserve the callback IDs enum ordering
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]
2021-06-30 09:52:20 -04:00
Rachida Kebichi 99ae6ad86a SWDEV-284863 Fixed several issues preventing memcpy info dump in csv
Change-Id: I4c6323311ce8314296e81a9b9b5d8adb485e0aa8


[ROCm/roctracer commit: e5dd1e9b85]
2021-05-25 11:10:52 -04:00
Laurent Morichetti 77c83db3ef Fix random bugs discovered while reading the code
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]
2021-05-20 21:22:16 -04:00
Laurent Morichetti 61e044e67c Make HIP_VDI the default
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]
2021-05-20 21:20:27 -04:00
Laurent Morichetti aa5937fbe1 Fix a compilation error with gcc-9.3.0
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]
2021-04-19 22:57:51 -07:00
Evgeny 1eeb601150 fxing gfxip label
Change-Id: Ic22d828b38da8afc5a232c2f2eb5de5410844b70


[ROCm/roctracer commit: 2287da5e28]
2021-03-28 08:11:58 +00:00
Evgeny 76f7c9a5fd SWDEV-267198 : adding gpu index to hsa_handles file
Change-Id: I6ddba45ab31fff97a1f85f889c56693accf8f5bc


[ROCm/roctracer commit: 1c77416a6c]
2021-03-09 15:37:44 -06:00
Evgeny fc65a545a7 SWDEV-251491 : fixing tracing on exit
Change-Id: I1bf2a6093331e7a08179b9f64394c5c49206ef0e


[ROCm/roctracer commit: 912cfd4cf8]
2020-12-25 01:49:44 -05:00
Rachida Kebichi bbf605467b SWDEV-259683 HIP API records filtering
Change-Id: I43ca5e022d2c055b6a9bc2c09b4276b490a4b986


[ROCm/roctracer commit: 2d31848c44]
2020-12-16 16:29:36 -05:00
Evgeny f1458a97fb calling python3 explictely
Change-Id: I3dda55865bafa41cc6670e414b213f13a2a2a7ac


[ROCm/roctracer commit: bb5f2231a1]
2020-12-16 14:29:12 -05:00
Evgeny d7f56b632c SWDEV-258731 : cleanup
Change-Id: Iabcc81576eb8b6c0484eae820c3e25a896da6c5b


[ROCm/roctracer commit: b83ffeeab8]
2020-12-02 13:52:57 -06:00
Evgeny Shcherbakov 1585ab7259 Merge "Adding dumping of HSA handles" into amd-staging
[ROCm/roctracer commit: 6a59675f01]
2020-12-02 06:35:04 -05:00
Evgeny e6a0c8a665 Adding dumping of HSA handles
Change-Id: I18e2cfdf2574110bffa09d30c7ac1d3941252939


[ROCm/roctracer commit: 7d8fd0606d]
2020-12-01 16:45:33 -05:00
Rachida Kebichi 4b6d702a39 SWDEV-255938 NEW - added regex and depth support to ostream ops
Change-Id: I292255adab3a70fa00a1dd5685b788521687f35b


[ROCm/roctracer commit: ef36218286]
2020-11-18 16:48:50 -05:00
Evgeny 9eeab1fb91 SWDEV-254329 : extending debug trace with timestamps, cmake option '-DCMAKE_DEBUG_TRACE=1'
Change-Id: Id16c01a6c00f6384c37fa9b5a9709a5e98e1fb57


[ROCm/roctracer commit: cb3643da05]
2020-10-14 00:07:12 -04:00
Evgeny 85e5cf8a93 SWDEV-213367 : codeobj event implementation
Change-Id: Ibcaca6869ce96d8802c5fa8ba241f43834d6f2a7

update - codeobj event implementation

Change-Id: I4c12f26a19f2b31d9ac2211c3426a0e587a332b3

update2 - codeobj event implementation

Change-Id: Ic877549a83542ae00352503471d881e847ebac9c

test - codeobj event implementation

Change-Id: I0618d3a93de94c3d7467372ba4a3d4ea5520bfc7

URI reference test - codeobj event implementation

Change-Id: I6cf7e8a648cf012cb0708058b118a75e58f992b9

adding test/app - codeobj event implementation

Change-Id: Idf4c197c7b9116ccde5ec50ff47a26a858bfab32

uri test fix - codeobj event implementation

Change-Id: I7c385f82f516d9d8f2cd726366f00be3664006e3

uri test cleanup - codeobj event implementation

Change-Id: I542d5baf88c048c8b4717af843b803cd93e8f3bc

URI buffer fix - codeobj event implementation

Change-Id: Iac65e04c03a0939935c10f53c6b580a2e33878f5

HSA events tests trace-check disabled

Change-Id: I0f4d13aeeceb1d1a6e2191673eacbf9c7ae2ae52


[ROCm/roctracer commit: 29c63c5281]
2020-10-09 08:36:12 -04:00
Evgeny Shcherbakov 2eb396d35a Merge "hip library loader check" into amd-staging
[ROCm/roctracer commit: 02fcb90a4b]
2020-10-07 19:01:55 -04:00
Evgeny 5a0d2d5d7e hip library loader check
Change-Id: I34957db88932e1ed725a0a0d8ca9a66fecc92e38


[ROCm/roctracer commit: 9061c4ea41]
2020-10-07 17:53:51 -04:00
Evgeny 65928ee9d1 SWDEV-249924 : hip correlation id explicite propogation; tracer debug instrumentation;
Change-Id: Ibbc411541f5610ce739f3fc1efa1ab7f605220f5

initial commmit

Change-Id: I34b360be62c2083819dc5c3acc8268bd69f2f58a


[ROCm/roctracer commit: ef61a39603]
2020-10-06 13:25:51 -04:00