Skip to content

Commit

Permalink
Make stdlib extensions backwards compatible (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored Aug 22, 2024
1 parent 9b86c00 commit 91ada95
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Atomix = "a9b6321e-bd34-4604-b9c9-b65b8de01458"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
UnsafeAtomics = "013be700-e6cd-48c3-b4a1-df204f14c38f"
Expand Down
6 changes: 1 addition & 5 deletions ext/LinearAlgebraExt.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
module LinearAlgebraExt

using KernelAbstractions: KernelAbstractions
if isdefined(Base, :get_extension)
using LinearAlgebra: Tridiagonal, Diagonal
else
using ..LinearAlgebra: Tridiagonal, Diagonal
end
using LinearAlgebra: Tridiagonal, Diagonal

KernelAbstractions.get_backend(A::Diagonal) = KernelAbstractions.get_backend(A.diag)
KernelAbstractions.get_backend(A::Tridiagonal) = KernelAbstractions.get_backend(A.d)
Expand Down
6 changes: 1 addition & 5 deletions ext/SparseArraysExt.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
module SparseArraysExt

using KernelAbstractions: KernelAbstractions
if isdefined(Base, :get_extension)
using SparseArrays: AbstractSparseArray, rowvals
else
using ..SparseArrays: AbstractSparseArray, rowvals
end
using SparseArrays: AbstractSparseArray, rowvals

function KernelAbstractions.get_backend(A::AbstractSparseArray)
return KernelAbstractions.get_backend(rowvals(A))
Expand Down
5 changes: 5 additions & 0 deletions src/KernelAbstractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -769,4 +769,9 @@ end
end
end

if !isdefined(Base, :get_extension)
include("../ext/LinearAlgebraExt.jl")
include("../ext/SparseArraysExt.jl")
end

end #module

2 comments on commit 91ada95

@vchuravy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/113647

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.24 -m "<description of version>" 91ada95c10c2b3852839fec162cb64eea74fe3f6
git push origin v0.9.24

Please sign in to comment.