Skip to content

Commit 4f12f01

Browse files
committed
Adapt to GPUCompiler#master.
1 parent ac1bc29 commit 4f12f01

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

Manifest.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.8.5"
44
manifest_format = "2.0"
5-
project_hash = "e8fd324aba09b72a771344d3910c4e1284ae62a0"
5+
project_hash = "c38f3e404ea342fb740cb16012407cbac90360fd"
66

77
[[deps.AbstractFFTs]]
88
deps = ["ChainRulesCore", "LinearAlgebra", "Test"]
@@ -170,9 +170,11 @@ version = "0.1.5"
170170

171171
[[deps.GPUCompiler]]
172172
deps = ["ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Scratch", "TimerOutputs", "UUIDs"]
173-
git-tree-sha1 = "8de395b1243771bbb79ac832ec96c7def7a4586f"
173+
git-tree-sha1 = "2bec2c336b65f1ca50c4fcb2933712503db8eb2d"
174+
repo-rev = "master"
175+
repo-url = "https://github.com/JuliaGPU/GPUCompiler.jl.git"
174176
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
175-
version = "0.22.0"
177+
version = "0.23.0"
176178

177179
[[deps.InlineStrings]]
178180
deps = ["Parsers"]

Project.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ RandomNumbers = "e6cf234a-135c-5ec9-84dd-332b85af5143"
3131
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
3232
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
3333
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
34-
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
3534
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3635
UnsafeAtomicsLLVM = "d80eeb9a-aca5-4d75-85e5-170c8b632249"
3736

37+
[weakdeps]
38+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
39+
40+
[extensions]
41+
SpecialFunctionsExt = "SpecialFunctions"
42+
3843
[compat]
3944
AbstractFFTs = "0.4, 0.5, 1.0"
4045
Adapt = "3.3"
@@ -47,7 +52,7 @@ Crayons = "4"
4752
DataFrames = "1"
4853
ExprTools = "0.1"
4954
GPUArrays = "8.6"
50-
GPUCompiler = "0.22"
55+
GPUCompiler = "0.23"
5156
KernelAbstractions = "0.9.2"
5257
LLVM = "6"
5358
NVTX = "0.3.2"
@@ -60,3 +65,6 @@ Requires = "0.5, 1.0"
6065
SpecialFunctions = "1.3, 2"
6166
UnsafeAtomicsLLVM = "0.1"
6267
julia = "1.8"
68+
69+
[extras]
70+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"

src/device/intrinsics/special_math.jl renamed to ext/SpecialFunctionsExt.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# math functionality corresponding to SpecialFunctions.jl
22

3+
module SpecialFunctionsExt
4+
5+
using CUDA
6+
using CUDA: @device_override
7+
8+
isdefined(Base, :get_extension) ? (using SpecialFunctions) : (using ..SpecialFunctions)
9+
310

411
## error
512

@@ -46,3 +53,6 @@
4653

4754
@device_override SpecialFunctions.bessely(n::Int32, x::Float64) = ccall("extern __nv_yn", llvmcall, Cdouble, (Int32, Cdouble), n, x)
4855
@device_override SpecialFunctions.bessely(n::Int32, x::Float32) = ccall("extern __nv_ynf", llvmcall, Cfloat, (Int32, Cfloat), n, x)
56+
57+
58+
end

src/CUDAKernels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ macro device_override(ex)
157157
error()
158158
end
159159
code = quote
160-
$GPUCompiler.@override($CUDA.method_table, $ex)
160+
Base.Experimental.@overlay($CUDA.method_table, $ex)
161161
end
162162
if isdefined(Base.Experimental, Symbol("@overlay"))
163163
return esc(code)

src/device/utils.jl

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,11 @@ else
1313
const method_table = nothing
1414
end
1515

16-
# list of overrides (only for Julia 1.6)
17-
const overrides = Expr[]
18-
1916
macro device_override(ex)
2017
ex = macroexpand(__module__, ex)
21-
if Meta.isexpr(ex, :call)
22-
@show ex = eval(ex)
23-
error()
24-
end
25-
code = quote
26-
$GPUCompiler.@override(CUDA.method_table, $ex)
27-
end
28-
if isdefined(Base.Experimental, Symbol("@overlay"))
29-
return esc(code)
30-
else
31-
push!(overrides, code)
32-
return
33-
end
18+
esc(quote
19+
Base.Experimental.@overlay(CUDA.method_table, $ex)
20+
end)
3421
end
3522

3623
macro device_function(ex)

src/initialization.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,9 @@ function __init__()
147147
return
148148
end
149149

150-
# register device overrides
151-
if !precompiling
152-
eval(Expr(:block, overrides...))
153-
empty!(overrides)
154-
150+
@static if !isdefined(Base, :get_extension)
155151
@require SpecialFunctions="276daf66-3868-5448-9aa4-cd146d93841b" begin
156-
include("device/intrinsics/special_math.jl")
157-
eval(Expr(:block, overrides...))
158-
empty!(overrides)
152+
include("../ext/SpecialFunctionsExt.jl")
159153
end
160154
end
161155

0 commit comments

Comments
 (0)