#
✕ nick:YichaoYu[m]
#asahi-re · 2022-04-04 12:51
YichaoYu[m]on a related note, a failed cas does generate a count on the counter where a failed stxr does (180/0xb4)
#asahi-re · 2022-04-04 12:47
YichaoYu[m]if the comparison failed, still with no contention, it takes 58 cycles per loop on the p core
#asahi-re · 2022-04-04 12:47
YichaoYu[m]for a successful relaxed ordered cas with no contention, the loop takes 3 cycles on the P core (compared to ~1 cycle if it was a simple store).
#asahi-re · 2022-04-04 12:44
YichaoYu[m](hand writen -> script generated...)
#asahi-re · 2022-04-04 12:44
YichaoYu[m]and the fail case ~20 lines below
#asahi-re · 2022-04-04 12:43
YichaoYu[m]asm here https://github.com/yuyichao/m1_pmu_test/blob/cf4fbcc3e740e258339637c64062385a140c666b/src/libtests_atomic.s#L241-L246
#asahi-re · 2022-04-04 12:43
YichaoYu[m]yes when I cross-checked it in julia, and for my original test it's hand written assembly
#asahi-re · 2022-04-04 12:42
YichaoYu[m]and yes, successful weak ordering cas is really cheap
#asahi-re · 2022-04-04 12:41
YichaoYu[m]I was basically doing a cas with the wrong compare value with no contention.
#asahi-re · 2022-04-04 12:41
YichaoYu[m]note that I'm talking about single thread here
#asahi-re · 2022-04-04 12:38
YichaoYu[m]and this difference is especially pronouced with more relaxed ordering, and especially on the P cores
#asahi-re · 2022-04-04 12:37
YichaoYu[m]I don't really know how people implement atomics these days but is it possible that these atomic operations are actually ucoded and internally it's still using something similar to llsc?
#asahi-re · 2022-04-04 12:36
YichaoYu[m]it also generates many more counts on the counters that I suspect related to uops issued.
#asahi-re · 2022-04-04 12:35
YichaoYu[m]I noticed that a failed cas instruction seems to be about 2-10x slower than successful ones, depending on the memory order on the m1. And I don't see this on intel.
#asahi-re · 2022-03-28 17:17
YichaoYu[m]<marcan> "but the end goal should be..." <- Please at least keep supporting sort for a few more years…. Currently the hack it took to get input methods working in wayland is just terrible….