meta_kernel::compile is very slow, even for cached source

Abierto
#768 7 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
performance

Línea de trabajo

Empieza perfilando meta_kernel::compile y sus llamadas registradas a clCreateKernel, sha1 y program::build_with_source; el issue no menciona archivos fuente ni tests. Determina por qué los programas almacenados en caché siguen incurriendo en la creación repetida de kernels y en el hashing, y luego ejecuta un benchmark de esa ruta con caché para confirmar una sobrecarga sustancialmente menor sin perder el almacenamiento en caché de compilación existente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

design performance

Hi,

I am currently benchmarking the overhead of boost::compute. My test-program is computing nothing big and the equivalent cpu program finishes in no measurable runtime. The OpenCL version takes several seconds, so i decided to check with valgrind-callgrind where this time is lost. My program utilizes 11 different kernels and the runtime is the Intel OpenCL cpu implementation. I am using callgrind with O1 optimizations.

71% of total run-time is spent in 8149 calls to meta_kernel::compile.
Inside, we have over all 8149 calls:
total-runtime% function
43.21% clCreateKernel
14.5% compute::detail::sha1::sha1
8.7% program::build_with_source

As a sanity check:
1.6% meta_kernel::source
1.2% clEnqueueNDRangeKernel

so, roughly 58% of total running time is spent on figuring out whether the program is already build and creating the kernel afterwards. Compiling and caching works fine, we have exactly 11 calls to build_with_source.

The problem is that compute assumes that kernels are throw-away objects. This is unfortunately not the case. e.g. on NVIDIA, clCreateKernel is reported to have an overhead of roughly 1ms. My runtime seems to be in the same order. The programs built with meta_kernel have only one kernel function, so one easy workaround would be to cache the kernel together with the program.

Also, sha1 is terribly slow. The hash function should not take an order of magnitude longer than creating the source in the first place.

Lenguaje dominante
C++
Estrellas
1.7k
Forks
340
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de boostorg/compute

Todos los issues de boostorg/compute

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.