Skip to content

prevent get_backend from overflowing the stack #602

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nsajko
Copy link

@nsajko nsajko commented Jun 2, 2025

Prevent the get_backend methods from overflowing the stack/recurring without bound.

Hoping this doesn't cause inference issues due to deeper call stacks.

Fixes #588

Copy link
Contributor

github-actions bot commented Jun 2, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

Prevent the `get_backend` methods from overflowing the stack/recurring
without bound.

Hoping this doesn't cause inference issues due to deeper call stacks.

Fixes JuliaGPU#588
@nsajko nsajko force-pushed the prevent_get_backend_from_overflowing_the_stack branch from 9148e33 to e86a332 Compare June 2, 2025 09:56
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (110d784) to head (e86a332).

Files with missing lines Patch % Lines
src/KernelAbstractions.jl 0.00% 7 Missing ⚠️
ext/LinearAlgebraExt.jl 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (110d784) and HEAD (e86a332). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (110d784) HEAD (e86a332)
12 10
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #602       +/-   ##
==========================================
- Coverage   47.52%   0.00%   -47.53%     
==========================================
  Files          22      21        -1     
  Lines        1715    1577      -138     
==========================================
- Hits          815       0      -815     
- Misses        900    1577      +677     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nsajko
Copy link
Author

nsajko commented Jun 2, 2025

This is how it looks now:

julia> using KernelAbstractions
Precompiling KernelAbstractions...
  37 dependencies successfully precompiled in 60 seconds. 29 already precompiled.

julia> struct UnknownAbstractVector <: AbstractVector{Float32} end

julia> get_backend(UnknownAbstractVector())
ERROR: ArgumentError: throwing to prevent a stack overflow, possibly a `get_backend` method is missing?
Stacktrace:
 [1] (::KernelAbstractions.var"#t#1")()
   @ KernelAbstractions ~/tmp/jl/KernelAbstractions.jl/src/KernelAbstractions.jl:514
 [2] get_backend_recur(f::typeof(parent), x::UnknownAbstractVector)
   @ KernelAbstractions ~/tmp/jl/KernelAbstractions.jl/src/KernelAbstractions.jl:517
 [3] get_backend(A::UnknownAbstractVector)
   @ KernelAbstractions ~/tmp/jl/KernelAbstractions.jl/src/KernelAbstractions.jl:523
 [4] top-level scope
   @ REPL[4]:1

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.

StackOverflowError on get_backend(::UnitRange)
1 participant