3b / cl-opencl-3b

unfinished Common Lisp (cffi) OpenCL bindings
MIT License
19 stars 3 forks source link

crash of particles example on mouse click #2

Open ormf opened 6 years ago

ormf commented 6 years ago

calling make-particle-system in the particle-gl example crashes the lisp system.

(particles) opens the gl window and it is responsive to keystrokes, but clicking in the window crashes the lisp process. It seems, the call to (create-from-gl-buffer context :read-write vbo) is the culprit. The vbo is generated with (gl:gen-buffers 1) and the context exists and seems valid.

3b commented 6 years ago

what OS/device/drivers?

It looks like the code doesn't actually make sure the extension is present before trying to use it, just prints it out. is there some output in repl/console/*inferior-lisp* like "using ... GL context sharing extension available: ..."? if so what does that say?

ormf commented 6 years ago

what OS/device/drivers?

OS is arch linux, sbcl 1.4.0 device (probably): GPU Intel(R) HD Graphics Skylake ULT GT2 driver: it looks like beignet (see below) I also tried to install the intel drivers from their sdk, but don't know whether this was done properly.

Here the output of (particles) in the repl:

using "Intel" / "Intel Gen OCL Driver", version "OpenCL 2.0 beignet 1.3" GL context sharing extension available: T device id = #.(SB-SYS:INT-SAP #X7FFFE5AC5EA0) ((:GPU)) built program: :SUCCESS, log = "" reshape 640 480

Here below is the output of clinfo (sorry for the long post...):

[orm@T460s-orm ~]$ clinfo Number of platforms 2 Platform Name Intel Gen OCL Driver Platform Vendor Intel Platform Version OpenCL 2.0 beignet 1.3 Platform Profile FULL_PROFILE Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing Platform Extensions function suffix Intel

Platform Name Intel(R) OpenCL Platform Vendor Intel(R) Corporation Platform Version OpenCL 2.0 LINUX Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer Platform Extensions function suffix INTEL

Platform Name Intel Gen OCL Driver Number of devices 1 Device Name Intel(R) HD Graphics Skylake ULT GT2 Device Vendor Intel Device Vendor ID 0x8086 Device Version OpenCL 2.0 beignet 1.3 Driver Version 1.3 Device OpenCL C Version OpenCL C 2.0 beignet 1.3 Device Type GPU Device Available Yes Device Profile FULL_PROFILE Max compute units 24 Max clock frequency 1000MHz Device Partition (core) Max number of sub-devices 1 Supported partition types None, None, None Max work item dimensions 3 Max work item sizes 512x512x512 Max work group size 512 Compiler Available Yes Linker Available Yes Preferred work group size multiple 16 Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (cl_khr_fp16) float 4 / 4
double 0 / 2 (n/a) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Correctly-rounded divide and sqrt operations No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Correctly-rounded divide and sqrt operations No Double-precision Floating-point support (n/a) Address bits 32, Little-Endian Global memory size 4294967296 (4GiB) Error Correction support No Max memory allocation 3221225472 (3GiB) Unified memory for Host and Device Yes Shared Virtual Memory (SVM) capabilities (core) Coarse-grained buffer sharing Yes Fine-grained buffer sharing No Fine-grained system sharing No Atomics No Minimum alignment for any data type 128 bytes Alignment of base address 1024 bits (128 bytes) Preferred alignment for atomics
SVM 0 bytes Global 0 bytes Local 0 bytes Max size for global variable 65536 (64KiB) Preferred total size of global vars 65536 (64KiB) Global Memory cache type Read/Write Global Memory cache size 8192 (8KiB) Global Memory cache line 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 65536 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 4096 bytes Pitch alignment for 2D image buffers 1 bytes Max 2D image size 8192x8192 pixels Max 3D image size 8192x8192x2048 pixels Max number of read image args 128 Max number of write image args 8 Max number of read/write image args 8 Max number of pipe args 16 Max active pipe reservations 1 Max pipe packet size 1024 Local memory type Local Local memory size 65536 (64KiB) Max constant buffer size 134217728 (128MiB) Max number of constant args 8 Max size of kernel argument 1024 Queue properties (on host)
Out-of-order execution No Profiling Yes Queue properties (on device)
Out-of-order execution Yes Profiling Yes Preferred size 16384 (16KiB) Max size 262144 (256KiB) Max queues on device 1 Max events on device 1024 Prefer user sync for interop Yes Profiling timer resolution 80ns Execution capabilities
Run OpenCL kernels Yes Run native kernels Yes SPIR versions 1.2 printf() buffer size 1048576 (1024KiB) Built-in kernels cl_copy_region_align4;__cl_copy_region_align16;cl_cpy_region_unalign_same_offset;cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;cl_copy_buffer_rect;cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;cl_copy_image_3d_to_2d;cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;cl_copy_image_2d_to_buffer;cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;cl_copy_buffer_to_image_3d;cl_fill_region_unalign;__cl_fill_region_align2;cl_fill_region_align4;cl_fill_region_align8_2;cl_fill_region_align8_4;cl_fill_region_align8_8;cl_fill_region_align8_16;cl_fill_region_align128;__cl_fill_image_1d;cl_fill_image_1d_array;__cl_fill_image_2d;cl_fill_image_2d_array;cl_fill_image_3d; Device Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing cl_khr_fp16

