Me:
- https://github.com/xen0n
- Member of the Go loong64 porters team (@golang/loong64)
- Tinkers with things for fun
- Linux/LoongArch port reviewer
- Contributor to LLVM/QEMU/binutils/glibc/...
- Gentoo developer, Gentoo/LoongArch
LoongArch:
- https://github.com/loongson/LoongArch-Documentation
- https://blog.xen0n.name/posts/tinkering/loongarch-faq/
- RISC ISA blending traditional principles with practical experiences
- Influenced by MIPS and RISC-V
- They say it's gonna become open standards
- Timeline of the Loongson fork (https://bbs.loongarch.org/d/95-loongarch-slackware-current-bootstrap/42)
- Unfortunate bikeshedding caused by lack of communication
- Originally
GOARCH=larch64
: https://github.com/loongson/go/commit/40c3a0eae3968c2a9946c4e72036be6592c5b772 - Then
GOARCH=loongarch64
: https://github.com/loongson/go/commit/2d68237cb4051ce313dd3254b33a0b65019c977e - Opposed by community: https://go.dev/issue/46229
- Final decision is
GOARCH=loong64
- Originally
Apparently Loongson took their inspirations from the mips64x
port:
- Asm syntax (I don't like
xxxV
) - Code organization and style (smell)
Unfortunately my take was a false start (lack of personal time & priorities), so these persisted into the eventual merge. Most (if not all) are implementation details so we could still progressively improve, though.
Support among the ecosystem:
- Infra
x/sys
x/net
: any tagged version is OK- golangci-lint: binaries offered since v1.51.0 (2023-02-02)
- dlv: stalled due to lack of CI
- CI/CD
- goreleaser: supported since v1.11.0 (2022-08-29)
- gox: stalled on review
Popular apps that work:
- frp
- gitea
- helm
- hugo
- kubectl
- syncthing
- more TBD
Popular apps that don't work yet:
- Docker (? -- needs confirmation)
- Kubernetes (need check)
- more TBD
How does one port to loong64
?
- Ensure buildability with go1.19+
- Ensure up-to-date
x/sys
and related modules - Watch out for particularly problematic deps
Community participation:
go1.20:
- native rotates (@wdvxdr1123)
- intrinsify
Add64
,Sub64
(@wdvxdr1123) - enable branch elimination pass (@wdvxdr1123)
go1.21:
- improve logical shifts with MASKEQZ (@wdvxdr1123)
- MULH only when necessary (@wdvxdr1123)
- separate DIV and REM ops (@wdvxdr1123)
Thanks!
Current work of the loong64 team (to show up in go1.21):
buildmode=pie
- Security hardening by default: Gentoo, many CNCF projects, others
- Seems PIE support comes for free (without even requiring ELF psABI v2)
- Transition to LoongArch ELF psABI v2
- Discussion, implementation
- Unlocks more build modes with less code
- General cleanups
- asm backend refactors & low-hanging fruits
- asm case 11 cleanup: no MIPS-esque
beq zero, zero
, immediately win 0.24% throughput - asm case 6 cleanup for beqz/bnez
- remove family field, support for 4-operand insns
- single-instruction sign- and zero-extensions
PCALIGN
, manual asm loop alignment +2.33%- auto loop head alignment another +0.29%
- more TODO
- asm case 11 cleanup: no MIPS-esque
- asm backend refactors & low-hanging fruits
- Reliability improvements
47627.7 overflows float64
-- runtime: floating-point comparison error on Loong64, fix- TBD: choose more Gerrit CLs to showcase here
- Low-hanging fruits
- assembly
hash/crc32
+20%- xchg micro-benchmark -28.61%
- And/Or micro-benchmark -44.96%
- ssa optimization chances
- Tracker: https://go.dev/issue/59120
TrailingZeros
- FMA
Len
ReverseBytes
bitrev
- counting ones TODO
- more CLs TBD
- assembly
Upstream work:
- loong64 asm backend overhaul
- machine-generated insn description for maintainability
- consistent asm grammar
- some compatibility preserved (mainly for x/sys)
- regabi support
- another 10%~20% perf win
- move g from
fp
tos8
: enable frame pointers at all times for debuggability
- internal link support
Possible ecosystem work:
- Communication to make CNCF inroads smooth
- TBD
See you in the bug trackers!