Debugging compute shader driver crash in editor

I’m writing a custom editor tool that uses compute shaders to generate meshes from implicit surfaces. This tool runs inside the Unity Editor, not inside the final executable.

My invocation code is basically

public class MesherWindow : EditorWindow {
    ComputeShader shader;
    float[] input;
    float[] output;
    int numThreads;
    private void OnGUI() {
        if (GUILayout.Button("Compute mesh")) {
            // input, kernel, numThreads, shader, etc. are all properly initialised here
            ComputeBuffer inputBuffer = new ComputeBuffer(..);
            ComputeBuffer outputBuffer = new ComputeBuffer(..);
            inputBuffer.SetData(input);
            shader.SetBuffer(kernel, "_input", inputBuffer);
            shader.SetBuffer(kernel, "_output", outputBuffer);
            int tgroups = input.Length / numThreads;
            shader.Dispatch(kernel, tgroups, 1, 1); // Driver crash here
            outputBuffer.GetData(output);
            inputBuffer.Dispose();
            outputBuffer.Dispose();

One of my shaders consistently causes a driver crash on Windows and Mac OSX, with nVidia and AMD hardware. There is no exception raised in Unity, the program continues, but receives dummy values from subsequent Dispatch calls. Given that the shader causes a driver crash on two OSes and GPUs from different vendors, I’m almost certain the problem is in my shader and not the driver implementation. Is the problem that I’m dispatching during GUI draws? How can I figure out what is causing the crash?

Turned out my shader was entering an infinite loop.

I would like to check how it works, yesterday I ****** up one of my shaders and idk where but lost previous version and it crashes amd drivers.
could you send the shader? I want to see if theres any coincidence.
Thanks