I am wondering why Xcode uses CPU for Metal GPU shader program execution for Swift. With Objective-C Metal, it finishes instantly. But the same shader program, when called from Swift, takes many seconds. GPU is idle while CPU runs 99%. I use the following line to choose GPU in Swift. But doesn't seem to choose real GPU.
let device: MTLDevice = MTLCreateSystemDefaultDevice()!
For Objective-C, I use the same default device. This chooses GPU correctly.
MTLDevice device = MTLCreateSystemDefaultDevice();
Is there any way I can choose GPU in Swift Metal?