From 75e3799e93396b9f23583e3be80b0f3f99135bc7 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Thu, 24 Oct 2024 00:36:33 +0100 Subject: [PATCH] Gate BijectorsEnzymeExt precompilation --- ext/BijectorsEnzymeExt.jl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ext/BijectorsEnzymeExt.jl b/ext/BijectorsEnzymeExt.jl index 1e8d8aa3..724c4d3d 100644 --- a/ext/BijectorsEnzymeExt.jl +++ b/ext/BijectorsEnzymeExt.jl @@ -8,7 +8,21 @@ else using ..Bijectors: find_alpha end -@import_rrule typeof(find_alpha) Real Real Real -@import_frule typeof(find_alpha) Real Real Real +# Julia 1.11.1 caused a change in the ordering of precompilation for extensions. +# https://github.com/TuringLang/Bijectors.jl/issues/332 +# See https://github.com/JuliaLang/julia/issues/56204 +@static if v"1.11.1" <= VERSION < v"1.12" + function __init__() + if !Base.generating_output() + Base.eval(quote + @import_rrule typeof(find_alpha) Real Real Real + @import_frule typeof(find_alpha) Real Real Real + end) + end + end +else + @import_rrule typeof(find_alpha) Real Real Real + @import_frule typeof(find_alpha) Real Real Real +end end