activation_kernels.cl build failed on Intel HD Graphics
chenxy1988 opened this issue · 7 comments
Hi,
Sorry to trouble you, recently I am learning opencl related knowledge and using your project as an example. My laptop is a legacy dell which has a Intel onchip GPU and a ATI HD 7730M external GPU (too old :p) . the OS using ubuntu 20.04.
Since AMD no longer support HD7730M in newer Linux, so I using Intel onchip GPU to study the opencl.
I compiled the project and try to run an example in following command:
./bindarknet detector test ./cfg/coco.data ./cfg/yolov3.cfg ./yolov3.weights data/dog.jpg -i 0 -thresh 0.25
But when compiling the cl code, it reported an error message as below:
Device IDs: 1
Device ID: 0
Device name: Intel(R) HD Graphics IvyBridge M GT2
Device vendor: Intel
Device opencl availability: OpenCL 1.2 beignet 1.3
Device opencl used: 1.3
Device double precision: YES
Device max group size: 512
Device address bits: 32
ASSERTION FAILED: Double precision not supported on this device (if this is a literal, use '1.0f' not '1.0')
at file ./backend/src/backend/gen_insn_selection.cpp, function void gbe::ConvertInstructionPattern::convertBetweenFloatDouble(gbe::Selection::Opaque&, const gbe::ir::ConvertInstruction&, bool&) const, line 6227
Seems current GPU not support double float, I added an option "-cl-single-precision-constant " in src/opencl.c opencl_load_buffer() -> clBuildProgram , the diff as below:
diff --git a/src/opencl.c b/src/opencl.c
index 07c6550..9b36c35 100644
--- a/src/opencl.c
+++ b/src/opencl.c
@@ -255,6 +255,7 @@ void opencl_load_buffer(const char *buffer, const size_t size, cl_program *outpu
//"-cl-fp32-correctly-rounded-divide-sqrt "
"-cl-no-signed-zeros "
"-cl-mad-enable "
+ "-cl-single-precision-constant "
//"-cl-fast-relaxed-math "
, NULL, NULL);
#endif
re-compile and try again, error msg became as below:
evice address bits: 32
FATAL ERROR: CL_UNKNOWN_ERROR
opencl_load: could not compile. error: CL_UNKNOWN_ERROR
code:
In file included from :1:
/usr/lib/x86_64-linux-gnu/beignet//include/ocl.h:124:9: error: 'cl_intel_subgroups' macro redefined
:356:9: note: previous definition is here
In file included from :1:
/usr/lib/x86_64-linux-gnu/beignet//include/ocl.h:125:9: error: 'cl_intel_subgroups_short' macro redefined
:357:9: note: previous definition is here
I am no idea now, could you help to check whether my laptop environment can use the opencl with Intel GPU or not?
Many thanks ;)
Alternative information:
display information by lshw:
*-display
description: VGA compatible controller
product: Chelsea LP [Radeon HD 7730M]
vendor: Advanced Micro Devices, Inc. [AMD/ATI]
physical id: 0
bus info: pci@0000:01:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
configuration: driver=radeon latency=0
resources: irq:29 memory:a0000000-afffffff memory:c0000000-c003ffff ioport:3000(size=256) memory:c0040000-c005ffff
*-display
description: VGA compatible controller
product: 3rd Gen Core processor Graphics Controller
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 09
width: 64 bits
clock: 33MHz
capabilities: msi pm vga_controller bus_master cap_list
configuration: driver=i915 latency=0
resources: irq:28 memory:c1000000-c13fffff memory:b0000000-bfffffff ioport:4000(size=64) memory:c0000-dffff
display information by clinfo:
chenxy@chenxy-inspiron7520:/local$ clinfo
Number of platforms 1
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
Platform Extensions function suffix Intel
Platform Name Intel Gen OCL Driver
Number of devices 1
Device Name Intel(R) HD Graphics IvyBridge M GT2
Device Vendor Intel
Device Vendor ID 0x8086
Device Version OpenCL 1.2 beignet 1.3
Driver Version 1.3
Device OpenCL C Version OpenCL C 1.2 beignet 1.3
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 16
Max clock frequency 1000MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None, None, None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 512x512x512
Max work group size 512
Preferred work group size multiple (kernel) 16
Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (n/a)
float 4 / 4
double 0 / 2 (n/a)
Half-precision Floating-point support (n/a)
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 2147483648 (2GiB)
Error Correction support No
Max memory allocation 1610612736 (1.5GiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 8192 (8KiB)
Global Memory cache line size 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 pixels
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
Local memory type Local
Local memory size 65536 (64KiB)
Max number of constant args 8
Max constant buffer size 134217728 (128MiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
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;block_motion_estimate_intel;
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_intel_motion_estimation
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]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
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 IvyBridge M 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 IvyBridge M GT2
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.14
ICD loader Profile OpenCL 3.0
Thanks
I read the former issues which were closed in this project. I saw an issue related Intel GPU and should set NVIDIA=0 and GPU_MULTI=0 in Makefile.
I will try this tonight when I back home and keep post the testing result.
By the way, May I trun on "list (APPEND DARKNET_DEFINITIONS GPU CL_TARGET_OPENCL_VERSION=$MY_ACTUAL_OPENCL_VERSION" in CMakeLists.txt ? The warning message always output during compiling as below:
cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
Thanks ;p
Update:
I tried GPU_MULTI=0 NVIDIA=0 in make file, result the same as before.
I found some cules to root cause:
- I should not install beignet-ocl package due to my laptop don't have that hardware.
- After removing beignet, clinfo show me no platform, but I have already installed intel-ocl packages.
- The darknet-opencl also reponse me that no platform.
- I used strace to track clinfo, found that it will accord to /etc/OpenCL/vendor/intel.* to find available devices in /dev/dri/pci-*/ folder.
- But, the important things that my laptop has 2 graphi card, default 0 is ATI radeon 7xxxM, not match the /dev/OpenCL/vendor rule, so clinfo ( it called cl API ) return with error.
I will try to remove ATI radeon driver, use Intel as default graphi card and try it later.
close this ticket ;)
I read your paper "Darknet on OpenCL:a multi-platform tool for object detection and classification".
So cool :)
I will port the code to ARM A53 based CPU with MALI G31 GPU, if successed, i will share a performance test to you. Might be next year due to learn openCL happens in my part time and "touching fish" time during working.