Platform Name Intel(R) OpenCL Number of devices 1 Device Name Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz Device Vendor Intel(R) Corporation Device Vendor ID 0x8086 Device Version OpenCL 2.0 (Build 25) Driver Version 1.2.0.25 Device OpenCL C Version OpenCL C 2.0 Device Type CPU Device Available Yes Device Profile FULL_PROFILE Max compute units 4 Max clock frequency 2600MHz Device Partition (core) Max number of sub-devices 4 Supported partition types by counts, equally, by names (Intel) Max work item dimensions 3 Max work item sizes 8192x8192x8192 Max work group size 8192 Compiler Available Yes Linker Available Yes Preferred work group size multiple 128 Preferred / native vector sizes
char 1 / 32
short 1 / 16
int 1 / 8
long 1 / 4
half 0 / 0 (n/a) float 1 / 8
double 1 / 4 (cl_khr_fp64) Half-precision Floating-point support (n/a) Single-precision Floating-point support (core) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Correctly-rounded divide and sqrt operations No Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations No Address bits 64, Little-Endian Global memory size 20446146560 (19.04GiB) Error Correction support No Max memory allocation 5111536640 (4.76GiB) Unified memory for Host and Device Yes Shared Virtual Memory (SVM) capabilities (core) Coarse-grained buffer sharing Yes Fine-grained buffer sharing Yes Fine-grained system sharing Yes Atomics Yes Minimum alignment for any data type 128 bytes Alignment of base address 1024 bits (128 bytes) Preferred alignment for atomics
SVM 64 bytes Global 64 bytes Local 0 bytes Max size for global variable 65536 (64KiB) Preferred total size of global vars 65536 (64KiB) Global Memory cache type Read/Write Global Memory cache size 262144 (256KiB) Global Memory cache line 64 bytes Image support Yes Max number of samplers per kernel 480 Max size for 1D images from buffer 319471040 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 64 bytes Pitch alignment for 2D image buffers 64 bytes Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 480 Max number of write image args 480 Max number of read/write image args 480 Max number of pipe args 16 Max active pipe reservations 65535 Max pipe packet size 1024 Local memory type Global Local memory size 32768 (32KiB) Max constant buffer size 131072 (128KiB) Max number of constant args 480 Max size of kernel argument 3840 (3.75KiB) Queue properties (on host)
Out-of-order execution Yes Profiling Yes Local thread execution (Intel) Yes Queue properties (on device)
Out-of-order execution Yes Profiling Yes Preferred size 4294967295 (4GiB) Max size 4294967295 (4GiB) Max queues on device 4294967295 Max events on device 4294967295 Prefer user sync for interop No Profiling timer resolution 1ns Execution capabilities
Run OpenCL kernels Yes Run native kernels Yes SPIR versions 1.2 printf() buffer size 1048576 (1024KiB) Built-in kernels
Device Extensions cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer

NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel Gen OCL Driver clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [Intel] clCreateContext(NULL, ...) [default] Success [Intel] clCreateContext(NULL, ...) [other] Success [INTEL] clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1) Platform Name Intel Gen OCL Driver Device Name Intel(R) HD Graphics Skylake ULT GT2 clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1) Platform Name Intel Gen OCL Driver Device Name Intel(R) HD Graphics Skylake ULT GT2

ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.11 ICD loader Profile OpenCL 2.1 [orm@T460s-orm ~]$

ormf commented 6 years ago

It looks like the code doesn't actually make sure the extension is present before trying to use it, just prints it out.

As the extension is listed: Is it necessary/possible to initialize the extension somehow? How can I make sure it is present? I couldn't find anything in the specs about that. (car (gl:gen-buffers 1)) returns integers (10 digit 32bit ints), so I would assume the bufpointers are actually created.