Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify finding the hip package #88

Open
wants to merge 67 commits into
base: amd-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6fffa50
optimized tool stats;
Aug 11, 2020
db1ccb0
flush-rate option fixed;
Aug 15, 2020
dae98a3
Format ostream ops;
Aug 28, 2020
b730da0
Fix for trace checker
rkebichi Sep 11, 2020
4c2b6cb
codeobj tracing prof protocol
Sep 19, 2020
35bc1e9
gen_ostream_ops.py fix - ostream operators as inline static
Sep 9, 2020
5bf3efa
build normalizing - generating under build directory
Sep 7, 2020
401c48b
testing using v3 object
Sep 17, 2020
96ea2d6
HCC_HOME env cleanup
Sep 11, 2020
28e4b8e
SWDEV-253997 : packaging fix: installing hsa_ostream_ops.h
Sep 25, 2020
367e2c4
SWDEV-251491 : gen_ostream_ops.py porting to python3
Oct 1, 2020
fb0c230
SWDEV-249924 : hip correlation id explicite propogation; tracer debug…
Sep 22, 2020
8bb2d30
SWDEV-258731 : cleanup
Oct 30, 2020
9f02bb9
Add RUNPATH to libtracer_tool.so
pruthvistony-amd Jun 5, 2020
73fb6ea
CMakeList.txt: conformant package names
nelsonc-amd Oct 16, 2020
0876c25
SWDEV-251491 : disabling hipModuleUnload tracing which is called on exit
Oct 1, 2020
18c83ea
hip library loader check
Sep 23, 2020
d8d7137
SWDEV-213367 : codeobj event implementation
Sep 3, 2020
c163244
SWDEV-254329 : extending debug trace with timestamps, cmake option '-…
Oct 13, 2020
2293663
code obj tests: adding load base
Oct 15, 2020
68b1850
SWDEV-255938 NEW - added regex and depth support to ostream ops
rkebichi Nov 18, 2020
ff8ac19
adding tests dry run to check if platform is in working state
Nov 23, 2020
d4cd091
Adding dumping of HSA handles
Nov 3, 2020
bf70a1a
SWDEV-264282 : fixing tracer_tool linking
Dec 10, 2020
bfb9095
calling python3 explictely
Dec 10, 2020
3c1a4b3
SWDEV-259683 HIP API records filtering
rkebichi Nov 18, 2020
36b1b2f
SWDEV-251491 : disabling tracing on exit
Dec 22, 2020
7ea1e9a
SWDEV-251491 : fixing tracing on exit
Dec 25, 2020
2a64bd0
SWDEV-271503 Fixed core dump
rkebichi Mar 25, 2021
89ab109
SWDEV-281008 replace hcc_detail by amd_detail
rkebichi Apr 14, 2021
e723f8c
Add dependency on rocm-core
amd-isparry Jul 7, 2021
f7adedb
SWDEV-281658 - Preserve the callback IDs enum ordering
chrispaquot Jun 21, 2021
c5c5e5d
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Aug 3, 2021
ddb44e4
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Aug 14, 2021
776eac1
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Sep 2, 2021
fba52e8
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Oct 20, 2021
f32619b
updating known issues
ammarwa Oct 28, 2021
bd6d6d3
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Nov 22, 2021
38a1972
SWDEV-318551: Adding License file for tracer
ammarwa Jan 21, 2022
c3cbdea
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 3, 2022
da12ec5
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 7, 2022
1668617
Update README.md
ammarwa Feb 9, 2022
f6db80c
Merge branch 'amd-master' into rocm-5.0.x
ammarwa Feb 9, 2022
a19a826
SWDEV-291455: Prefer rocm include path to hip include path
raramakr Feb 14, 2022
38397cb
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 16, 2022
8a9882c
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Mar 14, 2022
3ec430e
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Mar 25, 2022
7f02d6e
Merge tag 'rocm-5.1.0' into amd-master
ammarwa Mar 30, 2022
d412dcd
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Apr 5, 2022
75f74bb
SWDEV-307394: Fixing Download HSA-Class Issue
ammarwa Mar 29, 2022
bdf5bb6
Populate roctracer.h wrapper file with orginal file contents as dead …
raramakr Apr 26, 2022
f935048
Merge remote-tracking branch 'origin/rocm-5.1.x' into amd-master
ammarwa May 20, 2022
3c505d7
Merge branch 'rocm-5.2.x' into amd-master
Jun 28, 2022
6f10c12
SWDEV-357760:Adding patch to fix regression test failure
SrirakshaNag Sep 21, 2022
72b38dc
Fix hsa_support::timestamp_ns if HSA is not yet initialized
lmoriche Sep 9, 2022
bd2ac1a
SWDEV-351980 - Squashed commit of the following:
lmoriche Oct 13, 2022
8b7434e
SWDEV-362165 - Escape strings in the API function's arguments
lmoriche Oct 14, 2022
c7ae479
SWDEV-362165 - Escape strings in the API function's arguments
lmoriche Oct 14, 2022
2f5c8d9
Report HSA_OPS activities using the ROCr driver_node_id instead of th…
lmoriche Oct 19, 2022
71f3d0a
Merge branch 'rocm-5.3.x' into amd-master
ammarwa Oct 28, 2022
ac64dff
Merge remote-tracking branch 'origin/rocm-5.3.x' into amd-master
ammarwa Oct 29, 2022
4c7c59e
Merge tag 'rocm-5.4.0' into amd-master
ammarwa Dec 1, 2022
c6c33d8
Merge branch 'rocm-5.5.x' into amd-master
ammarwa May 2, 2023
080875f
SWDEV-383221 - Set the default value of ROCM_HEADER_WRAPPER_WERROR to…
raramakr May 8, 2023
4a788c9
SWDEV-398161, SWDEV-398764 Fixed hsa-trace failures for profiling dat…
bgopesh May 12, 2023
4f97ea2
Merge tag 'rocm-5.6.0' into amd-master
ammarwa Jun 29, 2023
166d3d4
Simplify finding the hip package
Jul 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ if(FILE_REORG_BACKWARD_COMPATIBILITY)
set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}"
CACHE STRING "Header wrapper warnings as errors.")
else()
set(ROCM_HEADER_WRAPPER_WERROR "ON" CACHE STRING "Header wrapper warnings as errors.")
set(ROCM_HEADER_WRAPPER_WERROR "OFF" CACHE STRING "Header wrapper warnings as errors.")
endif()
endif()
if(ROCM_HEADER_WRAPPER_WERROR)
Expand Down
44 changes: 39 additions & 5 deletions src/roctracer/hsa_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "roctracer.h"
#include "roctracer_hsa.h"

