Skip to content

[SYCL][XPTI] Enable PI calls notifications with arguments #3973

New issue

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

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

Already on GitHub? # to your account

Merged
merged 26 commits into from
Jul 16, 2021

Conversation

alexbatashev
Copy link
Contributor

This PR adds capability to capture PI calls' arguments and pass this data to XPTI subscribers. The sample pi-trace library demonstrates how one can parse this data on the subscriber side. An example usage of this utility would be:

XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=lib/libxptifw.so XPTI_SUBSCRIBERS=lib/libpi_trace.so ./my_app

@smaslov-intel
Copy link
Contributor

Thanks @alexbatashev ! This should help debugging issues at PI level.

XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=lib/libxptifw.so XPTI_SUBSCRIBERS=lib/libpi_trace.so ./my_app

That's a lot!
Can we build/ship a tool that will make it easy to use this functionality out-of-box?

@tovinkere
Copy link
Contributor

Thanks @alexbatashev ! This should help debugging issues at PI level.

XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=lib/libxptifw.so XPTI_SUBSCRIBERS=lib/libpi_trace.so ./my_app

That's a lot!
Can we build/ship a tool that will make it easy to use this functionality out-of-box?

That's a possibility - or the construction of the tool could be hidden in a script.

@alexbatashev
Copy link
Contributor Author

That's a lot!
Can we build/ship a tool that will make it easy to use this functionality out-of-box?

I hardly find the existing pi_trace anything but an API usage example. It is less functional than the SYCL_PI_TRACE=-1. However, if it evolves to something useful, it's not a big problem to wrap it into some python script.

