Bug report #21428

Enabling acceleration crashes QGIS

Added by Roberto Uhlig about 5 years ago. Updated about 5 years ago.

Status:Open
Priority:High
Assignee:Alessandro Pasotti
Category:OpenCL
Affected QGIS version:3.7(master) Regression?:No
Operating System:Win7 64bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:29245

Description

User Feedback

Just enable Acceleration by hitting the check box in the Options | Acceleration Crashes QGIS ;-(.
It's done in an new empty project, fresh startet with a new createt profile.

Report Details

Crash ID: dbe41a9b097feaf8e87a78ad6d3a1eadcf3b9b10

Stack Trace

cl::detail::ReferenceHandler<_cl_device_id * __ptr64>::retain cl2.hpp:1477
cl::detail::Wrapper<_cl_device_id * __ptr64>::retain cl2.hpp:1843
cl::detail::Wrapper<_cl_device_id * __ptr64>::Wrapper<_cl_device_id * __ptr64> cl2.hpp:1770
cl::Device::Device cl2.hpp:2003
cl::detail::getInfoHelper<cl::detail::GetInfoFunctor0<int (__cdecl*)(_cl_context * __ptr64,unsigned int,unsigned __int64,void * __ptr64,unsigned __int64 * __ptr64),_cl_context * __ptr64>,cl::Device> cl2.hpp:1014
cl::detail::getInfo<int (__cdecl*)(_cl_context * __ptr64,unsigned int,unsigned __int64,void * __ptr64,unsigned __int64 * __ptr64),_cl_context * __ptr64,std::vector<cl::Device,std::allocator<cl::Device> > > cl2.hpp:1445
cl::Context::getInfo<std::vector<cl::Device,std::allocator<cl::Device> > > cl2.hpp:2868
cl::Context::getInfo<4225> cl2.hpp:2880
cl::Device::makeDefault cl2.hpp:2955
std::_Invoker_functor::_Call<void (__cdecl&)(void)> type_traits:1377
std::invoke<void (__cdecl&)(void)> type_traits:1445
std::_Invoke_stored_explicit<void (__cdecl&)(void),std::exception_ptr & __ptr64,0> mutex:471
std::_Callback_once<std::tuple<void (__cdecl&)(void),std::exception_ptr & __ptr64>,std::integer_sequence<unsigned __int64,0>,1> mutex:497
RtlRunOnceExecuteOnce :
InitOnceExecuteOnce :
_crtInitOnceExecuteOnce :
std::call_once<void (__cdecl&)(void)> mutex:519
cl::Device::getDefault cl2.hpp:2013
QgsOpenClUtils::activeDevice qgsopenclutils.cpp:174
QgsOpenClUtils::activate qgsopenclutils.cpp:212
<lambda_9ec297d20451569f5bb8b1f6372c225b>::operator() qgsopenclutils.cpp:86
std::_Invoker_functor::_Call<<lambda_9ec297d20451569f5bb8b1f6372c225b> > type_traits:1377
std::invoke<<lambda_9ec297d20451569f5bb8b1f6372c225b> > type_traits:1445
std::_Invoke_stored_explicit<<lambda_9ec297d20451569f5bb8b1f6372c225b> && __ptr64,std::exception_ptr & __ptr64,0> mutex:471
std::_Callback_once<std::tuple<<lambda_9ec297d20451569f5bb8b1f6372c225b> && __ptr64,std::exception_ptr & __ptr64>,std::integer_sequence<unsigned __int64,0>,1> mutex:497
RtlRunOnceExecuteOnce :
InitOnceExecuteOnce :
_crtInitOnceExecuteOnce :
std::call_once<<lambda_9ec297d20451569f5bb8b1f6372c225b> > mutex:519
QgsOpenClUtils::init qgsopenclutils.cpp:96
QgsOpenClUtils::available qgsopenclutils.cpp:368
<lambda_922094a53c4278625000fd604db93b4a>::operator() qgsoptions.cpp:1104
QtPrivate::FunctorCall<QtPrivate::IndexesList<0>,QtPrivate::List<bool>,void,<lambda_922094a53c4278625000fd604db93b4a> >::call qobjectdefs_impl.h:128
QtPrivate::Functor<<lambda_922094a53c4278625000fd604db93b4a>,1>::call<QtPrivate::List<bool>,void> qobjectdefs_impl.h:239
QtPrivate::QFunctorSlotObject<<lambda_922094a53c4278625000fd604db93b4a>,1,QtPrivate::List<bool>,void>::impl qobjectdefs_impl.h:427
QMetaObject::activate :
QAbstractButton::clicked :
QAbstractButton::setChecked :
QCheckBox::nextCheckState :
QAbstractButton::click :
QAbstractButton::mouseReleaseEvent :
QWidget::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:366
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:366
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
TranslateMessageEx :
TranslateMessage :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QDialog::exec :
QgisApp::showOptionsDialog qgisapp.cpp:10726
QgisApp::options qgisapp.cpp:10591
QtPrivate::FunctorCall<QtPrivate::IndexesList<>,QtPrivate::List<>,void,void (__cdecl QgisApp::*)(void) __ptr64>::call qobjectdefs_impl.h:134
QtPrivate::FunctionPointer<void (__cdecl QgisApp::*)(void) __ptr64>::call<QtPrivate::List<>,void> qobjectdefs_impl.h:168
QtPrivate::QSlotObject<void (__cdecl QgisApp::*)(void) __ptr64,QtPrivate::List<>,void>::impl qobjectdefs_impl.h:397
QMetaObject::activate :
QAction::activate :
QMenu::actionGeometry :
QMenu::actionGeometry :
QMenu::mouseReleaseEvent :
QWidget::event :
QMenu::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:366
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:366
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
TranslateMessageEx :
TranslateMessage :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main main.cpp:1524
WinMain mainwin.cpp:170
__scrt_common_main_seh exe_common.inl:253
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info
QGIS Version: 3.7.0-Master
QGIS code revision: 36ca201671
Compiled against Qt: 5.11.2
Running against Qt: 5.11.2
Compiled against GDAL: 2.4.0
Running against GDAL: 2.4.0

System Info
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 6.1.7601

DxDiag.txt Magnifier (42.2 KB) Roberto Uhlig, 2019-02-28 04:24 PM

qgis3.5.0-25_4d5edb2380_dbgview.LOG Magnifier (68 KB) Roberto Uhlig, 2019-03-01 12:30 PM

qgis3.7.0-04_34a0650177_dbgview.LOG Magnifier (65.8 KB) Roberto Uhlig, 2019-03-01 12:30 PM

reload20190305_qgis3.5.0-25_4d5edb2380_dbgview.LOG Magnifier - the one uploaded on 20190301 is wrong! Please delete! (67.6 KB) Roberto Uhlig, 2019-03-05 11:58 AM

History

#1 Updated by Alessandro Pasotti about 5 years ago

  • Status changed from Open to Feedback
  • Assignee set to Alessandro Pasotti

Do you have any opencl device on your system ?

#2 Updated by Roberto Uhlig about 5 years ago

Yes
I have a NVIDIA Quadro FX 1800 graphic adapter and
I have installed Intel SDK for OpenCL - CPU only runtime package for Intel Core and Intel Xeon Processors on 18.10.2018 in times of 3.3master?

At this time i could check openCL Accelleration with no problems and select what I wanted.

Some short facts from dxdiag (report attached)
System Information
------------------
Time of this report: 2/28/2019, 16:19:51
Machine name:
Operating System: Windows 7 Enterprise 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_ldr_escrow.190208-1418)
Language: German (Regional Setting: German)
System Manufacturer: Dell Inc.
System Model: Precision WorkStation T5500
BIOS: Phoenix ROM BIOS PLUS Version 1.10 A03
Processor: Intel(R) Xeon(R) CPU E5530 @ 2.40GHz (8 CPUs), ~2.4GHz
Memory: 12288MB RAM
Available OS Memory: 12286MB RAM
Page File: 6629MB used, 17940MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 11
DX Setup Parameters: Not found
User DPI Setting: Using System DPI
System DPI Setting: 96 DPI (100 percent)
DWM DPI Scaling: Disabled
DxDiag Version: 6.01.7601.17514 64bit Unicode

#3 Updated by Alessandro Pasotti about 5 years ago

So, you cannot reproduce it anymore?

I'm not a windows developer and I'm afraid cannot help much here, but if you could run QGIS through a debugger and check exactly what happens where it crashes it could be helpful.

Btw, I suspect that there will always be random crashes on some platforms with some video card drivers, according to reports on Google there are many broken opencl implementation out there.

Of course I could have made some mistakes on QGIS openclutils.cpp code too.

#4 Updated by Roberto Uhlig about 5 years ago

The non crash setup is gon.
I testet it after your conversation with andreas on Sep 04 2018.
http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-Some-initial-OpenCL-feedback-td5376786.html#a5376819

He has also tested with windows.
Is his setup runing openCL today?

how to debug?
I'm not a developer.

Meanwhile I will look at drivers.

#5 Updated by Roberto Uhlig about 5 years ago

Found qgis-dev-3.3.0-94.tar.bz2 osgeo4w package.

Extractet, gave modified env-file (only redirectet qgis-dev variables all other points to current osgeo, qt ...), testet.

All fine there.

QGIS version
3.3.0-Master
QGIS code revision
94a7d9db66
Compiled against Qt
5.9.2
Running against Qt
5.11.2
Compiled against GDAL/OGR
2.2.4
Running against GDAL/OGR
2.2.4
Compiled against GEOS
3.6.1-CAPI-1.10.1
Running against GEOS
3.7.0-CAPI-1.11.0 673b9939
PostgreSQL Client Version
9.2.4
SpatiaLite Version
4.3.0
QWT Version
6.1.3
QScintilla2 Version
2.10.1
PROJ.4 Version
493
This copy of QGIS writes debugging output.

