Skip to content

Fix idx/rt getfield#3294

Merged
wsmoses merged 1 commit into
mainfrom
gf
Jul 8, 2026
Merged

Fix idx/rt getfield#3294
wsmoses merged 1 commit into
mainfrom
gf

Conversation

@wsmoses

@wsmoses wsmoses commented Jul 8, 2026

Copy link
Copy Markdown
Member

fixes #3291

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
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/rules/typeunstablerules.jl b/src/rules/typeunstablerules.jl
index 7283fc45..74d9d088 100644
--- a/src/rules/typeunstablerules.jl
+++ b/src/rules/typeunstablerules.jl
@@ -1226,8 +1226,8 @@ function rt_jl_getfield_aug(
     dptr::T,
     ::Type{Val{symname}},
     ::Val{isconst},
-    dptrs::Vararg{T,Nargs},
-) where {NT,T,Nargs,symname,isconst}
+        dptrs::Vararg{T, Nargs},
+    ) where {NT, T, Nargs, symname, isconst}
     res = if dptr isa Base.RefValue
         Base.getfield(dptr[], symname)
     else
@@ -1274,8 +1274,8 @@ function idx_jl_getfield_aug(
     dptr::T,
     ::Type{Val{symname}},
     ::Val{isconst},
-    dptrs::Vararg{T,Nargs},
-) where {NT,T,Nargs,symname,isconst}
+        dptrs::Vararg{T, Nargs},
+    ) where {NT, T, Nargs, symname, isconst}
     res = if dptr isa Base.RefValue
         Base.getfield(dptr[], symname + 1)
     else
@@ -1343,8 +1343,8 @@ function rt_jl_getfield_rev(
     dret,
     ::Type{Val{symname}},
     ::Val{isconst},
-    dptrs::Vararg{T,Nargs},
-) where {T,Nargs,symname,isconst}
+        dptrs::Vararg{T, Nargs},
+    ) where {T, Nargs, symname, isconst}
     cur = if dptr isa Base.RefValue
         getfield(dptr[], symname)
     else
@@ -1425,8 +1425,8 @@ function idx_jl_getfield_rev(
     dret,
     ::Type{Val{symname}},
     ::Val{isconst},
-    dptrs::Vararg{T,Nargs},
-) where {T,Nargs,symname,isconst}
+        dptrs::Vararg{T, Nargs},
+    ) where {T, Nargs, symname, isconst}
     cur = if dptr isa Base.RefValue
         Base.getfield(dptr[], symname + 1)
     else
diff --git a/test/typeunstable.jl b/test/typeunstable.jl
index b1a69d08..77d602aa 100644
--- a/test/typeunstable.jl
+++ b/test/typeunstable.jl
@@ -275,14 +275,17 @@ end
 function loss_3280(p)
     prob = MiniProblem3280([1.0], (0.0, 1.0), p, pairs((;)))
     active_field = Enzyme.Compiler.idx_jl_getfield_aug(
-        Val(NamedTuple{(1,)}), prob, Val{2}, Val(false))
+        Val(NamedTuple{(1,)}), prob, Val{2}, Val(false)
+    )
     return sum(abs2, active_field)
 end
 
 @testset "idx_jl_getfield_aug calling convention (Issue 3280 reproducer)" begin
     p = [0.5]
     dp = zero(p)
-    Enzyme.autodiff(set_runtime_activity(Reverse), Enzyme.Const(loss_3280), Enzyme.Active,
-        Enzyme.Duplicated(p, dp))
+    Enzyme.autodiff(
+        set_runtime_activity(Reverse), Enzyme.Const(loss_3280), Enzyme.Active,
+        Enzyme.Duplicated(p, dp)
+    )
     @test dp ≈ [1.0]
 end
\ No newline at end of file

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

main ac8a9fb... main / ac8a9fb...
basics/make_zero/namedtuple 0.0709 ± 0.0028 μs 0.0559 ± 0.0025 μs 1.27 ± 0.076
basics/make_zero/struct 0.319 ± 0.017 μs 0.261 ± 0.0076 μs 1.22 ± 0.075
basics/overhead 4.95 ± 0.01 ns 4.34 ± 0.01 ns 1.14 ± 0.0035
basics/remake_zero!/namedtuple 0.269 ± 0.022 μs 0.229 ± 0.013 μs 1.18 ± 0.12
basics/remake_zero!/struct 0.276 ± 0.027 μs 0.224 ± 0.016 μs 1.23 ± 0.15
fold_broadcast/multidim_sum_bcast/1D 10.3 ± 0.43 μs 10.2 ± 0.26 μs 1 ± 0.049
fold_broadcast/multidim_sum_bcast/2D 12.1 ± 0.34 μs 12.1 ± 0.34 μs 1 ± 0.04
time_to_load 1.61 ± 0.028 s 1.57 ± 0.023 s 1.02 ± 0.023

Benchmark Plots

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

@wsmoses wsmoses merged commit 54a794d into main Jul 8, 2026
75 of 89 checks passed
@wsmoses wsmoses deleted the gf branch July 8, 2026 20:07
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.

SciML-free idx_jl_getfield_aug calling-convention mismatch in reverse mode

1 participant