From a87024da0e4d79a05ad3485b79addfbcbe017ed5 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 20 Oct 2020 15:10:58 +0200 Subject: [PATCH] Don't print identical compiler invocations during reflection. --- src/reflection.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reflection.jl b/src/reflection.jl index 1e20c3b0..605c45e4 100644 --- a/src/reflection.jl +++ b/src/reflection.jl @@ -127,10 +127,12 @@ function emit_hooked_compilation(inner_hook, ex...) user_code = ex[end] user_kwargs = ex[1:end-1] quote - local kernels = 0 + local kernels = Set() function outer_hook(job) - kernels += 1 - $inner_hook(job; $(map(esc, user_kwargs)...)) + if !in(job, kernels) + $inner_hook(job; $(map(esc, user_kwargs)...)) + push!(kernels, job) + end end if GPUCompiler.compile_hook[] !== nothing @@ -143,7 +145,7 @@ function emit_hooked_compilation(inner_hook, ex...) GPUCompiler.compile_hook[] = nothing end - if kernels == 0 + if isempty(kernels) error("no kernels executed while evaluating the given expression") end