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

269 Коммитов

Автор 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
Laurent Morichetti e1fa2cb5d5 run.sh: In case of error, also print the stderr log
Change-Id: I9a20bf2d755749b036788d7e2fce044a7f36eb2e
2022-05-12 20:16:09 -04:00
Laurent Morichetti bbe1db3810 Fix an intermittent failure in "tool flushing test"
The test (MatrixTranspose) and the tracer tool both write to stdout
which sometime causes a trace corruption.

Change the test to emit info messages to stderr instead of stdout,
leaving stdout for the tracer tool's exclusive use.

Change-Id: I18047dbcd9039b70dd24ef6e7e8e9d89b40bedd2
2022-05-12 20:15:37 -04:00
Ammar ELWazir 2f5313a0c7 Fixing cmake_modules
Removing unused definitions and compile options
Using cmake variables to set the options needed
Changing the visibility to make it specific for the targets

Change-Id: I80cf0997cd28897d5a06a58c7225ba40dfc51e2d
2022-05-11 19:25:43 -04:00
Ammar Elwazir 3882091c71 Merge "Flush function fix" into amd-staging 2022-05-11 19:13:43 -04: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
Ammar ELWazir 6b16d37d65 Removing Backward compatability
removing the backward compatability file and making sure to use the right paths

Change-Id: I518d52c82e0c5878bd334713e7b1758bba79762d
2022-05-11 14:43:35 -04:00
Laurent Morichetti a98476fe11 Fix the roctracer tests
14/15 tests pass, 1/15 intermittent failure (tool flushing test).

Change-Id: I36ed2900a1c51e584718993badeaefd48ad450a2
2022-05-10 14:58:08 -07:00
Laurent Morichetti 3f402eb6e9 Disallow copying or moving trace buffers
Change-Id: I104b8240a76c6d96ae176b0b26bdc2e4e5e3c180
2022-05-10 12:08:06 -07: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
Laurent Morichetti 200e27f12d Add a trace_buffer directed test
This test stresses the concurrent writing of trace buffer records while
frequently allocating new storage to hold the records.

Due to race conditions, this test fails with the current trace buffer
implementation.

Change-Id: I0b77c64005e776319bf21f1ee1e6d7c99ddccfff
2022-04-29 08:52:13 -07: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
Ammar ELWazir 7ee4f87b73 SWDEV-307394: Fixing Download HSA-Class Issue
Exchanging the git clone of the hsa-class to a local downloaded version pushed to the roctracer repo

Change-Id: Id45a38b2d355102c2e0dee1e4bfde50398369047
2022-03-29 22:27:25 +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
Ranjith Ramakrishnan bc19ae71eb File reorganization with backward compatibility
Package installed /opt/rocm
Soft links and wrapper header files installed /opt/rocm/roctracer for backward compatibility
tracer_tool library renamed to roctracer_tool and installed in /opt/rocm/lib/roctracer

Change-Id: Ica7518c5ef2e591715121cbc942b69dff29233d3
2022-03-04 04:03:51 -08:00
Ranjith Ramakrishnan ebda880c4a SWDEV-291455: Prefer rocm include path to hip include path
Change-Id: I1fa96e72169fac689a3a2ed38e988d7f5d18bf04
2022-02-14 14:21:32 -08:00
Icarus Sparry 8ea268b3f4 Forcibly disable parallelism
The manually written Makefiles in the test directory are not safe to
use by more than one job. For example we see things like
	all: clean $(EXECUTABLE)
which says that the 'all' target depends on the 'clean' and
'$(EXECUTABLE)' targets. If make is invoked with -j2 then the clean
and '${EXECUTABLE}' can be built in parallel, so the clean can delete
things whilst they are being built!

Change-Id: I9c56db4c629081b8d812dad45dfd4afde10e481f
Signed-off-by: Icarus Sparry <icarus.sparry@amd.com>
2021-10-31 15:19:36 -07: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
Ammar ELWazir 99e2f37c81 SWDEV-298155: Fixing HSA-CLASS REV
Adding the latest commit to pull from the hsa-class git repo that includes the fix for SWDEV-298155
"Fixing the typo in evt_stats.h" https://github.com/ROCmSoftwarePlatform/hsa-class/commit/e6456a6d93cc6d8bcc59bd6ea24f27146f86ff4c

Change-Id: I9984de8ec9204a6cf47a25ce4ac42852473c56c9
2021-09-29 12:27:15 -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
Freddy Paul 1cc934204f roctracer:All libraries need to be installed with LIBRARY TAG
Cmake will do the post processing required for RPATH or any other
needed for the libraries only if installed as libraries not as
regular files

FIX: SWDEV-287893
Change-Id: I9cf478fcd23b9f2e8b3bdd81aa566cad3ec2a5e3
2021-05-26 12:15:25 -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
Kent Russell 5c9329aec8 roctracer: Support static thunk
Add numa lib as this will be required with a static thunk
Look for static thunk of shared thunk cannot be found

Signed-off-by: Kent Russell <kent.russell@amd.com>
Change-Id: I5de63e0a56a8946132ccbb7140a19a82a70b951d
2021-04-27 12:56:56 -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 Shcherbakov 3e4539c95d Merge "calling python3 explictely" into amd-staging 2020-12-16 16:01:57 -05:00
Evgeny bb5f2231a1 calling python3 explictely
Change-Id: I3dda55865bafa41cc6670e414b213f13a2a2a7ac
2020-12-16 14:29:12 -05:00
Evgeny 4baffc8e53 SWDEV-264282 : fixing tracer_tool linking
Change-Id: I0fd78c01595bbd506f42cf9dfb45f62b2124f704
2020-12-09 22:18:22 -05:00
Evgeny Shcherbakov 6a59675f01 Merge "Adding dumping of HSA handles" into amd-staging 2020-12-02 06:35:04 -05:00
Evgeny 7d8fd0606d Adding dumping of HSA handles
Change-Id: I18e2cfdf2574110bffa09d30c7ac1d3941252939
2020-12-01 16:45:33 -05:00