Skip to content

Commit 7344ad8

Browse files
vchuravymaleadt
andauthored
Use stacked method tables (#325)
Co-authored-by: Tim Besard <tim.besard@gmail.com>
1 parent d1637ce commit 7344ad8

File tree

7 files changed

+10
-6
lines changed

7 files changed

+10
-6
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2222
[compat]
2323
Adapt = "4"
2424
GPUArrays = "11.2.1"
25-
GPUCompiler = "1.2"
25+
GPUCompiler = "1.6"
2626
KernelAbstractions = "0.9.2"
2727
LLVM = "9.1"
2828
LinearAlgebra = "1"
@@ -31,7 +31,7 @@ Preferences = "1"
3131
Printf = "1"
3232
Random = "1"
3333
Reexport = "1"
34-
SPIRVIntrinsics = "0.3"
34+
SPIRVIntrinsics = "0.4"
3535
SPIRV_LLVM_Backend_jll = "20"
3636
SPIRV_Tools_jll = "2025.1"
3737
StaticArrays = "1"

lib/intrinsics/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SPIRVIntrinsics"
22
uuid = "71d1d633-e7e8-4a92-83a1-de8814b09ba8"
33
authors = ["Tim Besard <tim.besard@gmail.com>"]
4-
version = "0.3.0"
4+
version = "0.4.0"
55

66
[deps]
77
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"

lib/intrinsics/src/SPIRVIntrinsics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ macro import_all()
3232
# bring all the names of this module in scope
3333
name in (:SPIRVIntrinsics, :eval, :include) && continue
3434
startswith(string(name), "#") && continue
35+
string(name) == "method_table" && continue
36+
# XXX: use `export` or `@public` to denote names to re-export
3537
push!(code.args, :(using .SPIRVIntrinsics: $name))
3638
end
3739

lib/intrinsics/src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Base.Experimental.@MethodTable(method_table)
8585

8686
macro device_override(ex)
8787
esc(quote
88-
Base.Experimental.@overlay($method_table, $ex)
88+
Base.Experimental.@overlay(method_table, $ex)
8989
end)
9090
end
9191

src/OpenCL.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export cl
2020
import SPIRVIntrinsics
2121
SPIRVIntrinsics.@import_all
2222
SPIRVIntrinsics.@reexport_public
23+
Base.Experimental.@MethodTable(method_table)
2324
include("device/runtime.jl")
2425
include("device/array.jl")
2526
include("device/quirks.jl")

src/OpenCLKernels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module OpenCLKernels
22

33
using ..OpenCL
4-
using ..OpenCL: @device_override, SPIRVIntrinsics
4+
using ..OpenCL: @device_override, SPIRVIntrinsics, method_table
55

66
import KernelAbstractions as KA
77

src/compiler/compilation.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const OpenCLCompilerJob = CompilerJob{SPIRVCompilerTarget,OpenCLCompilerParams}
66

77
GPUCompiler.runtime_module(::CompilerJob{<:Any,OpenCLCompilerParams}) = OpenCL
88

9-
GPUCompiler.method_table(::OpenCLCompilerJob) = method_table
9+
GPUCompiler.method_table_view(job::OpenCLCompilerJob) =
10+
GPUCompiler.StackedMethodTable(job.world, method_table, SPIRVIntrinsics.method_table)
1011

1112
# filter out OpenCL built-ins
1213
# TODO: eagerly lower these using the translator API

0 commit comments

Comments
 (0)