#include <atomic>
#include <hsa/hsa.h>
#include <hsa/amd_hsa_signal.h>
#include <hsa/hsa_ven_amd_loader.h>
Expand Down Expand Up @@ -415,11 +416,13 @@ hsa_status_t ExecutableDestroyIntercept(hsa_executable_t executable) {
return saved_core_api.hsa_executable_destroy_fn(executable);
}

bool profiling_async_copy_enable = false;
std::atomic<bool> profiling_async_copy_enable{false};

hsa_status_t ProfilingAsyncCopyEnableIntercept(bool enable) {
hsa_status_t status = saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(enable);
if (status == HSA_STATUS_SUCCESS) profiling_async_copy_enable = enable;
if (status == HSA_STATUS_SUCCESS) {
profiling_async_copy_enable.exchange(enable, std::memory_order_release);
}
return status;
}

Expand All @@ -434,6 +437,36 @@ void MemoryASyncCopyHandler(const Tracker::entry_t* entry) {
ReportActivity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY, &record);
}

hsa_status_t MemoryASyncCopyOnEngineIntercept(
void* dst, hsa_agent_t dst_agent, const void* src, hsa_agent_t src_agent, size_t size,
uint32_t num_dep_signals, const hsa_signal_t* dep_signals, hsa_signal_t completion_signal,
hsa_amd_sdma_engine_id_t engine_id, bool force_copy_on_sdma) {
bool is_enabled = IsEnabled(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY);

// FIXME: what happens if the state changes before returning?
[[maybe_unused]] hsa_status_t status = saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(
profiling_async_copy_enable.load(std::memory_order_relaxed) || is_enabled);
assert(status == HSA_STATUS_SUCCESS && "hsa_amd_profiling_async_copy_enable failed");

if (!is_enabled) {
return saved_amd_ext_api.hsa_amd_memory_async_copy_on_engine_fn(
dst, dst_agent, src, src_agent, size, num_dep_signals, dep_signals, completion_signal,
engine_id, force_copy_on_sdma);
}

Tracker::entry_t* entry = new Tracker::entry_t();
entry->handler = MemoryASyncCopyHandler;
entry->correlation_id = CorrelationId();
Tracker::Enable(Tracker::COPY_ENTRY_TYPE, hsa_agent_t{}, completion_signal, entry);

status = saved_amd_ext_api.hsa_amd_memory_async_copy_on_engine_fn(
dst, dst_agent, src, src_agent, size, num_dep_signals, dep_signals, entry->signal, engine_id,
force_copy_on_sdma);
if (status != HSA_STATUS_SUCCESS) Tracker::Disable(entry);

return status;
}

