Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Metal: Unable to create compute pipeline state with function

I was trying to make a simple app for sudoku solving on GPU with iOS Metal Framework.

I was following instructions from this blog post:

http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/

I version my code here:

https://github.com/mateuszbuda/Sudoku

(As of writing this question HEAD is commit c3e06e0)

And I've encountered error when calling

newComputePipelineStateWithFunction

that is while setting up MTLDevice in ViewController (line 95):

https://github.com/mateuszbuda/Sudoku/blob/c3e06e0e1edc724eea20962f32e49f0df8143b7d/Sudoku/ViewController.swift

The error I get is:

Error Domain=AGXMetal Code=1 "Compiler encountered an internal error"

I'm running this on iPhone 6 Plus with iOS 8.1.3

Have someone any idea what can cause the error I get?

like image 925
kostek Avatar asked Nov 01 '22 07:11

kostek


1 Answers

You are experiencing one of the unfinished matters in Metal. The reason the error says "internal" is because this is a compiler error, CAUSED by the compiler. Not you. Try this:

  1. Copy all of the code in the ".metal" file that is not compilable.
  2. Delete the .metal file (NOT just the reference).
  3. Remove all of the content of the "DerivedData" folder located at users/yourUser/Library/Developer/Xcode/DerivedData
  4. Create a new .metal file and paste the old code in this new metal file.

Now build and run, you should be good to go. Anybody who finds this error make sure to send some sort of error report to Apple so that they can properly debug it and fix it in the next release of Xcode.

like image 172
amedley Avatar answered Nov 11 '22 04:11

amedley