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

Throw descriptive AsssertionError instead of @show + @assert inside of create_abi_wrapper #1262

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

devmotion
Copy link
Contributor

I just ran into

(actualRetType, literal_rt, rettype) = (actualRetType, literal_rt, rettype) = (actualRetType, literal_rt, rettype) = Gradient - enzyme: Error During Test at REPL[5]:1
  Got exception outside of a @test
  task switch not allowed from inside staged nor pure functions
  Stacktrace:
    [1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
      @ Base ./task.jl:910
    [2] wait()
      @ Base ./task.jl:984
    [3] uv_write(s::Base.TTY, p::Ptr{UInt8}, n::UInt64)
      @ Base ./stream.jl:1048
    [4] unsafe_write(s::Base.TTY, p::Ptr{UInt8}, n::UInt64)
      @ Base ./stream.jl:1120
    [5] write
      @ ./strings/io.jl:244 [inlined]
    [6] print
      @ ./strings/io.jl:246 [inlined]
    [7] print(::Base.TTY, ::String, ::String, ::Vararg{String})
      @ Base ./strings/io.jl:46
    [8] println(::Base.TTY, ::String, ::Vararg{String})
      @ Base ./strings/io.jl:75
    [9] println(::String, ::String)
      @ Base ./coreio.jl:4
   [10] create_abi_wrapper(enzymefn::LLVM.Function, TT::Type, rettype::Type, actualRetType::Type, Mode::Enzyme.API.CDerivativeMode, augmented::Nothing, width::Int64, returnPrimal::Bool, shadow_init::Bool, world::UInt64, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/KJgKj/src/compiler.jl:3255
...

Based on the stacktrace I assume that the problem is the use of @show instead of @safe_show (as a few lines below) in the create_abi_wrapper function.

By the way, is there any typical problem (or error on my side) when hitting this branch?

src/compiler.jl Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (ba58bcb) 75.13% compared to head (22edb01) 75.14%.

Files Patch % Lines
src/compiler.jl 0.00% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1262   +/-   ##
=======================================
  Coverage   75.13%   75.14%           
=======================================
  Files          35       35           
  Lines       10397    10393    -4     
=======================================
- Hits         7812     7810    -2     
+ Misses       2585     2583    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@devmotion devmotion changed the title Use @safe_show inside of create_abi_wrapper Throw descriptive AsssertionError instead of @show + @assert inside of create_abi_wrapper Jan 31, 2024
@devmotion
Copy link
Contributor Author

Are the test errors on Ubuntu related to this PR? At least I didn't see them on the main branch.

@wsmoses wsmoses merged commit a511e4e into EnzymeAD:main Feb 1, 2024
39 of 43 checks passed
@devmotion devmotion deleted the patch-1 branch February 1, 2024 08:27
@devmotion
Copy link
Contributor Author

By the way, is there any typical problem (or error on my side) when hitting this branch?

@wsmoses just wondering if there's some experience/knowledge you can share regarding these allocatedinline checks?

@wsmoses
Copy link
Member

wsmoses commented Feb 1, 2024 via email

@devmotion
Copy link
Contributor Author

And if the assertion fails, is it usually an issue with my code or in Enzyme?

@wsmoses
Copy link
Member

wsmoses commented Feb 1, 2024 via email

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.

3 participants