// Adapted from turboderp exllama: https://github.com/turboderp/exllama | |
// React to failure on return code != cudaSuccess | |
do { \ | |
{_cuda_err = fn;} \ | |
if (_cuda_err != cudaSuccess) goto _cuda_fail; \ | |
} while(false) | |
// React to failure on return code == 0 | |
do { \ | |
if (!(fn)) { _cuda_err = cudaUnspecified; goto _cuda_fail; } \ | |
else _cuda_err = cudaSuccess; \ | |
} while(false) | |