@@ -2779,6 +2779,45 @@ static enum ggml_status ggml_metal_graph_compute(
2779
2779
MTLCommandBufferStatus status = [command_buffer status ];
2780
2780
if (status != MTLCommandBufferStatusCompleted ) {
2781
2781
GGML_METAL_LOG_INFO (" %s : command buffer %d failed with status %lu \n " , __func__, i, status);
2782
+ if (status == MTLCommandBufferStatusError ) {
2783
+ MTLCommandBufferError error_code = [command_buffer error ].code ;
2784
+ switch (error_code) {
2785
+ case MTLCommandBufferErrorNone :
2786
+ GGML_METAL_LOG_INFO (" no error code reported\n " );
2787
+ break ;
2788
+ case MTLCommandBufferErrorTimeout :
2789
+ GGML_METAL_LOG_INFO (" timeout\n " );
2790
+ break ;
2791
+ case MTLCommandBufferErrorPageFault :
2792
+ GGML_METAL_LOG_INFO (" unserviceable page fault\n " );
2793
+ break ;
2794
+ case MTLCommandBufferErrorOutOfMemory :
2795
+ GGML_METAL_LOG_INFO (" out of memory\n " );
2796
+ break ;
2797
+ case MTLCommandBufferErrorInvalidResource :
2798
+ GGML_METAL_LOG_INFO (" invalid reference to resource\n " );
2799
+ break ;
2800
+ case MTLCommandBufferErrorMemoryless:
2801
+ GGML_METAL_LOG_INFO (" GPU ran out of one or more of its internal resources that support memoryless render pass attachments\n " );
2802
+ break ;
2803
+ case MTLCommandBufferErrorDeviceRemoved :
2804
+ GGML_METAL_LOG_INFO (" device removed\n " );
2805
+ break ;
2806
+ case MTLCommandBufferErrorStackOverflow:
2807
+ GGML_METAL_LOG_INFO (" kernel function of tile shader used too many stack frames\n " );
2808
+ break ;
2809
+ case MTLCommandBufferErrorAccessRevoked:
2810
+ GGML_METAL_LOG_INFO (" access to device revoked by system\n " );
2811
+ break ;
2812
+ case MTLCommandBufferErrorInternal :
2813
+ GGML_METAL_LOG_INFO (" internal error\n " );
2814
+ break ;
2815
+ default :
2816
+ GGML_METAL_LOG_INFO (" unknown error %lu \n " , error_code);
2817
+ break ;
2818
+ }
2819
+ }
2820
+
2782
2821
return GGML_STATUS_FAILED;
2783
2822
}
2784
2823
}
0 commit comments