No, if possible narrow down the minimal code snippet, which reproduces the error.
I.e. remove all data loading, metric calculation etc., use random inputs and try to isolate the illegal memory access to a few lines.
What’s currently hard to debug is that your code apparently seems to run fine on the CPU and that the blocking launch isn’t properly working in your setup.