Black image with Haze Removal + OpenCL

Are you able to disable the onboard graphics of the the AMD chip…Just to confirm that the two GPU are playing nice?? Also not sure about Win11 haven’t bumped up to it yet but I think there are places where you can allow the software and the os to have impact on the settings or you can set it to use the NVIDIA driver settings…its been a while since I messed with it…but you could have something going on in that arena as well…just some random thoughts… It does look like opencl is not happy with your 3060…seems like it can’t find how much memory is available …may be?? others would know more…maybe one of the opencl settings in your config file is weird or maybe the opencl kernels are corrupt…I am not sure if those are something you can delete and they will get regenerated?? Someone that actually knows about OPENCL will likely be able to surmise something from those log entries…hope you get it sorted

The compiled kernels are in the cache directory, and can be deleted; they are regenerated when you start darktable.
To find out available memory, under Linux one can use the tool nvdia-smi. I don’t know about Windows. However, under Linux at least, I think a failed memory allocation is detected properly, and OpenCL is turned off (and we see fall back to cpu implementation due to insufficient gpu memory above).
opencl_memory_headroom could be increased to avoid allocation errors.
Perhaps the device priorities could also be tweaked to exclude devices.

Repeat this with each device numbers. It seems there are two just driver based devices.
At least devices 2, 1 and 4 should be usable - 2 because 0 wasn’t useable :wink:
But that’s just an try an error approach

Update of actions I’ve done based on yall inputs:

  1. forced priority to use one device at a time, but it still tried to use the others.
  2. changes nvidia drivers from game ready to studio
  3. delete the kernels in the cache to regenerate them
  4. changed the memory headroom to 800 per OpenCL analysis... Darktable... much faster with Opencl disabled...something wrong?? - #22 by kofa
    and other settings from that thread
  5. checked performance with and without OpenCL

In summary, the only way to avoid the black image is by disabling the OpenCL or the Haze Removal. It seems that the Nvidia card is not being used in most modules with the opencl. The system switches to CPU, so there is not a big performance improvement. I sure would like the system to take advantage of the 12gb fast card.

