Граф коммитов

123 Коммитов

Автор SHA1 Сообщение Дата
Ammar ELWazir 1f9efecd4a Trace Period Optimization
Optimizing trace period to use std::threads as well as std::chrono sleep instead of sleep and usleep and catching up corner cases for ending before the trace period duration and some cosmetic clean up

Change-Id: Ia99f346bf71a3faad5dfdfc8d7a08f6c2b2cc0b9
2022-05-13 00:11:02 -05:00
Ammar ELWazir 80464525c7 Flush function fix
Using std::thread instead of pthreads and also atomic_bool to identify the end of the flush function so that the unload_tool can wait for it

Change-Id: Iea00d7e16c65d51db2d222e8b42f03f9caeb2067
2022-05-11 17:20:39 -04:00
Laurent Morichetti 3d0198c395 Remove the roctx range message stack
The range message stack is mirrored in case ranges are pushed or popped
while tracing is stopped (by the tracer tool?). When a stop event is
reported, the tracer tool emits RangePop events by unwinding the stack,
then when the start event is reported, it emits RangePush events again
by unwinding the stack. The issue is that the RangePush events should
be emitted in reverse order.

For example:

RangePush(M1); RangePush(M2); \
  TracerStop; RangePop; RangePop; \
...; \
  TracerStart; RangePush(M2); RangePush(M1); \ <- In the wrong order
RangePop; RangePop;

It could be fixed by reversing the stack in RangeStackIterate but is it
worth it? The roctx range markers are supposed to be unintrusive so that
they can be left in the application even when it isn't being traced.

Simplifying the roctx API and reducing its added latency by removing
the range message stack mirroring seems like the better choise.

TODO: A future change should make roctx events immune to tracer start
and tracer stop requests. Or simply remove roctracer_start/stop.

Change-Id: Ie4d76afb5ce8d263848dcf1b599af394db56ddab
2022-05-10 12:08:06 -07:00
Laurent Morichetti f8462b8637 Consolidate all sources of timestamps
System clock timestamps should only come from a single source:
util::timestamp_ns(). Externally, this function is exposed as
roctracer_get_timestamp() (used by the tracer tool).

Removed the now unused HSA Runtime Utilities which were never part
of the ROCtracer API.

Change-Id: I044b7f4da60fd8fdb771b0c877622a3143f0e815
2022-05-10 08:13:09 -07:00
Laurent Morichetti f46d1717cc Remove unused ROCTX_CLOCK_TIME
Change-Id: I9696bb2892fe6fe21089462d624643b7a782fb71
2022-05-04 19:30:37 -04:00
Laurent Morichetti 6d6017249a Remove the tracer tool's dependency on hsa_rsrc_factory
hsa_rsrc_factory was only used to enumerate the agents types and pools.
The pools don't seem to be used by bin/mem_manager.py, so I only
ported the agent enumeration using hsa_iterate_agents.

Change-Id: Idd586aa13db303cf92962a6392771b7bf38b758f
2022-05-04 19:28:53 -04:00
Ammar ELWazir 5e012541c5 Removing HIP_API_PROF_STRING from the tracer_tool
The else part was not used as it was only using the hipApiString to format the data to string

Change-Id: I376721c478cffba0890436ca8895dfe2a7641570
2022-05-04 09:46:56 -04:00
Laurent Morichetti 046df32729 Fix race conditions in TraceBuffer
1) The Entry's state was published after making the record avaiable,
   so a thread flushing the records could see an unitialized record.
2) data_ and write_pointer_ could become out of sync. write_pointer_
   could be indexing into another buffer than what data_ was pointing
   to.
3) GetEntry could get a nullptr free_buffer_ because multiple threads
   could acquire the work_mutex_ before the work_thread_ could wake up,
   or between allocate_worker's loop iterations.

Change-Id: I6f0a015557888eeeaa75a8bce7fde8de276d11dd
2022-05-03 21:56:46 -04:00
Laurent Morichetti 61f35b0204 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
2022-05-03 21:56:28 -04:00
Ammar ELWazir e4569c41fe 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
2022-04-22 18:51:49 -04:00
Laurent Morichetti abf1b90017 Use ACTIVITY_DOMAIN_HIP_OPS instead of ACTIVITY_DOMAIN_HCC_OPS
Change-Id: I43fbac3d02011f74bf7b597519148ed0bd68ff98
2022-04-20 22:00:59 -07:00
Laurent Morichetti d3b166cf01 Remove roctracer_hcc.h
roctracer_hip.h now contains the definitions for the HCC_OPS domain.

