Skip to content

Fix ref if mixed#2331

Merged
wsmoses merged 1 commit intomainfrom
rmixed
Mar 18, 2025
Merged

Fix ref if mixed#2331
wsmoses merged 1 commit intomainfrom
rmixed

Conversation

@wsmoses
Copy link
Member

@wsmoses wsmoses commented Mar 17, 2025

Fixes Joe's issue

@wsmoses wsmoses requested a review from vchuravy March 17, 2025 21:29
@github-actions
Copy link
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/jlrt.jl b/src/jlrt.jl
index bd622e0..503360d 100644
--- a/src/jlrt.jl
+++ b/src/jlrt.jl
@@ -366,9 +366,9 @@ function val_from_byref_if_mixed(B::LLVM.IRBuilder, gutils::GradientUtils, @nosp
     end
 end
 
-@generated function ref_if_mixed(val::VT) where VT
-    areg = active_reg_inner(VT, (), nothing, Val(true)) 
-    if areg == ActiveState || areg == MixedState
+@generated function ref_if_mixed(val::VT) where {VT}
+    areg = active_reg_inner(VT, (), nothing, Val(true))
+    return if areg == ActiveState || areg == MixedState
         quote
             Base.@_inline_meta
             Ref(val)
@@ -390,10 +390,10 @@ function byref_from_val_if_mixed(B::LLVM.IRBuilder, @nospecialize(val::LLVM.Valu
         if legal && act == AnyState
             return val
         end
-        return emit_apply_generic!(B, LLVM.Value[unsafe_to_llvm(B, ref_if_mixed), val]) 
+        return emit_apply_generic!(B, LLVM.Value[unsafe_to_llvm(B, ref_if_mixed), val])
     end
     act = active_reg_inner(TT, (), world)
-    
+
     if act == ActiveState || act == MixedState
         obj = emit_allocobj!(B, Base.RefValue{TT})
         lty = convert(LLVMType, TT)

@github-actions
Copy link
Contributor

Benchmark Results

main 4ef980f... main/4ef980f02982ba...
basics/overhead 4.03 ± 0.01 ns 4.03 ± 0.001 ns 1
time_to_load 1.15 ± 0.019 s 1.13 ± 0.0021 s 1.02

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@wsmoses wsmoses merged commit ba4d77f into main Mar 18, 2025
22 of 31 checks passed
@giordano giordano deleted the rmixed branch July 4, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant