This update continues where the last left off, adding local memory optimization also to graphics_flags_mc() and graphics_rasterize_phi() kernels.
And an interesting bug fix: It's possible that large GPU kernels use too many registers - more variables than can fit into the GPU's SRAM. Kernel execution then fails. This was the case with my graphics_q() Q-criterion isosurface rendering kernel - with local memoy optimization enabled - on old Nvidia Maxwell/Pascal GPUs.
The easy workaround would be to just disable the local memory optimization on these Maxwell/Pascal GPUs. But that would drop rendering framerate by 50%.
Instead I did register occupancy optimization: At any point in the execution timeline, a kernel occupies X registers - this can be traced and counted by hand. In one or more places, X exceeds the SRAM size. Shuffle operations around, re-use previous variables instead of declaring new ones, reduce how many variables reside in registers at once. Voilà, from 152 registers down to 122 registers, just below Maxwell/Pascal's limit of 128 registers. Full rendering performance even on the old hardware, no excuses.
Also some other rendering optimizations, and fixes for Intel Panther Lake and Nvidia GB10.
Improvements
- made
graphics_flags_mc()kernel up to 40% faster with local memory optimization - added local memory optimization also for
graphics_rasterize_phi()kernel - small optimization in
marching_cubes() - dispatch marching-cubes kernels only for
(Nx-1)*(Ny-1)*(Nz-1)instead ofN - updated driver install instructions
Bug fixes
- fixed
graphics_q()kernel withGRAPHICS_LSQ=8on older Nvidia GPUs through register optimization - fixed z-buffer flickering on Intel Panther Lake iGPUs
- disabled zero-copy on Nvidia iGPUs such as GB10 because
CL_MEM_USE_HOST_PTRis broken there - fixed missing
allocated_bitmap/zbufferinCameramove assignment - fixed missing type cast in OpenCL-Wrapper
- fixed crash/segfault on exit
- removed
opencl_unroll_hintagain (unsupported on some older GPUs)
Have fun with the software!
-- Moritz