Repository navigation
Add an integrated profiler to oneAPI.@profile - #730
Merged
Merged
Conversation
maleadt
force-pushed
the
tb/profile-pti
branch
2 times, most recently
from
October 21, 2026 10:46
24c3f9b to
9fde747
Compare
maleadt
marked this pull request as ready for review
October 21, 2026 13:53
Contributor
|
Documentation preview: https://juliagpu.github.io/oneAPI.jl/previews/PR730/ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #730 +/- ##
==========================================
+ Coverage 85.08% 85.23% +0.14%
==========================================
Files 53 54 +1
Lines 4660 4829 +169
==========================================
+ Hits 3965 4116 +151
- Misses 695 713 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PTI (Profiling Tools Interfaces for GPU) records the Level Zero API calls a process makes and the kernels, copies and fills that execute on the device, much like CUPTI's activity API. The wrappers are generated from PTI_jll's headers like those for Level Zero. PTI calls its buffer callbacks from its own threads, including while the process exits, where Julia code would hang. PTI_jll's libpti_buffers implements them in C instead, and `PTI.foreach_record` processes the queued buffers. The libraries are only loaded when first used.
Without `external=true`, `oneAPI.@profile` now collects the activity of the given code with PTI, and shows the Level Zero API calls made by the host and the kernels, copies and fills that executed on the device, as a summary or, with `trace=true`, as a chronological trace in which correlation IDs link the API calls to the operations they submitted. This includes the work that oneAPI.jl batches and the work that oneMKL submits. `oneAPI.@bprofile` runs code repeatedly and reports the aggregated results. Like CUDA.jl, `oneAPI.@profile` defaults to the external profiler when Julia runs under one. The display code is adapted from Metal.jl's profiler.
maleadt
force-pushed
the
tb/profile-pti
branch
from
October 23, 2026 13:08
9fde747 to
8135b85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #729. Draft until PTI_jll is registered (JuliaPackaging/Yggdrasil#15262).
With
external=true(#729), oneAPI.jl can restrict an external profiler to a region, but getting a quick overview of where time goes still requires installing and launching unitrace or VTune. CUDA.jl and Metal.jl have an integrated@profilethat shows host and device activity in the REPL.This adds that on top of Intel's Profiling Tools Interfaces for GPU (PTI), the library behind PyTorch's XPU profiler and the closest analogue to CUPTI's activity API. It records the Level Zero API calls made by the process and the kernels, copies and fills executed on the device, with correlation IDs linking them. Because it hooks the Level Zero loader, it also captures the work oneAPI.jl batches and the work oneMKL submits itself:
trace=truegives a chronological trace,raw=trueincludes polls for unfinished work, andoneAPI.@bprofileprofiles repeated execution. As in CUDA.jl,@profiledefaults to the external profiler when Julia runs under one. The display code is adapted from Metal.jl.PTI calls its buffer callbacks from its own threads, including from a static destructor at exit; with Julia callbacks the process hung at exit. PTI_jll therefore ships a small C library implementing those callbacks, and Julia processes the queued buffers after flushing. PTI_jll's libraries are only loaded on first use. Self-instrumenting with event timestamps (Metal.jl's approach) was rejected: it would reimplement PTI, and miss oneMKL's submissions.
Costs: new dependencies on PTI_jll, PrettyTables, Crayons and Statistics;
using oneAPItakes about 50 ms longer (mostly PrettyTables). After a profile, kernel launches are about 1% slower (2.65 vs 2.62 µs), as PTI keeps the tracing layer installed. Integrated profiling is x86_64 Linux only.Tested on an Arc A770 with Julia 1.10 and 1.13. This needs PTI_jll to be registered first (JuliaPackaging/Yggdrasil#15262).