cogciprocate / ocl

OpenCL for Rust
Other
730 stars 75 forks source link

CL_INVALID_DEVICE on OSX #68

Closed ghost closed 7 years ago

ghost commented 7 years ago

This is from commit 015d995efdbfc, on a MacBook Air from last year. I imagine it's related to the fact that the device_check example locks up on the GPU check?

cargo run --example info
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
    Running `target/debug/examples/info`
Looping through avaliable platforms (1):
Platform { Profile: FULL_PROFILE, Version: OpenCL 1.2 (Nov  1 2016 21:34:57), Name: Apple, Vendor: Apple, Extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event } { Total Device Count: 2 }
Device (terse) { Name: Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz, Vendor: Intel }
Device (terse) { Name: Intel(R) Iris(TM) Graphics 6100, Vendor: Intel Inc. }
Context { ReferenceCount: 8, Devices: [DeviceId(0x1024500), DeviceId(0xffffffff)], Properties: ContextProperties({Platform: Platform(PlatformId(0x7fff0000))}), NumDevices: 2 }
Queue { Context: Context(0x7fcaa04038f0), Device: DeviceId(0xffffffff), ReferenceCount: 6, Properties: QUEUE_PROFILING_ENABLE }
Buffer Mem { Type: Buffer, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: no mem info available, MapCount: 0, ReferenceCount: 2, Context: Context(0x7fcaa04038f0), AssociatedMemobject: None, Offset: 0 }
Image { ElementSize: 4, RowPitch: 8192, SlicePitch: 0, Width: 2048, Height: 0, Depth: 0, ArraySize: 0, Buffer: None, NumMipLevels: 0, NumSamples: 0 } Mem { Type: Image1d, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: no mem info available, MapCount: 0, ReferenceCount: 1, Context: Context(0x7fcaa04038f0), AssociatedMemobject: None, Offset: 0 }
Sampler { ReferenceCount: 1, Context: Context(0x7fcaa04038f0), NormalizedCoords: false, AddressingMode: None, FilterMode: Nearest }
Program (terse) { KernelNames: 'multiply', NumDevices: 2, ReferenceCount: 2, Context: Context(0x7fcaa04038f0) }
Kernel { FunctionName: multiply, ReferenceCount: 1, Context: Context(0x7fcaa04038f0), Program: Program(0x7fcaa0700960), Attributes:  } WorkGroup { WorkGroupSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, CompileWorkGroupSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, LocalMemSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, PreferredWorkGroupSizeMultiple:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, PrivateMemSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
 }WorkGroup { WorkGroupSize: 128, CompileWorkGroupSize: [0, 0, 0], LocalMemSize: 0, PreferredWorkGroupSizeMultiple: 1, PrivateMemSize: 0 }
EventList { inner: Array(EventArray { array: [Event(Event(0x7fcaa0403e10)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0))], len: 1 }) }
Event { CommandQueue: CommandQueue(0x7fcaa0700400), CommandType: WriteBuffer, ReferenceCount: 1, CommandExecutionStatus: Complete, Context: Context(0x7fcaa04038f0) }
ghost commented 7 years ago

Just so you know, this is a low priority for me as I'll be getting away from OSX and Apple hardware ASAP.

c0gent commented 7 years ago

I'll be getting away from OSX and Apple hardware ASAP

That would be wise but a more elegant solution is probably needed here.

c0gent commented 7 years ago

https://github.com/cogciprocate/ocl-core/commit/27d52b7c2bd100da18b0a50b0d7d482f443d5ce3 now wraps this error case in a special variant. Please do a cargo update then copy/print the output results of cargo run --example info here when you get a chance.

ghost commented 7 years ago

Here's the output:

