Skip to content

10x performance regression on v1.11 #57028

@mhauru

Description

@mhauru
module MWE

using Turing
using Turing: DynamicPPL
using Random

Random.seed!(42)

num_iterations = 10_000
adbackend = AutoForwardDiff()

@model function m(x=1.5)
    s ~ InverseGamma(2, 3)
    m ~ Normal(0, sqrt(s))
    x ~ Normal(m, s)
    return nothing
end

model = m()
initial_params = [0.5, 0.5]

component_sampler = HMC(0.1, 32; adtype=adbackend)
sampler = Turing.Gibbs(@varname(s) => component_sampler, @varname(m) => component_sampler)

@info "Starting sampling"
sample(model, sampler, num_iterations; initial_params=initial_params)

end

The above code runs in about 4s on v1.10.6 and in about 30s on v1.11.2 (recording second runs, so excluding compilation time). This is using the latest master from Turing.jl.

I would need to minimise the example to find the cause, but does anyone have clues as to where to look? A type inference failure seems like a possibility to me, any known regressions there on v1.11?

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceMust go fasterregressionRegression in behavior compared to a previous versionregression 1.11Regression in the 1.11 releasetypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions