Processing images only does half when using GPU

Bizarre issue; When my kernel is run on the GPU and I ask it to process the full sized image (which can be 10mpx, 20mpx, 5mpx images); the resulting image only shows the bottom half being processed by the kernel.


When it's done via the CPU, it does the complete image, just about 10 times slower.


Any one run into this? Any suggestions on how to solve it. Obviously I want to use the GPU as it's about 10x faster than the CPU.

Accepted Reply

Does this happen for all input sizes?

I know that Core Image does use tiling when processing large images, but this only works when providing it with correct extent and ROI callbacks.

Replies

Does this happen for all input sizes?

I know that Core Image does use tiling when processing large images, but this only works when providing it with correct extent and ROI callbacks.

I've only tested with a few images of different sizes, but yes it is at least consistent. It's odd that CPU rendering is fine.

I assume you're using [CIKernel applyWithExtent:roiCallback:arguments:] instead of [CIFilter apply:arguments:options:]?


I've been using the latter for years; but this the first time I've encountered this issue, although I will admit that this is the most complicated kernel I've created to date.

Yes, I'm using the

CIKernel
API. The
CIFilter
API is only available on macOS and the corresponding way to setting the ROI callback via
setROISelector
is also kinda deprecated (as it seems from reading the docs).

That's good to know; thanks. Currently I only focus on the Mac, but I'll give this a try soon.

Frank; you've continued to be a great help and a valuable member in this community.


Updating the filter code to use the CIKernel function introduced in 10.11 (as that's my mimimum target OS, phew!), coupled with Apple's examples of using this function to provide different ROIs, so that map image doesn't change, it's now working as it should.


Only downside is that it's now taking longer on the GPU, so the speed difference isn't so significant 🙂 But I am happy that it works (currently) and using the GPU is still faster than the CPU.