Skip to content

calling convention error with hvp + type params #3067

@penelopeysm

Description

@penelopeysm

mwe

using Enzyme: hvp

struct MyDist{T}
    μ::T
end
struct MyOtherDist{T}
    μ::T
end
f(::MyDist, x) = x
f(::MyOtherDist, x) = x

dist = MyDist([0.0])
function g(x)
    y = f(dist, x)
    return y[1] + dist.μ[1]
end
g([0.0])
hvp(g, [0.0], [-1.0])

#= 
ERROR: LoadError: LLVM error: broken gc calling conv fix
DestTy too big for Trunc
  %131 = trunc i1 %.sroa.48.0.i.i to i8, !dbg !112
=#

env

The above error is on Julia 1.11.

On Julia 1.12 it complains saying that it needs runtime activity enabled, although I think that looks like the same issue as #2854.

(jl) pkg> st
Status `~/jl/Project.toml`
  [7da242da] Enzyme v0.13.140

julia> versioninfo()
Julia Version 1.11.9
Commit 53a02c0720c (2026-02-06 00:27 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

full error dump + stack trace

Julia 1.11: https://gist.github.com/penelopeysm/9779a40dec1d854ac3911eff1c050696#file-1p11-txt

Julia 1.12: https://gist.github.com/penelopeysm/9779a40dec1d854ac3911eff1c050696#file-1p12-txt

minimised from...

rsenne/ParallelMCMC.jl#25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions