Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing 2-argument method for bitcast! #1674

Closed
MilesCranmer opened this issue Jul 24, 2024 · 5 comments
Closed

Missing 2-argument method for bitcast! #1674

MilesCranmer opened this issue Jul 24, 2024 · 5 comments

Comments

@MilesCranmer
Copy link
Contributor

I think this line:

tape = bitcast!(builder, LLVM.PointerType(llty, LLVM.addrspace(value_type(tape))))

calls a method that does not exist? We are running into an error for it here: SymbolicML/DynamicExpressions.jl#91 (comment)

Test enzyme derivatives: Error During Test at /home/runner/.julia/packages/SafeTestsets/raUNr/src/SafeTestsets.jl:30
  Got exception outside of a @test
  LoadError: MethodError: no method matching bitcast!(::LLVM.IRBuilder, ::LLVM.PointerType)
  
  Closest candidates are:
    bitcast!(::LLVM.IRBuilder, ::LLVM.Value, ::LLVM.LLVMType, ::String)
     @ LLVM ~/.julia/packages/LLVM/5DlHM/src/irbuilder.jl:343
    bitcast!(::LLVM.IRBuilder, ::LLVM.Value, ::LLVM.LLVMType)
     @ LLVM ~/.julia/packages/LLVM/5DlHM/src/irbuilder.jl:343
  
  Stacktrace:
    [1] #28366
      @ ~/.julia/packages/Enzyme/aEyGD/src/compiler.jl:6622 [inlined]
    [2] JuliaContext(f::Enzyme.Compiler.var"#28366#28371"{Bool, DataType, DataType, DataType, Int64, DataType, Int64, Bool, DataType, DataType}; kwargs::@Kwargs{})
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Y4hSX/src/driver.jl:52
    [3] JuliaContext(f::Function)
      @ GPUCompiler ~/.julia/packages/GPUCompiler/Y4hSX/src/driver.jl:42
    [4] #s2028#28365
      @ ~/.julia/packages/Enzyme/aEyGD/src/compiler.jl:6276 [inlined]
    [5] var"#s2028#28365"(RawCall::Any, PT::Any, FA::Any, T::Any, RT::Any, TapeType::Any, N::Any, CC::Any, width::Any, returnPrimal::Any, ::Any, ::Type, fptr::Any, ::Type, ::Type, ::Type, tt::Any, rt::Any, fn::Any, ::Any, args::Any)
      @ Enzyme.Compiler ./none:0
    [6] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
      @ Core ./boot.jl:602
@wsmoses
Copy link
Member

wsmoses commented Jul 26, 2024

@MilesCranmer can you see if this fixes it: #1679

@MilesCranmer
Copy link
Contributor Author

It looks like there just isn't a 2-argument bitcast! method in LLVM.jl though, unless I am mistaken?

julia> using LLVM

julia> LLVM.bitcast! |> methods
# 2 methods for generic function "bitcast!" from LLVM:
 [1] bitcast!(builder::IRBuilder, Val::Value, DestTy::LLVMType, Name::String)
     @ ~/.julia/packages/LLVM/5DlHM/src/irbuilder.jl:343
 [2] bitcast!(builder::IRBuilder, Val::Value, DestTy::LLVMType)
     @ ~/.julia/packages/LLVM/5DlHM/src/irbuilder.jl:343

@wsmoses
Copy link
Member

wsmoses commented Jul 26, 2024

whoops sorry put arg in the wrong place, retry?

@MilesCranmer
Copy link
Contributor Author

Thanks, that fixed the original issue. Now I get a segfault, though presumably it's from something different? https://github.com/SymbolicML/DynamicExpressions.jl/actions/runs/10117201276/job/27981679660?pr=91#step:6:523. Will

@wsmoses
Copy link
Member

wsmoses commented Jul 26, 2024

Seemingly different -- but having an absolute MWE of that would be immensely useful to fix

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

No branches or pull requests

2 participants