Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional fixes for Julia 1.0 support as well as failures on OpenCL 1.1 #172

Merged
merged 1 commit into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/context.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ end
const io_lock = ReentrantLock()
function log_error(message...)
@async begin
lock(STDERR)
lock(stderr)
lock(io_lock)
print(STDERR, string(message..., "\n"))
print(stderr, string(message..., "\n"))
unlock(io_lock)
unlock(STDERR)
unlock(stderr)
end
end

Expand Down
8 changes: 5 additions & 3 deletions src/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,13 @@ function info(k::Kernel, kinfo::Symbol)
return Program(ret[], retain=true)
end

# Only supported for version 1.2 and above
attributes(k::Kernel) = begin
size = Ref{Csize_t}()
api.clGetKernelInfo(k.id, CL_KERNEL_ATTRIBUTES,
0, C_NULL, size)
if size[] <= 1
rcode = api.clGetKernelInfo(k.id, CL_KERNEL_ATTRIBUTES,
0, C_NULL, size)
# Version 1.1 mostly MESA drivers will pass through the below condition
if rcode == CL_INVALID_VALUE || size[] <= 1
return ""
end
result = Vector{CL_char}(undef, size[])
Expand Down
27 changes: 0 additions & 27 deletions src/platform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,6 @@ function info(p::Platform, pinfo::CL_platform_info)
return CLString(result)
end


let info_map = Dict{Symbol, CL_platform_info}(
vchuravy marked this conversation as resolved.
Show resolved Hide resolved
:profile => CL_PLATFORM_PROFILE,
:version => CL_PLATFORM_VERSION,
:name => CL_PLATFORM_NAME,
:vendor => CL_PLATFORM_VENDOR,
:extensions => CL_PLATFORM_EXTENSIONS
)
global info
function info(p::Platform, pinfo::Symbol)
try
cl_info = info_map[pinfo]
if pinfo == :extensions
split(info(p, cl_info))
else
info(p, cl_info)
end
catch err
if isa(err, KeyError)
throw(ArgumentError("OpenCL.Platform has no info for: $pinfo"))
else
throw(err)
end
end
end
end

function devices(p::Platform, dtype::CL_device_type)
try
ndevices = Ref{CL_uint}()
Expand Down
8 changes: 4 additions & 4 deletions src/program.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ function build!(p::Program; options = "", raise = true)
end
for (dev, status) in cl.info(p, :build_status)
if status == cl.CL_BUILD_ERROR
println(STDERR, "Couldn't compile kernel: ")
println(stderr, "Couldn't compile kernel: ")
source = info(p, :source)
print_with_linenumbers(source, " ", STDERR)
println(STDERR, "With following build error:")
println(STDERR, cl.info(p, :build_log)[dev])
print_with_linenumbers(source, " ", stderr)
println(stderr, "With following build error:")
println(stderr, cl.info(p, :build_log)[dev])
raise && @check err # throw the build error when raise!
end
end
Expand Down