Skip to content

Instantly share code, notes, and snippets.

View phlasserre's full-sized avatar

Philippe LASSERRE phlasserre

View GitHub Profile
@lukaszmargielewski
lukaszmargielewski / gist:0a3b16d4661dd7d7e00d
Last active March 11, 2021 15:04
iOS Metal client side code for compute pipeline
// For stackoverflow question:
// http://stackoverflow.com/questions/30445801/ios8-metal-compute-pipeline-slower-than-cpu
// I. CODE INVOKED ONCE, AT THE INIT STAGE:
_mtlCharTable = [_mtlDevice newBufferWithBytes:_charTable->pointer length:_charTable->bytesTotal options:0];
_mtlSearchMasks = [_mtlDevice newBufferWithBytesNoCopy:_searchIndexes.mask length:_searchIndexes.bytesTotalMask options:0 deallocator:nil];
//iPhone 6: maxTotalThreadsPerThreadgroup: 512, threadExecutionWidth: 32
uint threadsPerThreadGroup = [_mtlComputePipelineState maxTotalThreadsPerThreadgroup];// / 4.0;