ocl [master] » cargo run --example info                                                                                                                                                              ~/m/ocl
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/examples/info`
Looping through avaliable platforms (1):
Platform { Profile: FULL_PROFILE, Version: OpenCL 1.2 (Nov  1 2016 21:34:57), Name: Apple, Vendor: Apple, Extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event } { Total Device Count: 2 }
Device (terse) { Name: Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz, Vendor: Intel }
Device (terse) { Name: Intel(R) Iris(TM) Graphics 6100, Vendor: Intel Inc. }
Context { ReferenceCount: 8, Devices: [DeviceId(0x1024500), DeviceId(0xffffffff)], Properties: ContextProperties({Platform: Platform(PlatformId(0x7fff0000))}), NumDevices: 2 }
Queue { Context: Context(0x7ff2eb603fd0), Device: DeviceId(0xffffffff), ReferenceCount: 6, Properties: QUEUE_PROFILING_ENABLE }
Buffer Mem { Type: Buffer, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: mem info unavailable, MapCount: 0, ReferenceCount: 2, Context: Context(0x7ff2eb603fd0), AssociatedMemobject: None, Offset: 0 }
Image { ElementSize: 4, RowPitch: 8192, SlicePitch: 0, Width: 2048, Height: 0, Depth: 0, ArraySize: 0, Buffer: None, NumMipLevels: 0, NumSamples: 0 } Mem { Type: Image1d, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: mem info unavailable, MapCount: 0, ReferenceCount: 1, Context: Context(0x7ff2eb603fd0), AssociatedMemobject: None, Offset: 0 }
Sampler { ReferenceCount: 1, Context: Context(0x7ff2eb603fd0), NormalizedCoords: false, AddressingMode: None, FilterMode: Nearest }
Program (terse) { KernelNames: 'multiply', NumDevices: 2, ReferenceCount: 2, Context: Context(0x7ff2eb603fd0) }
Kernel { FunctionName: multiply, ReferenceCount: 1, Context: Context(0x7ff2eb603fd0), Program: Program(0x7ff2eb604990), Attributes:  } WorkGroup { WorkGroupSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, CompileWorkGroupSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, LocalMemSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, PreferredWorkGroupSizeMultiple:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
, PrivateMemSize:

################################ OPENCL ERROR ###############################

Error executing function: clGetKernelWorkGroupInfo

Status error code: CL_INVALID_DEVICE (-33)

Please visit the following url for more information:

https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html#errors

#############################################################################
 }WorkGroup { WorkGroupSize: 128, CompileWorkGroupSize: [0, 0, 0], LocalMemSize: 0, PreferredWorkGroupSizeMultiple: 1, PrivateMemSize: 0 }
EventList { inner: Array(EventArray { array: [Event(Event(0x7ff2eb40d620)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0))], len: 1 }) }
Event { CommandQueue: CommandQueue(0x7ff2eb503aa0), CommandType: WriteBuffer, ReferenceCount: 1, CommandExecutionStatus: Complete, Context: Context(0x7ff2eb603fd0) }

I checked after updating the dependencies, and ocl-core was at 0.4.1. Is that right?

c0gent commented 7 years ago

My bad, I should have asked you to git clone/pull the master branch of this repo first (then do a cargo update). That should give you the latest changes to ocl-core directly from its repo. Double check the Cargo.toml to ensure that:

[replace]
...
"ocl-core:0.4.1" = { git = "https://github.com/cogciprocate/ocl-core" }

is near the bottom.

ghost commented 7 years ago

I think that's what I've got:

ocl [master] » cat Cargo.toml | grep "ocl-core"
opencl_version_1_1 = ["ocl-core/opencl_version_1_1"]
opencl_version_1_2 = ["ocl-core/opencl_version_1_2"]
opencl_version_2_0 = ["ocl-core/opencl_version_2_0"]
opencl_version_2_1 = ["ocl-core/opencl_version_2_1"]
ocl-core = "0.4"
# ocl-core = { version = "0.4", git = "https://github.com/cogciprocate/ocl-core" }
# ocl-core = { version = "0.4", path = "../ocl-core" }
"ocl-core:0.4.1" = { git = "https://github.com/cogciprocate/ocl-core" }
c0gent commented 7 years ago

Ok I must have missed something...

c0gent commented 7 years ago

Found my mistake. Sorry about that. Try again when you can (cargo update should be all you need to do).

ghost commented 7 years ago

Looks good!

Looping through avaliable platforms (1):
Platform { Profile: FULL_PROFILE, Version: OpenCL 1.2 (Nov  1 2016 21:34:57), Name: Apple, Vendor: Apple, Extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event } { Total Device Count: 2 }
Device (terse) { Name: Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz, Vendor: Intel }
Device (terse) { Name: Intel(R) Iris(TM) Graphics 6100, Vendor: Intel Inc. }
Context { ReferenceCount: 8, Devices: [DeviceId(0x1024500), DeviceId(0xffffffff)], Properties: ContextProperties({Platform: Platform(PlatformId(0x7fff0000))}), NumDevices: 2 }
Queue { Context: Context(0x7fd48ac16090), Device: DeviceId(0xffffffff), ReferenceCount: 6, Properties: QUEUE_PROFILING_ENABLE }
Buffer Mem { Type: Buffer, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: mem info unavailable, MapCount: 0, ReferenceCount: 2, Context: Context(0x7fd48ac16090), AssociatedMemobject: None, Offset: 0 }
Image { ElementSize: 4, RowPitch: 8192, SlicePitch: 0, Width: 2048, Height: 0, Depth: 0, ArraySize: 0, Buffer: None, NumMipLevels: 0, NumSamples: 0 } Mem { Type: Image1d, Flags: MEM_READ_WRITE, Size: 8192, HostPtr: mem info unavailable, MapCount: 0, ReferenceCount: 1, Context: Context(0x7fd48ac16090), AssociatedMemobject: None, Offset: 0 }
Sampler { ReferenceCount: 1, Context: Context(0x7fd48ac16090), NormalizedCoords: false, AddressingMode: None, FilterMode: Nearest }
Program (terse) { KernelNames: 'multiply', NumDevices: 2, ReferenceCount: 2, Context: Context(0x7fd48ac16090) }
Kernel { FunctionName: multiply, ReferenceCount: 1, Context: Context(0x7fd48ac16090), Program: Program(0x7fd48ac16a50), Attributes:  } WorkGroup { WorkGroupSize: unavailable (CL_INVALID_DEVICE), CompileWorkGroupSize: unavailable (CL_INVALID_DEVICE), LocalMemSize: unavailable (CL_INVALID_DEVICE), PreferredWorkGroupSizeMultiple: unavailable (CL_INVALID_DEVICE), PrivateMemSize: unavailable (CL_INVALID_DEVICE) }WorkGroup { WorkGroupSize: 128, CompileWorkGroupSize: [0, 0, 0], LocalMemSize: 0, PreferredWorkGroupSizeMultiple: 1, PrivateMemSize: 0 }
EventList { inner: Array(EventArray { array: [Event(Event(0x7fd48ac17b80)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0)), Event(Event(0x0))], len: 1 }) }
Event { CommandQueue: CommandQueue(0x7fd48ac16600), CommandType: WriteBuffer, ReferenceCount: 1, CommandExecutionStatus: Complete, Context: Context(0x7fd48ac16090) }
c0gent commented 7 years ago

Great. Thanks for your help :)