There are other junger packages I will give a try.

Different is, that on going to options accelerated, I see my accelerators direct. on 3.7master ther ist nothing shown.

#6 Updated by Roberto Uhlig about 5 years ago

I'm afraid it comes since your commit on 11 Dec 2018 to fix #20363
https://github.com/qgis/QGIS/commit/2d63f24e31665d528500cf19502b9fc3c405e11f

Last version I can run with openCL is with osgeo4W-package qgis-dev-3.5.0-25 (Code Version 4d5edb2380 Latest commit 0e76099 on 26 Nov 2018).

ALL (testet) Versions junger than that crashes here.
I testet
qgis-dev-3.5.0-30 (9b9881d3da) and qgis-dev-3.5.0-30 (bc98f8667c) with crash when opening options dialog, so I can't tell something about openCL.
qgis-dev-3.5.0-44 (7c0b68a990), yesterday qgis-dev-3.7.0-03 (36ca201671) which I reported here and today qgis-dev-3.7.0-04 (34a0650177) which all crash on click on check box mGPUEnableCheckBox.

I watched with dbgview from windows/sysinternals.
The crash seems to occure before or by QgsOpenClUtils::available.

In case of crash, there is no debugmassage from QgsOpenClUtils.
With the working qgis-dev-3.5.0-25 there are debugmassages from QgsOpenClUtils.

Problem comes if the value of OpenClEnabled is true or should set to true.

On the gui it crashes on empty box to enable or
as i observed just now if it comes from the *.ini with true.
In that case it crashes already on opening options.

