Skip to content

debugging custom rule int to ptr on 1.12#3113

Open
wsmoses wants to merge 2 commits into
mainfrom
itp112
Open

debugging custom rule int to ptr on 1.12#3113
wsmoses wants to merge 2 commits into
mainfrom
itp112

Conversation

@wsmoses
Copy link
Copy Markdown
Member

@wsmoses wsmoses commented May 19, 2026

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

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/errors.jl b/src/errors.jl
index 27ff261e..b7a2b896 100644
--- a/src/errors.jl
+++ b/src/errors.jl
@@ -1226,7 +1226,7 @@ function julia_error(
         throw(EnzymeInternalError(msg, ir, bt))
     elseif errtype == API.ET_ShowInternalError
         Core.print(EnzymeInternalError(msg, ir, bt))
-	return C_NULL
+        return C_NULL
     elseif errtype == API.ET_GCRewrite
         data2 = LLVM.Value(data2)
         fn = LLVM.Function(LLVM.API.LLVMGetParamParent(data2::LLVM.Argument))
diff --git a/src/rules/customrules.jl b/src/rules/customrules.jl
index 483b9182..7969e480 100644
--- a/src/rules/customrules.jl
+++ b/src/rules/customrules.jl
@@ -165,7 +165,7 @@ function push_box_for_argument!(@nospecialize(B::LLVM.IRBuilder),
                           @nospecialize(roots_cache::Union{LLVM.Value, Nothing}), 
                           @nospecialize(shadow_roots::Union{Nothing, LLVM.Value}) = nothing,
 			  just_primal_rooting::Bool = false
-                          )::Union{Nothing, LLVM.Value}
+    )::Union{Nothing, LLVM.Value}
 
     if !activity_wrap
         @assert arg.typ == Ty
@@ -212,11 +212,11 @@ function push_box_for_argument!(@nospecialize(B::LLVM.IRBuilder),
             @assert shadow_roots === nothing
             return nothing
         else
-	    arty_foralloca = if VERSION >= v"1.12" && num_inline_roots != 0
-	       strip_tracked_pointers(arty)
-	    else
-	       arty
-	    end
+            arty_foralloca = if VERSION >= v"1.12" && num_inline_roots != 0
+                strip_tracked_pointers(arty)
+            else
+                arty
+            end
             val = load!(B, arty_foralloca, ogval, "rule_val_load_v1_")
             metadata(val)["enzyme_mustcache"] = MDNode(LLVM.Metadata[])
         end
@@ -264,9 +264,9 @@ function push_box_for_argument!(@nospecialize(B::LLVM.IRBuilder),
     llty = convert(LLVMType, Ty; allow_boxed = true)
 
     llty_foralloca = if VERSION >= v"1.12" && num_inline_roots != 0
-       strip_tracked_pointers(llty)
+        strip_tracked_pointers(llty)
     else
-       llty
+        llty
     end
 
     al0 = al = alloca!(B, llty_foralloca, "arg.$Ty")
@@ -829,12 +829,12 @@ function enzyme_custom_setup_args(
                 @assert ival !== nothing
                 just_primal_rooting = true
                 al = push_box_for_argument!(B, Ty, val, roots_val, arg, args, uncacheable, true, ogval, roots_cache, shadow_roots, just_primal_rooting)
-		    
-		llty_foralloca = if VERSION >= v"1.12" && n_shadow_roots != 0
-	            strip_tracked_pointers(llty)
-		else
-	            llty
-	        end
+
+                llty_foralloca = if VERSION >= v"1.12" && n_shadow_roots != 0
+                    strip_tracked_pointers(llty)
+                else
+                    llty
+                end
 
                 iptr = inbounds_gep!(
                     B,

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Benchmark Results

main 17d7ec2... main / 17d7ec2...
basics/make_zero/namedtuple 0.0578 ± 0.0045 μs 0.0613 ± 0.0052 μs 0.943 ± 0.11
basics/make_zero/struct 0.251 ± 0.0092 μs 0.249 ± 0.009 μs 1.01 ± 0.052
basics/overhead 3.17 ± 0.002 ns 3.75 ± 0.003 ns 0.847 ± 0.00086
basics/remake_zero!/namedtuple 0.233 ± 0.013 μs 0.221 ± 0.0098 μs 1.06 ± 0.074
basics/remake_zero!/struct 0.229 ± 0.013 μs 0.219 ± 0.013 μs 1.05 ± 0.087
fold_broadcast/multidim_sum_bcast/1D 10.8 ± 0.71 μs 10.7 ± 0.35 μs 1.01 ± 0.074
fold_broadcast/multidim_sum_bcast/2D 12.1 ± 0.37 μs 10.8 ± 0.32 μs 1.12 ± 0.048
time_to_load 1.07 ± 0.0096 s 1.07 ± 0.012 s 0.998 ± 0.014

Benchmark Plots

A plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/26113162481/artifacts/7090617539.

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