The scheduling priorities are only taken into account if the scheduling profile is set to default (and not with very fast GPU or multiple GPUs (darktable 3.8 user manual - scheduling profile). But OK, I see that is what you have:

0.054656 [opencl_init] opencl_scheduling_profile: ‘default’
0.058359 [opencl_init] opencl_device_priority: ‘*/!0,*/*/*/!0,*’

Do you see the final priorities in the log?
Those should appear after the text [opencl_priorities] these are your device priorities: - see https://github.com/darktable-org/darktable/blob/master/src/common/opencl.c#L1379-L1387.

Were you able to disable the AMD onboard GPU?? What was up with the 2 Nvidia entries . Were you able to figure that out??

You could check this and try to see if you toggle it what happens

And this will likely also look the same in Win11…add DT to the list of apps and specify the GPU…

Just worth trying… https://www.howtogeek.com/351522/how-to-choose-which-gpu-a-game-uses-on-windows-10/

I could not figure out how to disable the AMD GPU. It is really not onboard, but on chip. It is part of the CPU, from what I read online. I did try going to Device Manager and just disabled the device there. I then deleted the kernel cache to force the regeneration. The AMD was not regenerated or found by DT opencl.

I dont get why I have 2 Nvidia entries. It creates two Nvidia kernel cache (3060_100 and 3060_51109)
device 0 (the _100) says supports image sizes of 32768 x 32768
allows GPU memory allocations of up to 3071MB
GLOBAL_MEM_SIZE: 12288MB

the card is 12gb of memory, so why allow up to 3071MB?

the second device (_51109) says: supports image sizes of 16384 x 16384
allows GPU memory allocations of up to 1024MB
GLOBAL_MEM_SIZE: 12142MB

I dont get what is going on with this second device (smaller sizes/memory)

Regardless, with only the Nvidia card, the haze removal = black image. Also it seems to fail to use the GPU.
7.180602 [pixelpipe_process] [full] using device 0
7.189400 [opencl_rawprepare] couldn’t enqueue kernel! -1
7.189596 [opencl_pixelpipe] could not run module ‘rawprepare’ on gpu. falling back to cpu path

That windows 11 setting was on by default. Since DT using opencl, I think the windows settings should not matter.

You must be about ready to hit something…it does seem that your card is not clearly being recognized or reporting the right values. I wonder if anyone else has a 3060 and what version of the driver is maybe working for them?? Would any of the other Opencl settings reduce the amount of memory that could be allocated?? I use occasionally ON1 photoraw and it was suggest for it as it uses OPENCL as well to add it to the graphics settings and specify the high setting so I did the same with DT…I don’t know if it made any difference and I am using Win10 not 11 but I did it anyway figuring it could not hurt and if the OS did ever get involved it was manually set to run using the most GPU it could not letting Windows decide for itself…

I think that’s the amount of memory that can be allocated in one chunk; however, all memory can be allocated (in several chunks). For my 6 GB card:

0.067616 [opencl_init] device 0 `GeForce GTX 1060 6GB' supports image sizes of 16384 x 32768
0.067620 [opencl_init] device 0 `GeForce GTX 1060 6GB' allows GPU memory allocations of up to 1519MB

(From: darktable 3.4/3.5 opencl slow on Windows 10 - #44 by kofa)

Memory info while proceccing an image:

FB Memory Usage
    Total                             : 6077 MiB
    Used                              : 5762 MiB
    Free                              : 315 MiB

(From: Which benchmarks provide an estimate to enable me compare and decide on which GPU to buy, for Image Processing ? - #13 by kofa)

did you already test each gpu device prioritation?
i.e. in your AppData\Local\darktable\darktablerc file using the line
opencl_device_priority=x,*/!x,*/*/*/*
x is the gpu device number 0 to 4

If all fails, then you need support by someone who has experience with win11 specific handling of opencl.

I did. Now that I disabled AMD, I just tested with this: opencl_device_priority=!0,!1,/!0,!1,/!0,!1,/!0,!1,/!0,!1,*

device 2 is the Microsoft Basic Render Driver. The execution fails to CPU and it does render the image, but this is the same as turning OpenCL off.

I tend to agree that there is an issue in the kernel cache process. There should only be one device found and one device kernel generated. The nvidia card / driver uses OpenCL 3.0. I dont know if there is a difference in the language with it.

I will try to mess with Windows settings to try something else.

If you did that tests with each device and all failed with same error message then you might try to get help in a windows11 support group.

1 Like

I am no expert but I would think maybe this is your issue…based on what you described earlier

See page 19 …sounds like what you are experiencing…

I don’t think a fix is provided as these are shown as known issues…

I am not sure in this case if this if for newer drivers, or a windows issue so maybe you could look for windows based solution or actually google a bit and see if older drivers had this issue??

TAG error…

EDIT

Check if you have Windows 11 game mode enabled…not sure what the default is but you might actually want it off?? And set DT as a high priority graphics app…see if either helps??

Hi @g-man,

I see there are multiple devices reporting for OpenCL. I’ve had similar issue in DT 3.8 where even with single GPU (rtx 3080), it was listed twice along with ‘Microsoft Basic Render Driver’.
Running darktable-cltest.exe resulted in multiple reports of opencl_create_kernel failing to create the kernel with -5 error (CL_​OUT_​OF_​RESOURCES).
Attempts at filtering for each device with ‘opencl_device_priority’ or settings that affect memory consumption failed.

What did the trick was removal of the OpenCL™ and OpenGL® Compatibility PackGet OpenCL™ and OpenGL® Compatibility Pack - Microsoft Store
After this, the GPU was listed only once and ‘Microsoft Basic Render Driver’ was no longer present.

I’ve not observed any negative effect of removing that compatibility layer for OpenCL.

FIXED!!!

Thanks @swish . That solved the problem. It seems that the combability stuff is pre-installed in my system (maybe part of windows 11). I went to windows System, Apps, Apps & Features and searched for OpenCL. I then selected it to be uninstalled.

Now DT only finds 2 devices (one Nvidia and one AMD) . DT is using both GPU and CPU to process the modules. I’m also able to use Haze Removal without it turning into a black image.

Just for fun, I deleted the kernel cache to force a new compile. It is all working now.

So, is this something we should include into the DT manual? Eg. For Windows installs, uninstall the OpenCL compatibility from apps if more than one device is found.

Not something for the user manual (which doesn’t cover this sort of thing - OS-specific issues/features) but perhaps might be useful on the github README file or even the Windows build instructions.

The manual does contain OS-specific info (for Linux): darktable 3.8 user manual - setting up opencl. There are also OS-specific notes here: darktable 3.8 user manual - purge_non_existing_images.sh

Including such info in the build instructions or in the Github readme would not benefit users, I think.

Ok fair enough. If someone wants to submit a PR for the manual I’ll consider including it when we reopen it for v4.0 contributions. I don’t use Windows though so I’ll be taking someone’s word for its accuracy.

This statement (see below) or that section of the manual already exists…might be a good place to insert this finding…ie memory is too low and or incorrectly reported…also maybe the suggestion to create a restore point incase there is negative impact on some other aspect of the system

Quote from manual in possible problems section…

  • darktable states that no OpenCL aware graphics card is detected or that the available memory on your GPU is too low and the device is discarded. In that case you might need to buy a new card if you really want OpenCL support.

It could be a one off though…I don’t think I see it installed on my system??