alloy-rs / alloy-rs/ruint

Perf: AArch64: U256::const_eq auto vectorization produces longer dependency chain than scalar lowering

Đang mở
#588 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
225
Fork
70
Merge trung bình
16 giờ 54 phút
Pull request đã merge (30 ngày)
8

Mô tả

For small fixed size equality checks (LIMBS = 4), LLVM currently vectorizes the reduction into a NEON horizontal reduction sequence:
```
ldp q0, q1, [x0]
ldp q2, q3, [x1]
cmeq v1.2d, v1.2d, v3.2d
cmeq v0.2d, v0.2d, v2.2d
uzp1 v0.4s, v0.4s, v1.4s
mvn v0.16b, v0.16b
umaxv s0, v0.4s
fmov w9, s0
bic w0, w8, w9
```
This creates a dependency chain(as it should) with long dependency chain

Image

Now if we were to turn off auto vectorization we get this:
```
const_eq:
ldp x8, x11, [x1]
ldp x9, x10, [x0]
cmp x9, x8
ccmp x10, x11, #0, eq
ldp x8, x10, [x0, #16]
ldp x9, x11, [x1, #16]
ccmp x8, x9, #0, eq
ccmp x10, x11, #0, eq
cset w0, eq
ret
```
This creates a dependency chain(as it should) too but with way more exploitation of the ILP

Image

Will you handroll it for aarch64 or maybe use an attribute(can't think of any)?

anyway the cycle difference between this is like 60+ but of course in a prod this won't be a standalone execution so it kinda frees up the pipeline faster and prevents CPU stalling on instructions

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.