hsa_status_t MemoryASyncCopyIntercept(void* dst, hsa_agent_t dst_agent, const void* src,
hsa_agent_t src_agent, size_t size, uint32_t num_dep_signals,
const hsa_signal_t* dep_signals,
Expand All @@ -442,7 +475,7 @@ hsa_status_t MemoryASyncCopyIntercept(void* dst, hsa_agent_t dst_agent, const vo

// FIXME: what happens if the state changes before returning?
[[maybe_unused]] hsa_status_t status = saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(
profiling_async_copy_enable | is_enabled);
profiling_async_copy_enable.load(std::memory_order_relaxed) || is_enabled);
assert(status == HSA_STATUS_SUCCESS && "hsa_amd_profiling_async_copy_enable failed");

if (!is_enabled) {
Expand Down Expand Up @@ -473,7 +506,7 @@ hsa_status_t MemoryASyncCopyRectIntercept(const hsa_pitched_ptr_t* dst,

// FIXME: what happens if the state changes before returning?
[[maybe_unused]] hsa_status_t status = saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(
profiling_async_copy_enable | is_enabled);
profiling_async_copy_enable.load(std::memory_order_relaxed) || is_enabled);
assert(status == HSA_STATUS_SUCCESS && "hsa_amd_profiling_async_copy_enable failed");

if (!is_enabled) {
Expand Down Expand Up @@ -570,6 +603,7 @@ void Initialize(HsaApiTable* table) {
// Install the HSA_OPS intercept
table->amd_ext_->hsa_amd_memory_async_copy_fn = MemoryASyncCopyIntercept;
table->amd_ext_->hsa_amd_memory_async_copy_rect_fn = MemoryASyncCopyRectIntercept;
table->amd_ext_->hsa_amd_memory_async_copy_on_engine_fn = MemoryASyncCopyOnEngineIntercept;
table->amd_ext_->hsa_amd_profiling_async_copy_enable_fn = ProfilingAsyncCopyEnableIntercept;

// Install the HSA_EVT intercept
Expand All @@ -590,7 +624,7 @@ void Initialize(HsaApiTable* table) {

void Finalize() {
if (hsa_status_t status =
saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(profiling_async_copy_enable);
saved_amd_ext_api.hsa_amd_profiling_async_copy_enable_fn(profiling_async_copy_enable.load(std::memory_order_relaxed));
status != HSA_STATUS_SUCCESS)
assert(!"hsa_amd_profiling_async_copy_enable failed");

Expand Down
2 changes: 1 addition & 1 deletion src/roctracer/roctracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,4 @@ ROCTRACER_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,

ROCTRACER_EXPORT void OnUnload() { hsa_support::Finalize(); }

} // extern "C"
} // extern "C"
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(CMAKE_EXECUTABLE_RPATH_LINK_HIP_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_F

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${ROCM_PATH}/lib/cmake/hip")
set(CMAKE_HIP_ARCHITECTURES OFF)
find_package(HIP REQUIRED MODULE)
find_package(HIP REQUIRED)

find_package(Clang REQUIRED CONFIG
PATHS "${ROCM_PATH}"
Expand Down