Skip to content

Commit

Permalink
Use at-consistent_overlay for 1.11 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Sep 16, 2024
1 parent 123977e commit 1144588
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/device/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ end

macro device_override(ex)
ex = macroexpand(__module__, ex)
esc(quote
Base.Experimental.@overlay(CUDA.method_table, $ex)
end)
if VERSION >= v"1.12.0-DEV.745" || v"1.11-rc1" <= VERSION < v"1.12-"
# XXX: this requires that the overlay method f′ is consistent with f, i.e.,
# - if f(x) returns a value, f′(x) must return the identical value.
# - if f(x) throws an exception, f′(x) must also throw an exception
# (although the exceptions do not need to be identical).
esc(quote
Base.Experimental.@consistent_overlay(CUDA.method_table, $ex)
end)
else
esc(quote
Base.Experimental.@overlay(CUDA.method_table, $ex)
end)
end
end

macro device_function(ex)
Expand Down

0 comments on commit 1144588

Please sign in to comment.