diff --git a/integration_tests/gtensor.bats b/integration_tests/gtensor.bats index ec513558..89fda79f 100644 --- a/integration_tests/gtensor.bats +++ b/integration_tests/gtensor.bats @@ -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 diff --git a/libthapictl/include/backends.h b/libthapictl/include/backends.h index e141004f..2a69e109 100644 --- a/libthapictl/include/backends.h +++ b/libthapictl/include/backends.h @@ -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); diff --git a/libthapictl/src/backends.c b/libthapictl/src/backends.c index 93ac74f5..1947fbfe 100644 --- a/libthapictl/src/backends.c +++ b/libthapictl/src/backends.c @@ -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); +} diff --git a/libthapictl/src/startstop.c b/libthapictl/src/startstop.c index 8fbf9c9a..092419d7 100644 --- a/libthapictl/src/startstop.c +++ b/libthapictl/src/startstop.c @@ -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; diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index d2e93190..33d69343 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -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,