I made some changes in my encode chain, but now I have the same error for smaller textures as well.
Here is a "working" code example, it works for small textures, but throws the GPU hang error for big ones.
/* setup first layer */
[commandEncoder endEncoding];
commandEncoder = [commandBuffer computeCommandEncoder];
/* setup second layer */
[commandEncoder endEncoding];
commandEncoder = [commandBuffer computeCommandEncoder];
/* setup third layer */
[commandEncoder endEncoding];
[commandBuffer commit];
[commandBuffer waitUntilCompleted];
commandBuffer = [self.commandQueue commandBuffer];
commandEncoder = [commandBuffer computeCommandEncoder];
// etc
As you can see I do commit after passing every ~3 layers of my neural network. This works perfect for little textures (little means textures with <= 1600x990 resolution for iPhone 6S Plus and 1920x1080 for iPhone 7/7 Plus). But when I'm trying to commit commandBuffer after every layer like:
/* setup first layer */
[commandEncoder endEncoding];
[commandBuffer commit];
[commandBuffer waitUntilCompleted];
commandBuffer = [self.commandQueue commandBuffer];
commandEncoder = [commandBuffer computeCommandEncoder];
/* setup second layer */
[commandEncoder endEncoding];
[commandBuffer commit];
[commandBuffer waitUntilCompleted];
commandBuffer = [self.commandQueue commandBuffer];
commandEncoder = [commandBuffer computeCommandEncoder];
/* setup third layer */
[commandEncoder endEncoding];
[commandBuffer commit];
[commandBuffer waitUntilCompleted];
commandBuffer = [self.commandQueue commandBuffer];
commandEncoder = [commandBuffer computeCommandEncoder];
// etc
I'm getting the GPU hang error even for texture with size of 512x384. And I can't understand what causes that.
P.S. Usually I'm getting the error after ~2nd-3rd commit call in the second example.