* upstream/sycl: (489 commits)
  [SYCL][NFC] Lower overhead of making plugin calls (intel#3982)
  [SYCL][NFC] Use default macro initialization where applicable (intel#3979)
  [SYCL] Enable SPV_INTEL_fpga_invocation_pipelining_attributes extension (intel#3864)
  [SYCL] Disable reassociate pass to reduce register pressure (intel#3615)
  [Driver][SYCL][FPGA] Restrict -O0 for FPGA with hardware (intel#3966)
  [SYCL][NFC] Fix warnings coming out of SYCL headers. (intel#3978)
  [SYCL] Fix bugs with recursion in SYCL kernel (intel#3958)
  [SYCL][LevelZero] Add support to detect host->device and device->host transfers for USM (intel#3975)
  [SYCL] Enable native FP atomics by default (intel#3869)
  [sycl-post-link] Avoid copying from nullptr (intel#3963)
  [SYCL-PTX] Add warp-reduce path in sub-group reduce (intel#3949)
  [BuildBot] Uplift CPU/FPGAEMU RT version for CI Process (intel#3946)
  Fix handling of complex constant expressions
  Handle OpSpecConstantOp with CompositeExtract and CompositeInsert
  Handle OpSpecConstantOp with VectorShuffle
  [FuncSpec] Don't specialise functions with NoDuplicate instructions.
  [mlir][linalg] Support low padding in subtensor(pad_tensor) lowering
  [gn build] Port 208332d
  [AMDGPU] Add Optimize VGPR LiveRange Pass.
  [mlir][Linalg] NFC - Drop unused variable definition.
  ...
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but still suggest adding a test.

@smaslov-intel
Copy link
Contributor

That's a lot!
Can we build/ship a tool that will make it easy to use this functionality out-of-box?

I hardly find the existing pi_trace anything but an API usage example. It is less functional than the SYCL_PI_TRACE=-1. However, if it evolves to something useful, it's not a big problem to wrap it into some python script.

Why are you evolving it then, if you don't think it is useful?

@alexbatashev
Copy link
Contributor Author

That's a lot!
Can we build/ship a tool that will make it easy to use this functionality out-of-box?

I hardly find the existing pi_trace anything but an API usage example. It is less functional than the SYCL_PI_TRACE=-1. However, if it evolves to something useful, it's not a big problem to wrap it into some python script.

Why are you evolving it then, if you don't think it is useful?

I'm not saying it's useless. It's just not mature to compete with SYCL_PI_TRACE (yet). So, I don't expect many users for now. In future pi_trace can very well grow more functionality (and replace the environment variable, if that makes sense).

* upstream/sycl: (649 commits)
  [SYCL][Driver][NFC] Update integration footer test for 32-bit host (intel#4039)
  [SYCL][L0] Initialize descriptor .stype and .pNext (intel#4032)
  [SYCL] Add sycl::kernel::get_kernel_bundle method (intel#3855)
  [SYCL] Add support for device UUID as a SYCL extension. (intel#3696)
  [SYCL][Matrix] Add spec document for the matrix extension interface and its first implementation for AMX (intel#3551)
  Fix debug build mangler test after PR#3992 (8f38045). (intel#4033)
  [Driver][SYCL] Restrict user -include file in final integration footer step (intel#4036)
  [SYCL] [Tests] Do not copy device binary image mocks (intel#4023)
  [SYCL][Doc] Update docs to reflect new compiler features (intel#4030)
  [SYCL][CUDA] cl_khr_fp16 extension connected to cuda PI. (intel#4029)
  [SYCL][NFC] Refactor RT unit tests (intel#4021)
  [SYCL] Switch to using integration footer by default (intel#3777)
  [SYCL][CUDA] Add the Use Default Stream property (intel#4004)
  Uplift GPU RT version for Linux to 21.24.20098 (intel#4003)
  [SYCL][CUDA] atomic_ref.fetch_add used for fp64 reduction if device.has(atomic64) (intel#3950)
  [Driver][SYCL] Differentiate host dependency link from regular host link (intel#4002)
  [SYCL][ESIMD] Support device half type in intrinsics. (intel#4024)
  [SYCL] Allow fpga_reg only for PODs and Trivially-copyable structs (intel#3643)
  [SYCL][FPGA] Restore legacy debug info version for the hardware (intel#3991)
  [SYCL][PI][L0] Force reset of memcpy command-list. (intel#4001)
  ...
smaslov-intel
smaslov-intel previously approved these changes Jul 6, 2021
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@alexbatashev
Copy link
Contributor Author

@tovinkere could you please take a look? Your approval is required to merge this patch.

tovinkere
tovinkere previously approved these changes Jul 6, 2021
Copy link
Contributor

@tovinkere tovinkere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@@ -255,6 +269,10 @@ enum class trace_point_type_t : uint16_t {
function_end = XPTI_TRACE_POINT_END(12),
/// Use to notify that a new metadata entry is available for a given event
metadata = XPTI_TRACE_POINT_BEGIN(13),
/// Used to trace function call begin and its arguments.
function_with_args_begin = XPTI_TRACE_POINT_BEGIN(14),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI - In the future, you don't need to extend this enum. You can extend it as a "user_defined" trace point.

@alexbatashev
Copy link
Contributor Author

@tovinkere friendly ping

Copy link
Contributor

@tovinkere tovinkere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexbatashev
Copy link
Contributor Author

The pre-commit failure is not related to this patch.
@bader could you please review/merge?

@bader bader merged commit e239fdf into intel:sycl Jul 16, 2021
@alexbatashev alexbatashev deleted the xpti_pi_args branch July 16, 2021 10:57
bader added a commit that referenced this pull request Jul 19, 2021
bader added a commit that referenced this pull request Jul 19, 2021
)" (#4144)

This reverts commit e239fdf.

The patch introduces build failures like this: 

llvm/sycl/tools/pi-trace/pi_trace.cpp:13:10: fatal error: xpti_trace_framework.h: No such file or directory
   13 | #include "xpti_trace_framework.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
bader pushed a commit that referenced this pull request Jul 22, 2021
This patch re-lands #3973 with fixes to #4137

----

This PR adds capability to capture PI calls' arguments and pass this data to XPTI subscribers. The sample pi-trace library demonstrates how one can parse this data on the subscriber side. An example usage of this utility would be:
```bash
XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=lib/libxptifw.so XPTI_SUBSCRIBERS=lib/libpi_trace.so ./my_app
```
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants