bakkot commited on
Commit
d4dcef9
·
1 Parent(s): 34d3b03

metal : log more info on error (llama/6987)

Browse files
Files changed (1) hide show
  1. ggml-metal.m +39 -0
ggml-metal.m CHANGED
@@ -2794,6 +2794,45 @@ static enum ggml_status ggml_metal_graph_compute(
2794
  MTLCommandBufferStatus status = [command_buffer status];
2795
  if (status != MTLCommandBufferStatusCompleted) {
2796
  GGML_METAL_LOG_INFO("%s: command buffer %d failed with status %lu\n", __func__, i, status);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2797
  return GGML_STATUS_FAILED;
2798
  }
2799
  }
 
2794
  MTLCommandBufferStatus status = [command_buffer status];
2795
  if (status != MTLCommandBufferStatusCompleted) {
2796
  GGML_METAL_LOG_INFO("%s: command buffer %d failed with status %lu\n", __func__, i, status);
2797
+ if (status == MTLCommandBufferStatusError) {
2798
+ MTLCommandBufferError error_code = [command_buffer error].code;
2799
+ switch (error_code) {
2800
+ case MTLCommandBufferErrorNone:
2801
+ GGML_METAL_LOG_INFO("no error code reported\n");
2802
+ break;
2803
+ case MTLCommandBufferErrorTimeout:
2804
+ GGML_METAL_LOG_INFO("timeout\n");
2805
+ break;
2806
+ case MTLCommandBufferErrorPageFault:
2807
+ GGML_METAL_LOG_INFO("unserviceable page fault\n");
2808
+ break;
2809
+ case MTLCommandBufferErrorOutOfMemory:
2810
+ GGML_METAL_LOG_INFO("out of memory\n");
2811
+ break;
2812
+ case MTLCommandBufferErrorInvalidResource:
2813
+ GGML_METAL_LOG_INFO("invalid reference to resource\n");
2814
+ break;
2815
+ case MTLCommandBufferErrorMemoryless:
2816
+ GGML_METAL_LOG_INFO("GPU ran out of one or more of its internal resources that support memoryless render pass attachments\n");
2817
+ break;
2818
+ case MTLCommandBufferErrorDeviceRemoved:
2819
+ GGML_METAL_LOG_INFO("device removed\n");
2820
+ break;
2821
+ case MTLCommandBufferErrorStackOverflow:
2822
+ GGML_METAL_LOG_INFO("kernel function of tile shader used too many stack frames\n");
2823
+ break;
2824
+ case MTLCommandBufferErrorAccessRevoked:
2825
+ GGML_METAL_LOG_INFO("access to device revoked by system\n");
2826
+ break;
2827
+ case MTLCommandBufferErrorInternal:
2828
+ GGML_METAL_LOG_INFO("internal error\n");
2829
+ break;
2830
+ default:
2831
+ GGML_METAL_LOG_INFO("unknown error %lu\n", error_code);
2832
+ break;
2833
+ }
2834
+ }
2835
+
2836
  return GGML_STATUS_FAILED;
2837
  }
2838
  }