NeuralObscura / NeuralObscura

MIT License
1 stars 0 forks source link

MPSTemporaryImage prefetch #8

Open dinedal opened 7 years ago

dinedal commented 7 years ago

From the VGGnet example:

      // This lets us squeeze some extra speed out of Metal.
      MPSTemporaryImage.prefetchStorage(with: commandBuffer, imageDescriptorList: [
        input_id, conv1_id, pool1_id, conv2_id, pool2_id, conv3_id, pool3_id,
        conv4_id, pool4_id, conv5_id, pool5_id, fc_id, output_id ])

Can we integrate this into the framework?

teddyknox commented 7 years ago

ooh I like... so it somehow batch allocates the memory?

dinedal commented 7 years ago

Yes and it puts all the data in place. Should be done once on init of a temporary (non-debug) network.

teddyknox commented 7 years ago

hmm. Ok. We'll need to refactor somes stuff but shouldn't be too hard.