-
Debug GPU-side errors in Metal
Track down even the trickiest GPU-side programming errors with enhanced reporting in Xcode 12. While Metal's API validation layer can catch most problems in a project, GPU errors can cause a host of difficult-to-debug issues.
Get an introduction to GPU-side errors and learn how to find and eliminate problems like visual corruption, infinite loop timeouts, out of bounds memory accesses, nil resource access, or invalid resource residency with Xcode 12. Discover how to enable enhanced command buffer error reporting and shader validation, use them effectively as part of your debugging strategy, and automate them in your production pipeline.Recursos
Vídeos relacionados
WWDC22
WWDC21
WWDC20
-
Buscar neste vídeo...
-
-
3:40 - Enable enhanced command buffer errors
let desc = MTLCommandBufferDescriptor() desc.errorOptions = .encoderExecutionStatus let commandBuffer = commandQueue.makeCommandBuffer(descriptor: desc) -
3:55 - Processing enhanced command buffer errors
if let error = commandBuffer.error as NSError? { if let encoderInfos = error.userInfo[MTLCommandBufferEncoderInfoErrorKey] as? [MTLCommandBufferEncoderInfo] { for info in encoderInfos { print(info.label + info.debugSignposts.joined()) if info.errorState == .faulted { print(info.label + " faulted!") } } } } -
15:39 - Command buffer logs API
commandBuffer.addCompletedHandler { (commandBuffer) in for log in commandBuffer.logs { let encoderLabel = log.encoderLabel ?? "Unknown Label" print("Faulting encoder \"\(encoderLabel)\"") guard let debugLocation = log.debugLocation, let functionName = debugLocation.functionName else { return } print("Faulting function \(functionName):\(debugLocation.line):\(debugLocation.column)") } } -
15:40 - Accessing the log
log stream --predicate "subsystem = 'com.apple.Metal' and category = 'GPUDebug'"
-