@@ -2780,46 +2780,8 @@ static enum ggml_status ggml_metal_graph_compute(
27802780 if (status != MTLCommandBufferStatusCompleted ) {
27812781 GGML_METAL_LOG_INFO (" %s : command buffer %d failed with status %lu \n " , __func__, i, status);
27822782 if (status == MTLCommandBufferStatusError ) {
2783- MTLCommandBufferError error_code = [command_buffer error ].code ;
2784- switch (error_code) {
2785- // use constants rather than the explicit enum cases so
2786- // this works even when building for platforms which don't support
2787- // some specific error
2788- // https://developer.apple.com/documentation/metal/mtlcommandbuffererror?language=objc
2789- case 0 : // MTLCommandBufferErrorNone
2790- GGML_METAL_LOG_INFO (" no error code reported\n " );
2791- break ;
2792- case 2 : // MTLCommandBufferErrorTimeout
2793- GGML_METAL_LOG_INFO (" timeout\n " );
2794- break ;
2795- case 3 : // MTLCommandBufferErrorPageFault
2796- GGML_METAL_LOG_INFO (" unserviceable page fault\n " );
2797- break ;
2798- case 8 : // MTLCommandBufferErrorOutOfMemory
2799- GGML_METAL_LOG_INFO (" out of memory\n " );
2800- break ;
2801- case 9 : // MTLCommandBufferErrorInvalidResource
2802- GGML_METAL_LOG_INFO (" invalid reference to resource\n " );
2803- break ;
2804- case 10 : // MTLCommandBufferErrorMemoryless
2805- GGML_METAL_LOG_INFO (" GPU ran out of one or more of its internal resources that support memoryless render pass attachments\n " );
2806- break ;
2807- case 11 : // MTLCommandBufferErrorDeviceRemoved
2808- GGML_METAL_LOG_INFO (" device removed\n " );
2809- break ;
2810- case 12 : // MTLCommandBufferErrorStackOverflow
2811- GGML_METAL_LOG_INFO (" kernel function of tile shader used too many stack frames\n " );
2812- break ;
2813- case 4 : // MTLCommandBufferErrorAccessRevoked
2814- GGML_METAL_LOG_INFO (" access to device revoked by system\n " );
2815- break ;
2816- case 1 : // MTLCommandBufferErrorInternal
2817- GGML_METAL_LOG_INFO (" internal error\n " );
2818- break ;
2819- default :
2820- GGML_METAL_LOG_INFO (" unknown error %lu \n " , error_code);
2821- break ;
2822- }
2783+ NSString * error_code = [command_buffer error ].localizedDescription ;
2784+ GGML_METAL_LOG_INFO (" error: %s \n " , [error_code UTF8String ]);
28232785 }
28242786
28252787 return GGML_STATUS_FAILED;
0 commit comments