While PTI_VIEW_DEVICE_GPU_KERNEL is enabled, SYCL event profiling returns zero kernel durations
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp, linux
- Área
- observability, performance
Línea de trabajo
Start by building and running the provided reproducer with SYCL event profiling enabled, then compare the event durations with PTI kernel records across the three phases. The issue reports zero SYCL durations only while PTI_VIEW_DEVICE_GPU_KERNEL is enabled, plus increased host submission time. Done means identifying and fixing the interaction so SYCL event profiling remains correct while the view is collecting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
With the GPU kernel view enabled, command_end - command_start from SYCL event profiling (a queue created with property::queue::enable_profiling) is 0 for every kernel the program submits. PTI's own kernel records are correct: their durations match what SYCL event profiling gives with PTI off. After ptiViewDisable, SYCL event profiling works again. An application that times its own kernels with SYCL events gets zeros while a profiler built on PTI is collecting.
Also visible in the same runs: each launch takes 7-15 us more host time while the view is enabled.
To reproduce
// Kernel durations from PTI's GPU kernel view against SYCL event profiling of the same kernel.
// One small kernel (y = a*x + y over 2^20 floats) is submitted 200 times back to back, first with
// PTI off (durations from SYCL event profiling), then with PTI_VIEW_DEVICE_GPU_KERNEL enabled
// (durations from PTI's records, and SYCL events alongside). Prints medians and wall time per call.
#include <sycl/sycl.hpp>
#include <pti/pti_view.h>
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
static std::vector<double> pti_us;
static void requested(unsigned char** buf, size_t* size) {
*size = 1 << 22;
*buf = static_cast<unsigned char*>(std::aligned_alloc(64, *size));
}
static void completed(unsigned char* buf, size_t, size_t used) {
pti_view_record_base* rec = nullptr;
while (ptiViewGetNextRecord(buf, used, &rec) == PTI_SUCCESS && rec) {
if (rec->_view_kind == PTI_VIEW_DEVICE_GPU_KERNEL) {
auto* k = reinterpret_cast<pti_view_record_kernel*>(rec);
if (std::strstr(k->_name, "axpy")) pti_us.push_back((k->_end_timestamp - k->_start_timestamp) / 1000.0);
}
}
std::free(buf);
}
static double median(std::vector<double> v) {
std::sort(v.begin(), v.end());
return v.empty() ? 0 : v[v.size() / 2];
}
class axpy;
int main(int argc, char** argv) {
sycl::queue q{sycl::gpu_selector_v, sycl::property::queue::enable_profiling{}};
const size_t n = argc > 1 ? std::strtoul(argv[1], nullptr, 0) : 1 << 20;
float* x = sycl::malloc_device<float>(n, q);
float* y = sycl::malloc_device<float>(n, q);
q.fill(x, 1.0f, n).wait();
q.fill(y, 2.0f, n).wait();
auto submit = [&] {
return q.parallel_for<axpy>(sycl::range<1>(n), [=](sycl::id<1> i) { y[i] = 0.5f * x[i] + y[i]; });
};
auto phase = [&](const char* name) {
for (int i = 0; i < 20; ++i) submit();
q.wait();
std::vector<sycl::event> ev;
auto t0 = std::chrono::steady_clock::now();
for (int i = 0; i < 200; ++i) ev.push_back(submit());
q.wait();
double wall = std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - t0).count() / 200;
std::vector<double> d;
for (auto& e : ev)
d.push_back((e.get_profiling_info<sycl::info::event_profiling::command_end>() -
e.get_profiling_info<sycl::info::event_profiling::command_start>()) / 1000.0);
std::printf("%-22s wall %.1f us/call, SYCL event median %.1f us", name, wall, median(d));
};
std::printf("device: %s\n", q.get_device().get_info<sycl::info::device::name>().c_str());
phase("PTI off");
std::printf("\n");
ptiViewSetCallbacks(requested, completed);
ptiViewEnable(PTI_VIEW_DEVICE_GPU_KERNEL);
phase("PTI kernel view on");
ptiViewDisable(PTI_VIEW_DEVICE_GPU_KERNEL);
ptiFlushAllViews();
std::printf(", PTI kernel median %.1f us (%zu records)\n", median(pti_us), pti_us.size());
phase("after ptiViewDisable");
std::printf("\n");
}
icpx -fsycl -O2 pti_kernel_time.cpp -lpti_view -o pti_kernel_time
./pti_kernel_time 1048576
Output on an Intel Arc A770, three phases of 200 back-to-back submissions:
PTI off wall 30.6 us/call, SYCL event median 29.4 us
PTI kernel view on wall 40.9 us/call, SYCL event median 0.0 us, PTI kernel median 29.6 us (220 records)
after ptiViewDisable wall 30.9 us/call, SYCL event median 29.2 us
Across kernel sizes (argument = element count), SYCL event median with PTI off / with the kernel view on / PTI's median, and wall time per call off / on:
| elements | SYCL event, PTI off | SYCL event, view on | PTI record | wall off / on |
|---|---|---|---|---|
| 1,024 | 2.0 us | 0.0 | 2.0 us | 4.7 / 15.0 us |
| 65,536 | 3.2 us | 0.0 | 3.2 us | 4.5 / 15.5 us |
| 262,144 | 9.4 us | 0.0 | 9.4 us | 10.3 / 21.2 us |
| 524,288 | 16.1 us | 0.0 | 16.2 us | 17.2 / 24.2 us |
| 4,194,304 | 115.3 us | 0.0 | 116.0 us | 116.5 / 131.0 us |
Expected behavior
SYCL event profiling reports kernel durations whether or not PTI's kernel view is enabled.
Environment
- PTI 1.2.1 (
libpti_view.so.1.2.1from theintel_pti1.2.1 wheel; headers fromrelease/pti-1.2at 25a77ed), with oneAPI 2026.0's SYCL runtime; the numbers above are from this build - Also on PTI 1.1.0 (the
intel_pti1.1.0 wheel, headers from tag pti-1.1.0), with oneAPI 2026.0's SYCL runtime and with theintel-sycl-rt2026.1.2 runtime from the PyTorch XPU wheels (libsycl.so.9,libur_loader.so.0andlibpti_view.so.1all resolved from the wheels' directory): the same zero durations - Built with the Intel oneAPI DPC++/C++ Compiler 2026.0.0
- Measured on one GPU (Arc A770, xe kernel driver); not tried on other Intel GPUs or on i915
- Intel Arc A770, Linux 7.2.14 with the xe kernel driver, intel-compute-runtime 26.35.39758.10 (Level Zero driver 1.17.39758), level-zero-loader 1.32.0
- Lenguaje dominante
- C++
- Estrellas
- 278
- Forks
- 75
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de intel/pti-gpu
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
Todos los issues de intel/pti-gpu
Issues similares
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unusedAbiertointernal correctness low priority rt_lib
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yetPosiblemente ocupada @matejk la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pocoproject/poco#5674 ·
Los mantenedores suelen responder en 2 días
-
bug docs GUI
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
sonic-pi-net/sonic-pi#3609 ·
-
Unreachable code warningAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
SanderMertens/flecs#2395 ·
Los mantenedores suelen responder en 1 día