Change-Id: I132c993110254050aaa68828f3ca80f368ad24bc
2022-04-20 22:00:59 -07:00
Laurent Morichetti a0fd1e7c4b Close the default pool on exit
Change-Id: I388ea4d4f06c1818312a72185ef55b615c730509
2022-04-20 19:48:24 -07:00
Laurent Morichetti 15ab5d9cda Run clang-format on all source files
Change-Id: Ifb52ca306286b6b2d473821bed9db28e9f616d50
2022-04-20 22:45:54 -04:00
Laurent Morichetti 06a3da7c63 Fix copyright headers
Change-Id: I380d867fa5fb04e68b5b332e9abf33fbeb1e9418
2022-04-19 09:30:45 -07:00
Ammar Elwazir 57add1a6fa Revert "SWDEV-295522: Fixing Performance Issue"
This reverts commit e7327aaac7.

Reason for revert: Merged by mistake

Change-Id: I8c39c823d92cc20a238ca6120dde4b2fa9121e85
2022-04-07 06:55:34 -04:00
Ammar ELWazir e7327aaac7 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
2022-04-07 00:07:24 +00:00
Saurabh Verma 37ed31087a SWDEV-295871: [MSRCHA-130] Unable to filter API using .txt or .xml -Part-2 of MSRCHA-128. Made xml input more robust to accept both spaces and commas in xml array.
Change-Id: I3900fdf91cd0b893fadd9dfc958030effc5663db
2022-03-17 17:16:17 -05:00
Saurabh Verma aee8102fa6 SWDEV-295871 : [MSRCHA-130] Unable to filter API using .txt or .xml - Part-2 of MSRCHA-128. Fixed constructor ordering issue of global variables hip_api_vec and hsa_api_vec by wrapping themin static getter functions
Change-Id: I2dae5e196118fcab696b2365b24281f05d9d0f88
2022-03-14 16:07:58 -04:00
Ammar ELWazir aa41554130 SWDEV-275232: Replaced the use of on_exit()
on_exit() registered exit_handler function, but in the case of OpenMP applications the registered exit func exit_handler was called after the dlclose of the library. So we removed exit_handler from roctracer as it is already handled in both rocprofiler and rocprof script.

Change-Id: I7c3d42e6ccc282e713b48b4a7faec4935e7a2600
2021-10-09 17:36:36 -04:00
Saurabh Verma a7cd80b716 SWDEV-295878 Fix for seg fault when using --trace-start off
Change-Id: Ic76d814b3591f72db18319d78f34596dae1ddfee
2021-08-31 16:46:59 -05:00
Ammar ELWazir 8396836c25 SWDEV-294319 & SWDEV-294321 Added support for missing functions
Added Support for launch kernel functions to fill_api_db

Change-Id: Ie8749806214d6e283c3d408d8019f178f42018bf
2021-08-11 11:42:21 -04:00
Christophe Paquot e5e1258ef8 SWDEV-295205 - Remove KFD domain from roctracer
Change-Id: I2771cf43aa115bb466531bf887f7cc75e187f2ef
2021-07-22 10:12:45 -07:00
Christophe Paquot b04dfd5fdf 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
2021-06-30 09:52:20 -04:00
Laurent Morichetti 8fb3cdb30b 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
2021-05-20 21:20:27 -04:00
Rachida Kebichi 06271806d4 SWDEV-255637 support for hsa_amd_memory_async_copy_rect
Change-Id: I5db6484c30427712c56b59862e748118a3f079c2
2021-03-31 10:02:06 -04:00
Rachida Kebichi ad5b463912 SWDEV-271503 Fixed core dump
Change-Id: Ia582a27482581c3b81c42da0add9f6743898da6c
2021-03-30 14:06:56 -04:00
Evgeny 912cfd4cf8 SWDEV-251491 : fixing tracing on exit
Change-Id: I1bf2a6093331e7a08179b9f64394c5c49206ef0e
2020-12-25 01:49:44 -05:00
Evgeny 99eee45546 SWDEV-251491 : disabling tracing on exit
Change-Id: Ifd5f0fbad70afa1e79da8b4b9aa639d899cbea76
2020-12-22 04:55:07 -05:00
Rachida Kebichi 2d31848c44 SWDEV-259683 HIP API records filtering
Change-Id: I43ca5e022d2c055b6a9bc2c09b4276b490a4b986
2020-12-16 16:29:36 -05:00
Evgeny 7d8fd0606d Adding dumping of HSA handles
Change-Id: I18e2cfdf2574110bffa09d30c7ac1d3941252939
2020-12-01 16:45:33 -05:00
Evgeny cb3643da05 SWDEV-254329 : extending debug trace with timestamps, cmake option '-DCMAKE_DEBUG_TRACE=1'
Change-Id: Id16c01a6c00f6384c37fa9b5a9709a5e98e1fb57
2020-10-14 00:07:12 -04:00
Evgeny ef61a39603 SWDEV-249924 : hip correlation id explicite propogation; tracer debug instrumentation;
Change-Id: Ibbc411541f5610ce739f3fc1efa1ab7f605220f5

