Deduplicate concurrent compilations of the same kernel

Abierto
#329 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Área
performance

Línea de trabajo

Start in compile_or_lookup in src/launch.jl, where the existing job_results_lock check and the compile-outside-lock path live, and read cached_results(job) to see how one TileCompilerResults maps to each job. Add per-result in-flight tracking with a Threading.Condition created on that lock, and keep the in-flight state out of TileCompilerResults, since that type is serialized into package images. Done means concurrent misses for one job run tileiras once, waiters reuse the published cubin and call GPUCompiler.run_compile_hook, and a failed compile wakes waiters so they retry rather than hang.

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

Descripción

compile_or_lookup (src/launch.jl) already compiles outside job_results_lock, but concurrent misses for the same job all compile: each requester runs emit_tile and its own tileiras, and the first result to be published wins. ObjCache.get! does not deduplicate in-flight work either.

On an RTX 5080, 8 tasks first-launching the same matmul configuration spawned tileiras 8 times for that job. tileiras takes 55–550 ms for the example kernels (fmha: 0.64 s, 133 MB RSS, single-threaded), against 1–27 ms for emit_tile, so every duplicate costs a full assembler run. With more tasks than cores, that also delays the first launch for everyone.

JuliaGPU/CUDA.jl#3398 handles the same situation for CUDA.jl's ptxas, with in-flight tracking modelled on Base.require's package_locks. Here it could go in compile_or_lookup, since cached_results(job) already returns one TileCompilerResults per job:

  • keep an IdDict{TileCompilerResults,Threads.Condition} guarded by job_results_lock, with every condition created on that lock;
  • under the lock: if res.cubin is set, return it; if an entry exists, wait on it and check again; otherwise register a condition and compile outside the lock;
  • under the lock, publish res.cubin, then remove the entry and notify (in a finally, so that after a failure the waiters retry instead of hanging);
  • waiters that end up with a published CUBIN call GPUCompiler.run_compile_hook(job), like hits do.

The in-flight state shouldn't live on TileCompilerResults itself, which is serialized into package images.

Lenguaje dominante
Julia
Estrellas
90
Forks
13
Merge medio
4 d 8 h
PR fusionados (30 d)
19

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 JuliaGPU/cuTile.jl

Todos los issues de JuliaGPU/cuTile.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.