Hi, according to the post here, it’s said that the main thread should only blocks for the job/graphics scheduling.
I use the Sentis Whisper Tiny demo to test on Android. Here’s the time of each part.
It takes 23s for padding. It’s horrible. Is it run in a sub thread?
And the other parts costs tens to hundreds of milliseconds.
If the tensor is never makeReadable and execute the next model again, the data is not read back. Right?
How can I make it not blocking the main thread?
Thank you.
before new TensorFloat(new TensorShape(1, numSamples), data)
TensorFloat time: 00:00:00.0108040
before ops.Pad(input, new int[] { 0, 0, 0, maxSamples - numSamples })
Pad time: 00:00:23.5512980
before spectroEngine.Execute(input30seconds)
Spectro time: 00:00:00.0336710
before encoderEngine.Execute(spectroOutput)
Encoder time: 00:00:00.4862310
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.8611970
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.0252620
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.0634260
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.0153540
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.0302340
before decoderEngine.Execute(inputs)
Decoder time: 00:00:00.0139590
和命中有什么
None of that code on HF is optimized.
It is meant as a example to get started, so we do take shortcuts that have some overhead which you could optimize away depending on your application
I can help out with different part of the sentis execution that you feel are not performant enough and give you ways to minimize such costs.
But do break it down into individual issues
Thank you. I updated to 1.4.0. And take the latest RunWhisper.cs code as a reference. It improves a lot. No pad op is needed now. And the 23s cost of it is removed.
But the other part still costs tens to hundreds of milliseconds. Any other suggestion to improve it?
Here are the captures.
For the 1st time. It costs 19s for one frame. It’s horrible experience.
For the 2nd & 3rd time, it’s better. But it still costs hundred milliseconds.
It’s running on the RayNeo X2 XR glasses. It’s not on the desktop.
Is it possible to totally run it in the sub thread like some native plugin does? It blocks the main thread would be with a poor experience.
Checking the log I see that sentis takes 16ms and there is a logtoconsole that takes 15ms too… so you might want to get rid of that
Sentis scheduling time is a bit high… are you sure you are not running in debug mode?
It shouldn’t cost that much unless it’s somehow doing new buffer allocations when running inference