Skip to content

Fixed Expr issue when the ci is a type of GlobalRef #545

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

miniskar
Copy link
Contributor

Error handling if the ci is of type GlobalRef, from which the Expr can be constructed. It also have error handling if the Ci is a different type.

@chriselrod
Copy link
Member

Mind adding a test that fails without this change but passes with it?

@miniskar
Copy link
Contributor Author

It requires Llama2 to be installed. https://github.com/cafaxo/Llama2.jl
Julia version info:

julia> versioninfo()
Julia Version 1.13.0-DEV.298 (Nightly build)
Commit 8b146907373 (2025-03-25 15:26 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 128 × AMD EPYC 7513 32-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-19.1.7 (ORCJIT, znver3)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 128 virtual cores)

Here is the test.
File: stories.jl

using Llama2
download("https://huggingface.co/karpathy/tinyllamas/resolve/main/stories42M.bin", "stories42M.bin")
download("https://raw.githubusercontent.com/karpathy/llama2.c/b4bb47bb7baf0a5fb98a131d80b4e1a84ad72597/tokenizer.bin", "tokenizer.bin")
model = load_karpathy_model("stories42M.bin", "tokenizer.bin");
sample(model, "Tim was happy."; temperature = 0.8f0)

It gives below error.

$ julia stories.jl
Precompiling SpecialFunctionsExt finished.
  1 dependency successfully precompiled in 2 seconds. 136 already precompiled.
ERROR: LoadError: TypeError: in typeassert, expected Expr, got a value of type GlobalRef
Stacktrace:
  [1] substitute_broadcast(q::Expr, mod::Symbol, inline::Bool, u₁::Int8, u₂::Int8, v::Int8, threads::Int64, warncheckarg::Int64, safe::Bool)
    @ LoopVectorization ~/.julia/packages/LoopVectorization/tIJUA/src/constructors.jl:70
  [2] turbo_macro(::Module, ::LineNumberNode, ::Expr)
    @ LoopVectorization ~/.julia/packages/LoopVectorization/tIJUA/src/constructors.jl:295
  [3] var"@turbo"(__source__::LineNumberNode, __module__::Module, args::Vararg{Any})
    @ LoopVectorization ~/.julia/packages/LoopVectorization/tIJUA/src/constructors.jl:404
  [4] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:304
  [5] top-level scope
    @ /noback/Llama2.jl/src/Llama2.jl:31
  [6] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:304
  [7] top-level scope
    @ /noback/Llama2.jl/stories.jl:1
  [8] include(mod::Module, _path::String)
    @ Base ./Base.jl:303
  [9] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:328
 [10] _start()
    @ Base ./client.jl:560

@chriselrod chriselrod merged commit 76a9f9f into JuliaSIMD:main Mar 27, 2025
59 of 75 checks passed
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.

2 participants