|
9 | 9 | #include "pti/pti_view.h" |
10 | 10 | #include <cassert> |
11 | 11 | #include <cstring> |
12 | | -#include <level_zero/layers/zel_tracing_api.h> |
13 | 12 | #include <level_zero/zet_api.h> |
14 | 13 |
|
15 | 14 | #include <algorithm> |
@@ -207,61 +206,6 @@ struct XpuptiProfiler::XpuptiProfilerPimpl |
207 | 206 |
|
208 | 207 | static uint32_t get_correlation_id(xpupti::Pti_Activity *activity); |
209 | 208 |
|
210 | | - static void OnEnterCommandListAppendLaunchKernel( |
211 | | - ze_command_list_append_launch_kernel_params_t *params, ze_result_t result, |
212 | | - void *global_user_data, void **instance_user_data) { |
213 | | - std::cout << "Function zeCommandListAppendLaunchKernel is called on enter" |
214 | | - << std::endl; |
215 | | - ze_kernel_handle_t kernel = *(params->phKernel); |
216 | | - |
217 | | - size_t size = 0; |
218 | | - ze_result_t status = zeKernelGetName(kernel, &size, nullptr); |
219 | | - assert(status == ZE_RESULT_SUCCESS); |
220 | | - |
221 | | - std::vector<char> name(size); |
222 | | - status = zeKernelGetName(kernel, &size, name.data()); |
223 | | - assert(status == ZE_RESULT_SUCCESS); |
224 | | - std::string str(name.begin(), name.end()); |
225 | | - std::cout << "OnEnterCommandListAppendLaunchKernel::demangled kernel_name: " |
226 | | - << Demangle(name.data()) << "\n"; |
227 | | - |
228 | | - threadState.enterOp(); |
229 | | - |
230 | | - size_t numInstances = 1; |
231 | | - // FIXME: 4 - debug value |
232 | | - uint32_t correlationId = 4; |
233 | | - threadState.profiler.correlation.correlate(correlationId, numInstances); |
234 | | - } |
235 | | - |
236 | | - static void OnEnterCommandListAppendLaunchCooperativeKernel( |
237 | | - ze_command_list_append_launch_cooperative_kernel_params_t *params, |
238 | | - ze_result_t result, void *global_user_data, void **instance_user_data) { |
239 | | - std::cout << "Function zeCommandListAppendLaunchKernel is called on enter" |
240 | | - << std::endl; |
241 | | - threadState.enterOp(); |
242 | | - // FIXME: 4 - debug value |
243 | | - threadState.profiler.correlation.correlate(4, 1); |
244 | | - } |
245 | | - |
246 | | - static void OnExitCommandListAppendLaunchKernel( |
247 | | - ze_command_list_append_launch_kernel_params_t *params, ze_result_t result, |
248 | | - void *global_user_data, void **instance_user_data) { |
249 | | - std::cout << "Function zeCommandListAppendLaunchKernel is called on exit" |
250 | | - << std::endl; |
251 | | - threadState.exitOp(); |
252 | | - // Track outstanding op for flush |
253 | | - // FIXME: 4 - debug value |
254 | | - uint32_t correlationId = 4; |
255 | | - threadState.profiler.correlation.submit(correlationId); |
256 | | - // here works |
257 | | - // uint64_t corr_id = 0; |
258 | | - // auto res = |
259 | | - // ptiViewPopExternalCorrelationId(pti_view_external_kind::PTI_VIEW_EXTERNAL_KIND_CUSTOM_1, |
260 | | - // &corr_id); std::cout << "ptiViewPopExternalCorrelationId res: " << res << |
261 | | - // "\n" << std::flush; std::cout << "ptiViewPopExternalCorrelationId |
262 | | - // corr_id: " << corr_id << "\n"; |
263 | | - } |
264 | | - |
265 | 209 | static void allocBuffer(uint8_t **buffer, size_t *bufferSize); |
266 | 210 | static void completeBuffer(uint8_t *buffer, size_t size, size_t validSize); |
267 | 211 | static void callbackFn(pti_callback_domain domain, |
@@ -377,8 +321,6 @@ void CallbackCommon(pti_callback_domain domain, |
377 | 321 | std::cout << std::endl; |
378 | 322 | } |
379 | 323 |
|
380 | | -zel_tracer_handle_t tracer = nullptr; |
381 | | - |
382 | 324 | typedef void (*EnumDeviceUUIDsFunc)(std::vector<std::array<uint8_t, 16>>); |
383 | 325 |
|
384 | 326 | int callEnumDeviceUUIDs(const std::string &utils_cache_path) { |
@@ -442,30 +384,6 @@ void XpuptiProfiler::XpuptiProfilerPimpl::doStart() { |
442 | 384 | ze_result_t status = ZE_RESULT_SUCCESS; |
443 | 385 | // status = zeInit(ZE_INIT_FLAG_GPU_ONLY); |
444 | 386 | // assert(status == ZE_RESULT_SUCCESS); |
445 | | -
|
446 | | - zel_tracer_desc_t tracer_desc = {ZEL_STRUCTURE_TYPE_TRACER_DESC, nullptr, |
447 | | - nullptr}; |
448 | | -
|
449 | | - status = zelTracerCreate(&tracer_desc, &tracer); |
450 | | - std::cout << "zelTracerCreate: " << status << "\n" << std::flush; |
451 | | - assert(status == ZE_RESULT_SUCCESS); |
452 | | -
|
453 | | - zet_core_callbacks_t prologue_callbacks = {}; |
454 | | - zet_core_callbacks_t epilogue_callbacks = {}; |
455 | | - prologue_callbacks.CommandList.pfnAppendLaunchKernelCb = |
456 | | - OnEnterCommandListAppendLaunchKernel; |
457 | | - // prologue_callbacks.CommandList.pfnAppendLaunchCooperativeKernelCb = |
458 | | - // OnEnterCommandListAppendLaunchCooperativeKernel; |
459 | | - epilogue_callbacks.CommandList.pfnAppendLaunchKernelCb = |
460 | | - OnExitCommandListAppendLaunchKernel; |
461 | | -
|
462 | | - status = zelTracerSetPrologues(tracer, &prologue_callbacks); |
463 | | - assert(status == ZE_RESULT_SUCCESS); |
464 | | - status = zelTracerSetEpilogues(tracer, &epilogue_callbacks); |
465 | | - assert(status == ZE_RESULT_SUCCESS); |
466 | | -
|
467 | | - status = zelTracerSetEnabled(tracer, true); |
468 | | - assert(status == ZE_RESULT_SUCCESS); |
469 | 387 | */ |
470 | 388 |
|
471 | 389 | xpupti::viewSetCallbacks<true>(allocBuffer, completeBuffer); |
@@ -499,14 +417,6 @@ void XpuptiProfiler::XpuptiProfilerPimpl::doFlush() { |
499 | 417 | } |
500 | 418 |
|
501 | 419 | void XpuptiProfiler::XpuptiProfilerPimpl::doStop() { |
502 | | - /* |
503 | | - ze_result_t status = ZE_RESULT_SUCCESS; |
504 | | - status = zelTracerSetEnabled(tracer, false); |
505 | | - assert(status == ZE_RESULT_SUCCESS); |
506 | | - status = zelTracerDestroy(tracer); |
507 | | - assert(status == ZE_RESULT_SUCCESS); |
508 | | - */ |
509 | | - |
510 | 420 | xpupti::viewDisable<true>(PTI_VIEW_DEVICE_GPU_KERNEL); |
511 | 421 | xpupti::viewDisable<true>(PTI_VIEW_DEVICE_GPU_MEM_FILL); |
512 | 422 | xpupti::viewDisable<true>(PTI_VIEW_DEVICE_GPU_MEM_COPY); |
|
0 commit comments