Skip to content

Commit 00cd317

Browse files
Merge pull request #1089 from SciML/fastpow
Deprecate DiffEqBase.fastpow for FastPower.fastpower
2 parents df8ad4e + f867b2a commit 00cd317

11 files changed

+6
-126
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
1212
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
1313
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
1414
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
15+
FastPower = "a4df4552-cc26-4903-aec0-212e50a0e84b"
1516
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1617
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
1718
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
@@ -75,6 +76,7 @@ Enzyme = "0.13"
7576
EnzymeCore = "0.7, 0.8"
7677
FastBroadcast = "0.3"
7778
FastClosures = "0.3.2"
79+
FastPower = "1.1"
7880
ForwardDiff = "0.10"
7981
FunctionWrappers = "1.0"
8082
FunctionWrappersWrappers = "0.1"

ext/DiffEqBaseEnzymeExt.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module DiffEqBaseEnzymeExt
22

33
using DiffEqBase
4-
import DiffEqBase: value, fastpow
4+
import DiffEqBase: value
55
using Enzyme
66
import Enzyme: Const
77
using ChainRulesCore
@@ -53,6 +53,4 @@ function Enzyme.EnzymeRules.reverse(config::Enzyme.EnzymeRules.RevConfigWidth{1}
5353
return ntuple(_ -> nothing, Val(length(args) + 4))
5454
end
5555

56-
Enzyme.Compiler.known_ops[typeof(DiffEqBase.fastpow)] = (:pow, 2, nothing)
57-
5856
end

ext/DiffEqBaseMeasurementsExt.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ DiffEqBase.promote_u0(u0, p::AbstractArray{<:Measurements.Measurement}, t0) = el
1919
value(x::Type{Measurements.Measurement{T}}) where {T} = T
2020
value(x::Measurements.Measurement) = Measurements.value(x)
2121

22-
@inline DiffEqBase.fastpow(x::Measurements.Measurement, y::Measurements.Measurement) = x^y
23-
2422
# Support adaptive steps should be errorless
2523
@inline function DiffEqBase.ODE_DEFAULT_NORM(
2624
u::AbstractArray{

ext/DiffEqBaseMonteCarloMeasurementsExt.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ end
2727
DiffEqBase.value(x::Type{MonteCarloMeasurements.AbstractParticles{T, N}}) where {T, N} = T
2828
DiffEqBase.value(x::MonteCarloMeasurements.AbstractParticles) = mean(x.particles)
2929

30-
@inline function DiffEqBase.fastpow(x::MonteCarloMeasurements.AbstractParticles,
31-
y::MonteCarloMeasurements.AbstractParticles)
32-
x^y
33-
end
34-
3530
# Support adaptive steps should be errorless
3631
@inline function DiffEqBase.ODE_DEFAULT_NORM(
3732
u::AbstractArray{

ext/DiffEqBaseTrackerExt.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ end
3131
DiffEqBase.promote_u0(u0, p::Tracker.TrackedArray, t0) = Tracker.track(u0)
3232
DiffEqBase.promote_u0(u0, p::AbstractArray{<:Tracker.TrackedReal}, t0) = eltype(p).(u0)
3333

34-
@inline DiffEqBase.fastpow(x::Tracker.TrackedReal, y::Tracker.TrackedReal) = x^y
3534
@inline Base.any(f::Function, x::Tracker.TrackedArray) = any(f, Tracker.data(x))
3635

3736
# Support adaptive with non-tracked time

src/DiffEqBase.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ end
66

77
import PrecompileTools
88

9+
import FastPower
10+
@deprecate fastpow(x,y) FastPower.fastpower(x,y)
11+
912
using ArrayInterface
1013

1114
using StaticArraysCore # data arrays
@@ -126,7 +129,6 @@ abstract type DECostFunction end
126129
import SciMLBase: Void, unwrapped_f
127130

128131
include("utils.jl")
129-
include("fastpow.jl")
130132
include("stats.jl")
131133
include("calculate_residuals.jl")
132134
include("tableaus.jl")

src/fastpow.jl

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/forwarddiff.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,6 @@ end
446446
value(x::Type{ForwardDiff.Dual{T, V, N}}) where {T, V, N} = V
447447
value(x::ForwardDiff.Dual) = value(ForwardDiff.value(x))
448448

449-
@inline fastpow(x::ForwardDiff.Dual, y::ForwardDiff.Dual) = x^y
450-
451449
sse(x::Number) = abs2(x)
452450
sse(x::ForwardDiff.Dual) = sse(ForwardDiff.value(x)) + sum(sse, ForwardDiff.partials(x))
453451
totallength(x::Number) = 1

test/downstream/enzyme.jl

Lines changed: 0 additions & 25 deletions
This file was deleted.

test/fastpow.jl

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)