prevent get_backend from overflowing the stack - #602
Merged
vchuravy merged 4 commits intoJun 10, 2025
Merged
Conversation
Contributor
|
Your PR no longer requires formatting changes. Thank you for your contribution! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #602 +/- ##
==========================================
+ Coverage 47.52% 47.64% +0.12%
==========================================
Files 22 22
Lines 1715 1719 +4
==========================================
+ Hits 815 819 +4
Misses 900 900 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
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 |
vchuravy
reviewed
Jun 9, 2025
nsajko
commented
Jun 9, 2025
nsajko
commented
Jun 9, 2025
vchuravy
approved these changes
Jun 10, 2025
vchuravy
left a comment
Member
There was a problem hiding this comment.
Thanks!
I will backport this to the 0.9 branch
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
Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
vchuravy
added a commit
that referenced
this pull request
Jun 10, 2025
Co-authored-by: Valentin Churavy <v.churavy@gmail.com> (cherry picked from commit 474050e)
2 tasks
vchuravy
added a commit
that referenced
this pull request
Jun 10, 2025
Co-authored-by: Valentin Churavy <v.churavy@gmail.com> (cherry picked from commit 474050e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent the
get_backendmethods from overflowing the stack/recurring without bound.Hoping this doesn't cause inference issues due to deeper call stacks.
Fixes #588