-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: Ops.throw
#835
base: main
Are you sure you want to change the base?
feat: Ops.throw
#835
Conversation
though I am not super sure if we should do this by default. There are a lot of usecases for having the runtime error functionality separately but with this all errors will be embedded into mlir by default |
julia> fn(x) = begin
Reactant.Ops.throw("dimension mismatch")
return x .+ 1
end
fn (generic function with 1 method)
julia> @jit fn(Reactant.to_rarray(rand(2)))
ERROR: INTERNAL: dimension mismatch
Stacktrace:
[1] reactant_err(msg::Cstring)
@ Reactant.XLA ~/reactant/Reactant.jl/src/xla/Utils.jl:12
[2] macro expansion
@ ~/reactant/Reactant.jl/src/xla/PJRT/LoadedExecutable.jl:175 [inlined]
[3] execute_sharded
@ ~/reactant/Reactant.jl/src/xla/PJRT/LoadedExecutable.jl:144 [inlined]
[4] macro expansion
@ ~/reactant/Reactant.jl/src/Compiler.jl:1435 [inlined]
[5] (::Reactant.Compiler.Thunk{typeof(fn), Symbol("##fn_reactant#280"), Tuple{ConcretePJRTArray{…}}, false})(args::ConcretePJRTArray{Float64, 1, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}})
@ Reactant.Compiler ~/reactant/Reactant.jl/src/Compiler.jl:1690
[6] top-level scope
@ ~/reactant/Reactant.jl/src/Compiler.jl:1036
Some type information was truncated. Use `show(err)` to see complete types. |
@noinline function throw( | ||
msg::String, | ||
condition::Union{TracedRNumber{Bool},Nothing}=nothing; | ||
location=mlir_stacktrace("throw", @__FILE__, @__LINE__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
location=mlir_stacktrace("throw", @__FILE__, @__LINE__) | |
location=mlir_stacktrace("throw", @__FILE__, @__LINE__), |
need to fix cuda before merging this |
Still need to register the FFI on the cpp end. Is that the best way to do this or do we have a way of registering function calls on julia end?