4 ms·
What if my program has like 1 avx2 instruction? Then we still wake up the big core and run my process there? And keep running it there? Or do we try to migrate
by CountSessine 6y ago
What if my program has like 1 avx2 instruction? Then we still wake up the big core and run my process there? And keep running it there? Or do we try to migrate back to the little core every once in a while? And then go back to the big core when we trap again?
- saagarjha 6y agoIt's not quite relevant to your point, but generally you wouldn't want to have one AVX2 instruction as they are only really useful if you have a bunch of data.
- deleted 6y ago[deleted]
- ww520 6y agoYes, even if the process has 1 avx2 instruction, it will be scheduled to run on the main CPU. I mean you could switch the process back to the small CPU when you detect a long stretch of opcode without the avx2 instruction, but the constant switching between the main CPU and small CPU probably is not good for performance.
- pocak 6y agoThread migration only costs on the order of 100 microseconds, including the effect of cold caches. If you keep the AVX thread on the big core for at least 100 milliseconds at a time, you only lose ~0.2% performance.
- ww520 6y agoGood to know the switching cost is low. Runtime profiling would be key to provide insight into when to switch back.
- pocak 6y agoMigrate back to the little core if the thread hasn't used AVX in a while. Linux already tracks how long ago a task used AVX-512. I assume the same mechanism could be used to track AVX as well. https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/fpu&id=2f7726f955572e587d5f50fbe9b2deed5334bd90 https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/...