[core]
OpenClDefaultDevice=Quadro FX 1800|NVIDIA Corporation|OpenCL 1.0 CUDA|GPU
OpenClEnabled=true
Layout\searchPathsForTemplates=@Invalid()

#7 Updated by Giovanni Manghi about 5 years ago

  • Category changed from Unknown to OpenCL
  • Status changed from Feedback to Open
  • Subject changed from enable Acceleration Crashes QGIS to Enabling acceleration crashes QGIS

#8 Updated by Roberto Uhlig about 5 years ago

Hi,
I think I have found a little hint.
Stack trace tell's last:
cl::detail::ReferenceHandler<_cl_device_id * __ptr64>::retain cl2.hpp:1477

I think for my old devices this is wrong.

Debugview shows in my last working setup:
0000355 29.26150322 [3104] ..\..\..\src\core\qgsopenclutils.cpp(206) : (QgsOpenClUtils::activate) [515ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
00000356 29.26601028 [3104] ..\..\..\src\core\qgsmessagelog.cpp(29) : (QgsMessageLog::logMessage) [15ms] 2019-03-05T08:35:49 OpenCL3 Active OpenCL device: Quadro FX 1800
00000357 29.26833534 [3104] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
00000358 29.26964760 [3104] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA

So it's openCL 1.1 and if I read and understand cl2.hpp correct, openCL 1.1 should never end up in cl2.hpp line 1477.
as commented there " ... OpenCL 1.1 devices do not have retain/release..."

Hope that helps a litte bit for correcting that old openCL Version crashes.

See also my correct reload20190305_qgis3.5.0-25_4d5edb2380_dbgview.LOG

#9 Updated by Roberto Uhlig about 5 years ago

An other observation:
osgeo4W-package qgis-dev-3.5.0-25 (Code Version 4d5edb2380 Latest commit 0e76099 on 26 Nov 2018) shows in Options | Acceleration:
Type: GPU
Name: Quadro FX 1800
Vendor: NVIDIA Corporation
Profile: FULL_PROFILE
Version: OpenCL 1.0 CUDA <-- lower than seen with dbgview?
Image support: True
Max image2d width: 4096
Max image2d height: 16383
Max mem alloc size: 201326592

Debugview shows in my last working setup:
0000355 29.26150322 [3104] ..\..\..\src\core\qgsopenclutils.cpp(206) : (QgsOpenClUtils::activate) [515ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA

#10 Updated by Roberto Uhlig about 5 years ago

Meanwhile (as you can see obove) I deinstaled and just now reinstalled the INTEL OpenCL

osgeo4W-package qgis-dev-3.5.0-25 (Code Version 4d5edb2380 Latest commit 0e76099 on 26 Nov 2018) shows in Options | Acceleration:
Type: CPU
Name: Intel(R) Xeon(R) CPU E5530 @ 2.40GHz
Vendor: Intel(R) Corporation
Profile: FULL_PROFILE
Version: OpenCL 1.2 (Build 37)
Image support: True
Max image2d width: 16384
Max image2d height: 16384
Max mem alloc size: 3220591616

Debugview shows now:
[972] ..\..\..\src\core\qgsopenclutils.cpp(206) : (QgsOpenClUtils::activate) [203ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
[972] ..\..\..\src\core\qgsmessagelog.cpp(29) : (QgsMessageLog::logMessage) [0ms] 2019-03-05T12:44:55 OpenCL1 No OpenCL 1.x device could be found.
[972] ..\..\..\src\core\qgsopenclutils.cpp(206) : (QgsOpenClUtils::activate) [0ms] Found OpenCL platform OpenCL 1.2 : Intel(R) OpenCL
[972] ..\..\..\src\core\qgsmessagelog.cpp(29) : (QgsMessageLog::logMessage) [0ms] 2019-03-05T12:44:55 OpenCL3 Active OpenCL device: Intel(R) Xeon(R) CPU E5530 @ 2.40GHz
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.2 : Intel(R) OpenCL
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.2 : Intel(R) OpenCL
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.1 CUDA 6.0.1: NVIDIA CUDA
[972] ..\..\..\src\core\qgsopenclutils.cpp(43) : (QgsOpenClUtils::devices) [0ms] Found OpenCL platform OpenCL 1.2 : Intel(R) OpenCL

#11 Updated by Roberto Uhlig about 5 years ago

Is/should it possible/alowed by the user to set/change?

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_HPP_MINIMUM_OPENCL_VERSION xxx
#define CL_HPP_TARGET_OPENCL_VERSION xxx
#define CL_TARGET_OPENCL_VERSION xxx

dependig on knowledge of the own OpenCL-Device(s)

#12 Updated by Giovanni Manghi about 5 years ago

  • Priority changed from Normal to High

#13 Updated by Roberto Uhlig about 5 years ago

THX for higher Prio :-)

I think it only affect's OpenCL < 1.2 (only 1.0 and 1.1) because on a different computer it all runs fine with CPU and GPU devices both on platform OpenCL 1.2.

look also at where I think the old NVIDIA's are all < 1.2 like mine here:
http://osgeo-org.1560.x6.nabble.com/OpenCL-Crash-td5391528.html#a5391536
http://osgeo-org.1560.x6.nabble.com/OpenCL-acceleration-on-Windows-10-and-Nvidia-td5394797.html
http://osgeo-org.1560.x6.nabble.com/OpenCL-on-Windows-X-64-and-RTX2060-td5396868.html

and

#20363

May be you like to change the title

#14 Updated by Giovanni Manghi about 5 years ago

Roberto Uhlig wrote:

THX for higher Prio :-)

anything that crashes qgis is "high".

#15 Updated by Roberto Uhlig about 5 years ago

Windows users can easy check their adapter capabilities with
*G*PU-Z from [[https://www.techpowerup.com/download/techpowerup-gpu-z/]]

Which delivers if available various information for Driver, Bios, ASIC, DirextX, OpenCL, CUDA ...

for instance for openCL:
General
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Profile FULL_PROFILE
Platform Version OpenCL 1.1 CUDA 6.0.1
Vendor NVIDIA Corporation
Device Name Quadro FX 1800
Version OpenCL 1.0 CUDA
Driver Version 332.76
C Version OpenCL C 1.0
Profile FULL_PROFILE
Global Memory Size 768 MB
Clock Frequency 1375 MHz
Compute Units 8
Device Available Yes
Compiler Available Yes
CMD Queue Properties Out of Order, Profiling
SVM Capabilities None
DP Capability None
SP Capability INF NAN, Round Nearest, Round Zero, Round INF, FMA
Half FP Capability None
Address Bits 32
Global Memory Cache 0 KB (No Cache)
Global Memory Cacheline 0 KB
Local Memory Local (16 KB)
Memory Alignment 2048 bits
Little Endian Yes
Error Correction No
Execution Capability Kernel
Unified Memory No
Image Support Yes

Limits
Max Memory Allocation 192 MB
Max Constant Buffer 64 KB
Max Constant Args 9
Max Read Image Args 128
Max Write Image Args 8
Max Samplers 16
Max Work Item Dims 3
Max Write Image Args 8

Native Vectors
Native Vector Width (CHAR) 1
Native Vector Width (SHORT) 1
Native Vector Width (INT) 1
Native Vector Width (LONG) 1
Native Vector Width (FLOAT) 1
Native Vector Width (DOUBLE) N/A
Native Vector Width (HALF) N/A
Preferred Vector Width (CHAR) 1
Preferred Vector Width (SHORT) 1
Preferred Vector Width (INT) 1
Preferred Vector Width (LONG) 1
Preferred Vector Width (FLOAT) 1
Preferred Vector Width (DOUBLE) N/A
Preferred Vector Width (HALF) N/A

Extensions
cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_d3d9_sharing cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics

Also available in: Atom PDF