initial commmit

Change-Id: I34b360be62c2083819dc5c3acc8268bd69f2f58a
2020-10-06 13:25:51 -04:00
Evgeny bb8f2f6785 SWDEV-251491 : disabling hipModuleUnload tracing which is called on exit
Change-Id: I99c22eec3fea6ac8820d574c44df099febdd27c4
2020-10-01 12:47:40 -04:00
Evgeny e9b8de644e Format ostream ops
Change-Id: I8c609b1ef82e02f3547541c2cc47dec3a4f1c7b3
2020-08-28 11:30:18 -05:00
Evgeny 156d9327cc flush-rate option fixed
Change-Id: I74ff83ebf2a0a4ba414d30b7cb193522f44660ce
2020-08-20 15:11:38 -05:00
Evgeny ddcb68d0a8 optimized tool stats
Change-Id: Ia9c06879f6e2e195e589c53299c2cafe96a4bfe5
2020-08-20 15:11:21 -05:00
Rachida Kebichi da17a158f8 Added roctxRangeStart and roctxRangeEnd
Change-Id: Id7f81c5a7d7f231c8f0e2323d31c37c827687189

Added roctxRangeStart and roctxRangeEnd

Change-Id: Id7f81c5a7d7f231c8f0e2323d31c37c827687189
2020-08-11 17:28:03 -04:00
Evgeny 086a88288e fixing activity correlation for n-process use case
Change-Id: Ied5b0d112719784fa00bfbf540bc30950ca147ea
2020-06-27 01:08:57 -05:00
Evgeny a83acdae3a adding post initialization of HIP API pointer args to print returned by reference values
Change-Id: Ifb73434d7ab9cd2dfe8811fc0cd013b78f4e12f2
2020-06-23 20:00:09 -04:00
Evgeny c9a7d6c4a8 adding begin_ts_file.txt for app start time
Change-Id: I976e7bf06eeafa76c80cc847c341dde9f1f5895e
2020-06-17 18:59:38 -05:00
Rachida Kebichi 64ee8f29ef support for hip multi kernels
Change-Id: Idc8945f924ceb35081e153921181b96ee5f653b6
2020-06-11 15:13:33 -04:00
Evgeny 84ed8c4b63 adding proc-id to activity events
Change-Id: I83b587651819a7cb08ffdd5f85bfe82927521720
2020-06-03 03:26:36 -05:00
Evgeny 07479cf881 adding tracer flush/unload stage unloading
Change-Id: Id84774b2ce20b261a9a84d2ad802b76093a748d4
2020-06-02 05:10:02 -05:00
Evgeny 511f659a8e hipLaunchKernel kernel name fix
Change-Id: I59c63ec34f77fe39ed1edc8b6395db3871004e40
2020-05-29 13:16:14 -04:00
Evgeny 9d4a58f6da disabling kernel name printing for kernel launches by func pointer and ostream operator template
Change-Id: Icbcedafb1812a1be03837f6cb47283eb0d382ad2
2020-05-27 05:23:29 -04:00
Evgeny da4b244887 renaming PCSAMPLE API as RESERVED1
Change-Id: I0f95e4be5b359dc36fc3542bf0e321094db78a79
2020-05-21 11:51:17 -05:00
Evgeny 074306d997 SWDEV-236864 : packaging of generated headers
Change-Id: Ifda69eecf3697f6b69c978b3c4c2ffe9835edeb8
2020-05-18 18:08:06 -05:00
Evgeny 98dbca9058 hip apr stream porting to hip vdi; hip_api_string off by default
Change-Id: I2a9b55b8bdc372743b175797c0d4827fe8931033
2020-05-13 06:06:17 -05:00
Evgeny 3d4f6b3002 buffer wrap-thread startup fix
Change-Id: I857cff63d28dcc068eddbd3ae2bc0193c428ec41
2020-05-07 06:45:29 -05:00