Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use thapi-ctl for hip
Browse files Browse the repository at this point in the history
bd4 committed Jul 2, 2024
1 parent bfa3c32 commit 1ee02b1
Showing 5 changed files with 58 additions and 4 deletions.
5 changes: 3 additions & 2 deletions integration_tests/gtensor.bats
Original file line number Diff line number Diff line change
@@ -3,10 +3,11 @@
setup_file() {
export IPROF=$THAPI_INSTALL_DIR/bin/iprof

bdir=build-$GTENSOR_DEVICE
bdir="build-$GTENSOR_DEVICE"

(cd integration_tests/gtensor;
cmake -S . -B $bdir -DGTENSOR_DEVICE=$GTENSOR_DEVICE -DTHAPI_PATH=$THAPI_INSTALL_DIR \
cmake -S . -B $bdir -DGTENSOR_DEVICE=$GTENSOR_DEVICE \
-DTHAPI_PATH=$THAPI_INSTALL_DIR \
&& cmake --build $bdir)

export THAPI_TEST_BIN=$(pwd)/integration_tests/gtensor/$bdir/axpy_start_stop
4 changes: 4 additions & 0 deletions libthapictl/include/backends.h
Original file line number Diff line number Diff line change
@@ -13,3 +13,7 @@ void thapi_opencl_disable_tracing_events(struct lttng_handle *h, const char *cha
void thapi_omp_init(struct lttng_handle *h, const char *channel_name);
void thapi_omp_enable_tracing_events(struct lttng_handle *h, const char *channel_name);
void thapi_omp_disable_tracing_events(struct lttng_handle *h, const char *channel_name);

void thapi_hip_init(struct lttng_handle *h, const char *channel_name);
void thapi_hip_enable_tracing_events(struct lttng_handle *h, const char *channel_name);
void thapi_hip_disable_tracing_events(struct lttng_handle *h, const char *channel_name);
33 changes: 33 additions & 0 deletions libthapictl/src/backends.c
Original file line number Diff line number Diff line change
@@ -361,3 +361,36 @@ void thapi_omp_disable_tracing_events(struct lttng_handle *h, const char *channe
thapi_disable_events_by_pattern(h, ev, 1, &omp_events_pattern, channel_name);
lttng_event_destroy(ev);
}


static char *hip_events_pattern = "lttng_ust_hip:*";


void thapi_hip_init(struct lttng_handle *h, const char *channel_name) {
(void)h;
(void)channel_name;
// no-op, no bookkeeping events for hip
return;
}


void thapi_hip_enable_tracing_events(struct lttng_handle *h, const char *channel_name) {
struct lttng_event *ev = lttng_event_create();
if (ev == NULL) {
thapi_ctl_log(THAPI_CTL_LOG_LEVEL_ERROR, "Error creating event");
return;
}
thapi_enable_events_by_pattern(h, ev, 1, &hip_events_pattern, channel_name, 0, NULL);
lttng_event_destroy(ev);
}


void thapi_hip_disable_tracing_events(struct lttng_handle *h, const char *channel_name) {
struct lttng_event *ev = lttng_event_create();
if (ev == NULL) {
thapi_ctl_log(THAPI_CTL_LOG_LEVEL_ERROR, "Error creating event");
return;
}
thapi_disable_events_by_pattern(h, ev, 1, &hip_events_pattern, channel_name);
lttng_event_destroy(ev);
}
12 changes: 12 additions & 0 deletions libthapictl/src/startstop.c
Original file line number Diff line number Diff line change
@@ -229,6 +229,12 @@ int thapi_ctl_init() {
} else {
thapi_ctl_log(THAPI_CTL_LOG_LEVEL_INFO, "omp DISABLED");
}
if (backends_enabled[BACKEND_HIP]) {
thapi_ctl_log(THAPI_CTL_LOG_LEVEL_INFO, "hip enabled");
thapi_hip_init(handle, channel_name);
} else {
thapi_ctl_log(THAPI_CTL_LOG_LEVEL_INFO, "hip DISABLED");
}
log_events(handle, channel_name, "after");
thapi_ctl_destroy_lttng_handle(handle);
return 0;
@@ -255,6 +261,9 @@ int thapi_ctl_start() {
if (backends_enabled[BACKEND_OMP]) {
thapi_omp_enable_tracing_events(handle, channel_name);
}
if (backends_enabled[BACKEND_HIP]) {
thapi_hip_enable_tracing_events(handle, channel_name);
}
log_events(handle, channel_name, "after");
thapi_ctl_destroy_lttng_handle(handle);
return 0;
@@ -282,6 +291,9 @@ int thapi_ctl_stop() {
if (backends_enabled[BACKEND_OMP]) {
thapi_omp_disable_tracing_events(handle, channel_name);
}
if (backends_enabled[BACKEND_HIP]) {
thapi_hip_disable_tracing_events(handle, channel_name);
}
log_events(handle, channel_name, "after");
thapi_ctl_destroy_lttng_handle(handle);
return 0;
8 changes: 6 additions & 2 deletions xprof/xprof.rb.in
Original file line number Diff line number Diff line change
@@ -612,8 +612,12 @@ end

def enable_events_hip(channel_name, tracing_mode: 'default', profiling: true,
trace_from_start: true)
lttng_enable = "lttng enable-event --userspace --session=#{lttng_session_uuid} --channel=#{channel_name}"
exec("#{lttng_enable} lttng_ust_hip:*")
# lttng_enable = "lttng enable-event --userspace --session=#{lttng_session_uuid} --channel=#{channel_name}"
# exec("#{lttng_enable} lttng_ust_hip:*")
exec_thapi_ctl("init", ["hip"], tracing_mode, trace_from_start, profiling)
if trace_from_start
exec_thapi_ctl("start", ["hip"], tracing_mode, trace_from_start, profiling)
end
end

def enable_events_omp(channel_name, tracing_mode: 'default', profiling: true,

0 comments on commit 1ee02b1

Please sign in to comment.