diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index 1c3dde99..7cd297fc 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -385,16 +385,11 @@ def env_tracers end # Sample - # Currently the same `so` does the tracing, and the sampling - # This mean that is the local rank is not part of the `traced-ranks` - # No sampling will be performed - if sampling? + if sampling? LOGGER.debug('Sampling Enabled') h['LTTNG_UST_SAMPLING'] = 1 h['LTTNG_UST_SAMPLING_ENERGY'] = 1 - # The current only reliable way to use zes api - # is to call zesInit and set ZES_ENABLE_SYSMAN to 0 - h['ZES_ENABLE_SYSMAN'] = 0 if OPTIONS[:'backend-names'].include?('ze') + h['ZES_ENABLE_SYSMAN'] = 0 if OPTIONS[:'backend-names'].include?('ze') end backends = [] unless need_backend diff --git a/ze/btx_zeinterval_callbacks.cpp b/ze/btx_zeinterval_callbacks.cpp index 2675a8cc..1fb1111e 100644 --- a/ze/btx_zeinterval_callbacks.cpp +++ b/ze/btx_zeinterval_callbacks.cpp @@ -773,7 +773,7 @@ DeviceHash get_device_hash(void *usr_data, const char *hostname, int64_t vpid, z uint64_t hash = 0xcbf29ce484222325; // FNV offset basis for (int i = 0; i < ZE_MAX_DEVICE_UUID_SIZE; i++) { - hash ^= (uint64_t)deviceProp.uuid.id[i]; + hash ^= (uint64_t)deviceProp.core.uuid.id[i]; hash *= 0x100000001b3; // FNV prime } @@ -959,42 +959,42 @@ static void lttng_ust_ze_sampling_gpu_frequency_callback(void *btx_handle, void // Properties static void lttng_ust_ze_sampling_deviceProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, uint32_t deviceIdx,size_t _pDeviceProperties_val_length, - ze_device_properties_t *pDeviceProperties_val) { + zes_device_handle_t hDevice, uint32_t deviceIdx,size_t _pDeviceProperties_val_length, + zes_device_properties_t *pDeviceProperties_val) { auto *data = static_cast(usr_data); data->sampling_device_property[{hostname, vpid, hDevice}] = {*pDeviceProperties_val, deviceIdx}; } - +/* static void lttng_ust_ze_sampling_subDeviceProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, ze_device_handle_t hSubDevice, size_t _pSubDeviceProperties_val_length, + zes_device_handle_t hDevice, ze_device_handle_t hSubDevice, size_t _pSubDeviceProperties_val_length, ze_device_properties_t *pSubDeviceProperties_val) { auto *data = static_cast(usr_data); data->sampling_sub_device_property[{hostname, vpid, (ze_device_handle_t)hSubDevice}] = *pSubDeviceProperties_val; } - +*/ static void lttng_ust_ze_sampling_fabricPortProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, zes_fabric_port_handle_t hFabricPort, + zes_device_handle_t hDevice, zes_fabric_port_handle_t hFabricPort, size_t _pFabricPortProperties_val_length, zes_fabric_port_properties_t *pFabricPortProperties_val) { auto *data = static_cast(usr_data); - data->fabricPort_property[{hostname, vpid, (ze_device_handle_t)hDevice, (zes_fabric_port_handle_t)hFabricPort}] = *pFabricPortProperties_val; + data->fabricPort_property[{hostname, vpid, (zes_device_handle_t)hDevice, (zes_fabric_port_handle_t)hFabricPort}] = *pFabricPortProperties_val; } static void lttng_ust_ze_sampling_memoryProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, zes_mem_handle_t hMemModule, + zes_device_handle_t hDevice, zes_mem_handle_t hMemModule, size_t _pMemModuleProperties_val_length, zes_mem_properties_t *pMemModuleProperties_val) { auto *data = static_cast(usr_data); - data->memModule_property[{hostname, vpid, (ze_device_handle_t)hDevice, (zes_mem_handle_t)hMemModule}] = *pMemModuleProperties_val; + data->memModule_property[{hostname, vpid, (zes_device_handle_t)hDevice, (zes_mem_handle_t)hMemModule}] = *pMemModuleProperties_val; } static void lttng_ust_ze_sampling_powerProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, zes_pwr_handle_t hPower, + zes_device_handle_t hDevice, zes_pwr_handle_t hPower, size_t _pPowerProperties_val_length, zes_power_properties_t *pPowerProperties_val) { auto *data = static_cast(usr_data); @@ -1003,20 +1003,20 @@ static void lttng_ust_ze_sampling_powerProperties_callback(void *btx_handle, voi static void lttng_ust_ze_sampling_freqProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, zes_freq_handle_t hFrequency, + zes_device_handle_t hDevice, zes_freq_handle_t hFrequency, size_t _pfreqProperties_val_length, zes_freq_properties_t *pFreqProperties_val) { auto *data = static_cast(usr_data); - data->frequency_property[{hostname, vpid, (ze_device_handle_t)hDevice, (zes_freq_handle_t)hFrequency}] = *pFreqProperties_val; + data->frequency_property[{hostname, vpid, (zes_device_handle_t)hDevice, (zes_freq_handle_t)hFrequency}] = *pFreqProperties_val; } static void lttng_ust_ze_sampling_engineProperties_callback(void *btx_handle, void *usr_data, int64_t ts, const char *hostname, int64_t vpid, uint64_t vtid, - ze_device_handle_t hDevice, zes_engine_handle_t hEngine, + zes_device_handle_t hDevice, zes_engine_handle_t hEngine, size_t _pEngineProperties_val_length, zes_engine_properties_t *pEngineProperties_val) { auto *data = static_cast(usr_data); - data->engine_property[{hostname, vpid, (ze_device_handle_t)hDevice, (zes_engine_handle_t)hEngine}] = *pEngineProperties_val; + data->engine_property[{hostname, vpid, (zes_device_handle_t)hDevice, (zes_engine_handle_t)hEngine}] = *pEngineProperties_val; } static void lttng_ust_ze_sampling_fabricPort_callback(void *btx_handle, void *usr_data, int64_t ts, @@ -1295,8 +1295,8 @@ void btx_register_usr_callbacks(void *btx_handle) { //Properties btx_register_callbacks_lttng_ust_ze_sampling_deviceProperties( btx_handle, <tng_ust_ze_sampling_deviceProperties_callback); - btx_register_callbacks_lttng_ust_ze_sampling_subDeviceProperties( - btx_handle, <tng_ust_ze_sampling_subDeviceProperties_callback); + // btx_register_callbacks_lttng_ust_ze_sampling_subDeviceProperties( + // btx_handle, <tng_ust_ze_sampling_subDeviceProperties_callback); btx_register_callbacks_lttng_ust_ze_sampling_fabricPortProperties( btx_handle, <tng_ust_ze_sampling_fabricPortProperties_callback); btx_register_callbacks_lttng_ust_ze_sampling_powerProperties( diff --git a/ze/btx_zeinterval_callbacks.hpp b/ze/btx_zeinterval_callbacks.hpp index 8349152d..920b6fb1 100644 --- a/ze/btx_zeinterval_callbacks.hpp +++ b/ze/btx_zeinterval_callbacks.hpp @@ -28,22 +28,22 @@ typedef std::tuple fabricPort_timestamp_ typedef std::tuple energy_timestamp_t; typedef std::tuple engines_timestamp_t; -typedef std::tuple deviceProperty_id_t; +typedef std::tuple deviceProperty_id_t; -typedef std::tuple hpd_t; +typedef std::tuple hpd_t; typedef std::tuple hpdd_t; typedef std::tuple hpdsd_t; -typedef std::tuple hpdf_t; -typedef std::tuple hpdm_t; -typedef std::tuple hpdpwr_t; -typedef std::tuple hpdfreq_t; -typedef std::tuple hpdeng_t; +typedef std::tuple hpdf_t; +typedef std::tuple hpdm_t; +typedef std::tuple hpdpwr_t; +typedef std::tuple hpdfreq_t; +typedef std::tuple hpdeng_t; -typedef std::tuple hpdmsd_t; -typedef std::tuple hpdfsd_t; -typedef std::tuple hpdesd_t; -typedef std::tuple hpdpwrd_t; +typedef std::tuple hpdmsd_t; +typedef std::tuple hpdfsd_t; +typedef std::tuple hpdesd_t; +typedef std::tuple hpdpwrd_t; using btx_kernel_group_size_t = std::tuple; using btx_kernel_desct_t = diff --git a/ze/tracer_ze_helpers.include.c b/ze/tracer_ze_helpers.include.c index fa648e18..2aeac60c 100644 --- a/ze/tracer_ze_helpers.include.c +++ b/ze/tracer_ze_helpers.include.c @@ -1034,7 +1034,6 @@ static int initializeHandles() { _sampling_subDeviceCount = (uint32_t**) calloc(_sampling_driverCount, sizeof(uint32_t*)); _sampling_hDevices = (zes_device_handle_t**) calloc(_sampling_driverCount, sizeof(zes_device_handle_t*)); _sampling_hSubDevices = (zes_device_handle_t***) calloc(_sampling_driverCount, sizeof(zes_device_handle_t**)); - // Query device count for (uint32_t driverIdx = 0; driverIdx < _sampling_driverCount; driverIdx++) { _sampling_deviceCount[driverIdx] = 0; res = ZES_DEVICE_GET_PTR(_sampling_hDrivers[driverIdx], &_sampling_deviceCount[driverIdx], NULL); @@ -1054,11 +1053,13 @@ static int initializeHandles() { _sampling_subDeviceCount[driverIdx] = (uint32_t*) calloc(_sampling_deviceCount[driverIdx], sizeof(uint32_t)); _sampling_hSubDevices[driverIdx] = (ze_device_handle_t**) calloc(_sampling_deviceCount[driverIdx], sizeof(ze_device_handle_t*)); for (uint32_t deviceIdx = 0; deviceIdx < _sampling_deviceCount[driverIdx]; deviceIdx++) { - zes_device_properties_t deviceProperties = {0}; - deviceProperties.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES; - res = ZES_DEVICE_GET_PROPERTIES_PTR(_sampling_hDevices[driverIdx][deviceIdx], &deviceProperties); + // zes_device_ext_properties_t deviceProps = {0}; + zes_device_properties_t deviceProps = {0}; + deviceProps.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES; + deviceProps.pNext = NULL; + res = ZES_DEVICE_GET_PROPERTIES_PTR(_sampling_hDevices[driverIdx][deviceIdx], &deviceProps); if (res != ZE_RESULT_SUCCESS) { - _ZE_ERROR_MSG("ZE_DEVICE_GET_PROPERTIES_PTR", res); + _ZE_ERROR_MSG("ZES_DEVICE_GET_PROPERTIES_PTR", res); } do_tracepoint(lttng_ust_ze_sampling, deviceProperties, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], deviceIdx, &deviceProps ); @@ -1068,11 +1069,12 @@ static int initializeHandles() { if (res != ZE_RESULT_SUCCESS) { _ZE_ERROR_MSG("ZES_DEVICE_GET_SUB_DEVICES_PTR", res); _sampling_subDeviceCount[driverIdx][deviceIdx] = 0; + } if (_sampling_subDeviceCount[driverIdx][deviceIdx] > 0) { _sampling_hSubDevices[driverIdx][deviceIdx] = (ze_device_handle_t*) calloc(_sampling_subDeviceCount[driverIdx][deviceIdx], sizeof(ze_device_handle_t)); res = ZES_DEVICE_GET_SUB_DEVICES_PTR(_sampling_hDevices[driverIdx][deviceIdx], &_sampling_subDeviceCount[driverIdx][deviceIdx], _sampling_hSubDevices[driverIdx][deviceIdx]); if (res != ZE_RESULT_SUCCESS) { - _ZE_ERROR_MSG("ZE_DEVICE_GET_SUB_DEVICES_PTR", res); + _ZE_ERROR_MSG("ZES_DEVICE_GET_SUB_DEVICES_PTR", res); free(_sampling_hSubDevices[driverIdx][deviceIdx]); _sampling_hSubDevices[driverIdx][deviceIdx] = NULL; _sampling_subDeviceCount[driverIdx][deviceIdx] = 0; @@ -1083,11 +1085,10 @@ static int initializeHandles() { subDeviceProps.pNext = NULL; res = ZES_DEVICE_GET_PROPERTIES_PTR(_sampling_hSubDevices[driverIdx][deviceIdx][subDeviceIdx], &subDeviceProps); if (res != ZE_RESULT_SUCCESS) { - _ZE_ERROR_MSG("ZE_DEVICE_GET_PROPERTIES_PTR", res); + _ZE_ERROR_MSG("ZES_DEVICE_GET_PROPERTIES_PTR", res); } do_tracepoint(lttng_ust_ze_sampling, subDeviceProperties, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (ze_device_handle_t)_sampling_hSubDevices[driverIdx][deviceIdx][subDeviceIdx], &subDeviceProps); - } - } + } } } } @@ -1109,7 +1110,7 @@ static void readFrequency_dump(uint32_t driverIdx, uint32_t deviceIdx) { _ZE_ERROR_MSG("ZES_FREQUENCY_GET_STATE_PTR", result); continue; } - do_tracepoint(lttng_ust_ze_sampling, gpu_frequency, (ze_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_freq_handle_t)_sampling_hFrequencies[driverIdx][deviceIdx][domainIdx], domainIdx, &freqState); + do_tracepoint(lttng_ust_ze_sampling, gpu_frequency, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_freq_handle_t)_sampling_hFrequencies[driverIdx][deviceIdx][domainIdx], domainIdx, &freqState); } } @@ -1130,7 +1131,7 @@ static void readFabricPorts_dump(uint32_t driverIdx, uint32_t deviceIdx) { _ZE_ERROR_MSG("ZES_FABRIC_PORT_GET_THROUGHPUT_PTR", result); continue; } - do_tracepoint(lttng_ust_ze_sampling, fabricPort, (ze_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], + do_tracepoint(lttng_ust_ze_sampling, fabricPort, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_fabric_port_handle_t)_sampling_hFabricPort[driverIdx][deviceIdx][portIdx], &portState, &throughput); } } @@ -1152,7 +1153,7 @@ static void readMemModules_dump(uint32_t driverIdx, uint32_t deviceIdx) { _ZE_ERROR_MSG("ZES_MEMORY_GET_BANDWIDTH_PTR", result); continue; } - do_tracepoint(lttng_ust_ze_sampling, memStats, (ze_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], + do_tracepoint(lttng_ust_ze_sampling, memStats, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_mem_handle_t)_sampling_hMemModule[driverIdx][deviceIdx][memModuleIdx], &memState, &memBandwidth); } } @@ -1181,7 +1182,7 @@ static void readEngines_dump(uint32_t driverIdx, uint32_t deviceIdx){ _ZE_ERROR_MSG("ZES_ENGINE_GET_ACTIVITY_PTR", result); continue; } - do_tracepoint(lttng_ust_ze_sampling, engineStats, (ze_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_engine_handle_t)_sampling_engineHandles[driverIdx][deviceIdx][engineIdx], &engineStats); + do_tracepoint(lttng_ust_ze_sampling, engineStats, (zes_device_handle_t)_sampling_hDevices[driverIdx][deviceIdx], (zes_engine_handle_t)_sampling_engineHandles[driverIdx][deviceIdx][engineIdx], &engineStats); } } diff --git a/ze/ze_events.yaml b/ze/ze_events.yaml index 3a157aaf..a229397f 100644 --- a/ze/ze_events.yaml +++ b/ze/ze_events.yaml @@ -3,25 +3,25 @@ lttng_ust_ze_sampling: events: - name: deviceProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ uint32_t, deviceIdx ] - - [ ze_device_properties_t *, pDeviceProperties ] + - [ zes_device_properties_t *, pDeviceProperties ] fields: - [ ctf_integer_hex, uintptr_t, hDevice, "(uintptr_t)hDevice" ] - [ ctf_integer, uint32_t, deviceIdx, "deviceIdx" ] - [ ctf_sequence_text, uint8_t, pDeviceProperties_val, pDeviceProperties, size_t, "sizeof(ze_device_properties_t)" ] - name: subDeviceProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ ze_device_handle_t, hSubDevice ] - - [ ze_device_properties_t *, pSubDeviceProperties ] + - [ zes_device_properties_t *, pSubDeviceProperties ] fields: - [ ctf_integer_hex, uintptr_t, hDevice, "(uintptr_t)hDevice" ] - [ ctf_integer_hex, uintptr_t, hSubDevice, "(uintptr_t)hSubDevice" ] - [ ctf_sequence_text, uint8_t, pSubDeviceProperties_val, pSubDeviceProperties, size_t, "sizeof(ze_device_properties_t)" ] - name: engineProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_engine_handle_t, hEngines ] - [ zes_engine_properties_t *, pEngineProperties ] fields: @@ -30,7 +30,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pEngineProperties_val, pEngineProperties, size_t, "sizeof(zes_engine_properties_t)" ] - name: engineStats args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_engine_handle_t, hEngines ] - [ zes_engine_stats_t *, pEngineStats ] fields: @@ -39,7 +39,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pEngineStats_val, pEngineStats, size_t, "sizeof(zes_engine_stats_t)" ] - name: powerProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_pwr_handle_t, hPowers ] - [ zes_power_properties_t *, pPowerProperties ] fields: @@ -48,7 +48,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pPowerProperties_val, pPowerProperties, size_t, "sizeof(zes_power_properties_t)" ] - name: gpu_energy args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_pwr_handle_t, hPowers ] - [ uint32_t, domainIdx ] - [ zes_power_energy_counter_t *, pEnergyCounter ] @@ -59,7 +59,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pEnergyCounter_val, pEnergyCounter, size_t, "sizeof(zes_power_energy_counter_t)" ] - name: freqProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_freq_handle_t, hFrequency ] - [ zes_freq_properties_t *, pFreqProperties ] fields: @@ -68,7 +68,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pFreqProperties_val, pFreqProperties, size_t, "sizeof(zes_freq_properties_t)" ] - name: gpu_frequency args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_freq_handle_t, hFrequency ] - [ uint32_t, domainIdx ] - [ zes_freq_state_t *, pFreqState ] @@ -79,7 +79,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pFreqState_val, pFreqState, size_t, "sizeof(zes_freq_state_t)" ] - name: fabricPortProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_fabric_port_handle_t, hFabricPort ] - [ zes_fabric_port_properties_t *, pFabricPortProperties ] fields: @@ -88,7 +88,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pFabricPortProperties_val, pFabricPortProperties, size_t, "sizeof(zes_fabric_port_properties_t)" ] - name: fabricPort args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_fabric_port_handle_t, hFabricPort ] - [ zes_fabric_port_state_t *, pFabricPortState ] - [ zes_fabric_port_throughput_t *, pFabricPortThroughput ] @@ -99,7 +99,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pFabricPortThroughput_val, pFabricPortThroughput, size_t, "sizeof(zes_fabric_port_throughput_t)" ] - name: memoryProperties args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_mem_handle_t, hMemModule ] - [ zes_mem_properties_t *, pMemModuleProperties ] fields: @@ -108,7 +108,7 @@ lttng_ust_ze_sampling: - [ ctf_sequence_text, uint8_t, pMemModuleProperties_val, pMemModuleProperties, size_t, "sizeof(zes_mem_properties_t)" ] - name: memStats args: - - [ ze_device_handle_t, hDevice ] + - [ zes_device_handle_t, hDevice ] - [ zes_mem_handle_t, hMemModule ] - [ zes_mem_state_t *, pMemState ] - [ zes_mem_bandwidth_t *, pMemBandwidth ]