Skip to content

Commit 5dbe8e0

Browse files
committed
reflection works
1 parent 7872106 commit 5dbe8e0

File tree

6 files changed

+420
-15
lines changed

6 files changed

+420
-15
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
1414
OpenCL_jll = "6cb37087-e8b6-5417-8430-1f242f1e46e4"
1515
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1616
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
17+
SPIRVIntrinsics = "71d1d633-e7e8-4a92-83a1-de8814b09ba8"
1718
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1819
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1920
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

src/pocl/compiler/compilation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function compile(@nospecialize(job::CompilerJob))
5959
GPUCompiler.compile(:obj, job)
6060
end
6161

62-
(obj, entry=LLVM.name(meta.entry))
62+
(;obj, entry=LLVM.name(meta.entry))
6363
end
6464

6565
# link into an executable kernel

src/pocl/compiler/execution.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ struct KernelAdaptor
8585
svm_pointers::Vector{Ptr{Cvoid}}
8686
end
8787

88-
# assume directly-passed pointers are SVM pointers
89-
function Adapt.adapt_storage(to::KernelAdaptor, ptr::Ptr{T}) where {T}
90-
push!(to.svm_pointers, ptr)
91-
return ptr
92-
end
93-
94-
# convert SVM buffers to their GPU address
95-
function Adapt.adapt_storage(to::KernelAdaptor, buf::cl.SVMBuffer)
96-
ptr = pointer(buf)
97-
push!(to.svm_pointers, ptr)
98-
return ptr
99-
end
88+
# # assume directly-passed pointers are SVM pointers
89+
# function Adapt.adapt_storage(to::KernelAdaptor, ptr::Ptr{T}) where {T}
90+
# push!(to.svm_pointers, ptr)
91+
# return ptr
92+
# end
93+
94+
# # convert SVM buffers to their GPU address
95+
# function Adapt.adapt_storage(to::KernelAdaptor, buf::cl.SVMBuffer)
96+
# ptr = pointer(buf)
97+
# push!(to.svm_pointers, ptr)
98+
# return ptr
99+
# end
100100

101101
# Base.RefValue isn't GPU compatible, so provide a compatible alternative
102102
# TODO: port improvements from CUDA.jl

src/pocl/compiler/reflection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ for method in (:code_typed, :code_warntype, :code_llvm, :code_native)
2828
kernel::Bool=false, kwargs...)
2929
compiler_kwargs, kwargs = split_kwargs_runtime(kwargs, COMPILER_KWARGS)
3030
source = methodinstance(typeof(func), Base.to_tuple_type(types))
31-
config = compiler_config(cl.device(); kernel, compiler_kwargs...)
31+
config = compiler_config(device(); kernel, compiler_kwargs...)
3232
job = CompilerJob(source, config)
3333
GPUCompiler.$method($(args...); kwargs...)
3434
end
@@ -60,7 +60,7 @@ export @device_code_lowered, @device_code_typed, @device_code_warntype, @device_
6060
#
6161

6262
"""
63-
Metal.return_type(f, tt) -> r::Type
63+
POCL.return_type(f, tt) -> r::Type
6464
6565
Return a type `r` such that `f(args...)::r` where `args::tt`.
6666
"""

0 commit comments

Comments
 (0)