Open tianleiwu opened 1 week ago
Add support of ARM in SpinPause.
TODO: Need some benchmarks to see whether it could help ARM device.
Currently, SpinPause is empty for ARM, which means CPU might be very busy when nothing is called in a loop.
Some References if we want to support other platforms:
https://github.com/boostorg/atomic/blob/b202228311eb4f5a9568d40b9314dfbb4ef20607/include/boost/atomic/detail/pause.hpp#L40-L59
https://github.com/boostorg/fiber/blob/7838ab09d700214e3d7dd7104fce241ca7552336/include/boost/fiber/detail/cpu_relax.hpp#L32-L78
https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.14393.0/um/ntarm_x.h#L82-L90
https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/wtf/+/823d62cdecdbd5f161634177e130e5ac01eb7b48/SpinLock.cpp#17
https://github.com/wine-mirror/wine/blob/c9a8333c0f274201faf33d27abda1ebb5ae07cec/include/winnt.h#L7387C25-L7398
https://github.com/Tencent/mars/blob/master/mars/comm/thread/spinlock.h#L92-L107
Description
Add support of ARM in SpinPause.
TODO: Need some benchmarks to see whether it could help ARM device.
Motivation and Context
Currently, SpinPause is empty for ARM, which means CPU might be very busy when nothing is called in a loop.
Some References if we want to support other platforms:
https://github.com/boostorg/atomic/blob/b202228311eb4f5a9568d40b9314dfbb4ef20607/include/boost/atomic/detail/pause.hpp#L40-L59
https://github.com/boostorg/fiber/blob/7838ab09d700214e3d7dd7104fce241ca7552336/include/boost/fiber/detail/cpu_relax.hpp#L32-L78
https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.14393.0/um/ntarm_x.h#L82-L90
https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/wtf/+/823d62cdecdbd5f161634177e130e5ac01eb7b48/SpinLock.cpp#17
https://github.com/wine-mirror/wine/blob/c9a8333c0f274201faf33d27abda1ebb5ae07cec/include/winnt.h#L7387C25-L7398
https://github.com/Tencent/mars/blob/master/mars/comm/thread/spinlock.h#L92-L107