How to debug compute kernel in metal ios?

I have written compute metal kernel in shader language. But it's not working as I expected so I thought about debugging and I am following Metal Tips and Techniques for debugging. I have called the

insertDebugCaptureBoundary
method of
MTLCommandQueue
to inform Xcode about debugging.


But still not able to debug GPU part of code like we do in CPU. While doing step debugging in CPU part of code how I will be get prompted to GPU code(.metal file) ?

Is it possible to debug the step by step code of GPU ?

If I am asking something meaningless please tell me how to do debugging of GPU code ( compute kernel) (.metal file) in Xcode ?


Thanks for reading....

Replies

To squash a bug in my kernel, I ended up compiling the code as C and debugging on the CPU.

I put the metal into a ".h" file that was included after

#include <simd/common.h>
#include <simd/conversion.h>
#define bool _Bool

Also changed occurances of float# to vector_float# (which might not be needed if you compiled metal as C++ instead of C)

And do you have "half" type in C++ or do you simply typedef them as float?