Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: failed to make Go on riscv64 CPU with numa #61295

Closed
mengzhuo opened this issue Jul 11, 2023 · 6 comments
Closed

cmd/compile: failed to make Go on riscv64 CPU with numa #61295

mengzhuo opened this issue Jul 11, 2023 · 6 comments
Assignees
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mengzhuo
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go 1.21rc2

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='riscv64'
GOBIN=''
GOCACHE='/home/perfxlab04/.cache/go-build'
GOENV='/home/perfxlab04/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='riscv64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/perfxlab04/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/perfxlab04/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/perfxlab04/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/perfxlab04/go/pkg/tool/linux_riscv64'
GOVCS=''
GOVERSION='go1.21rc2'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3214241602=/tmp/go-build -gno-record-gcc-switches'

What did you do?

cd src && ./make.bash

What did you expect to see?

build complete

What did you see instead?

Building packages and commands for linux/riscv64.
runtime: checkdead: find g 2581 in status 1
fatal error: checkdead: runnable g

runtime stack:
runtime.throw({0x618a92?, 0x53f00?})
        /home/perfxlab04/godev/src/runtime/panic.go:1077 +0x44 fp=0x3f74633d80 sp=0x3f74633d58 pc=0x49db4
runtime.checkdead.func1(0x3f740fbd40)
        /home/perfxlab04/godev/src/runtime/proc.go:5451 +0x118 fp=0x3f74633db0 sp=0x3f74633d80 pc=0x582b8
runtime.forEachG(0x3f74633e20)
        /home/perfxlab04/godev/src/runtime/proc.go:608 +0x70 fp=0x3f74633dd8 sp=0x3f74633db0 pc=0x4d530
runtime.checkdead()
        /home/perfxlab04/godev/src/runtime/proc.go:5437 +0x10c fp=0x3f74633e30 sp=0x3f74633dd8 pc=0x57f14
runtime.mput(0x5227c?)
        /home/perfxlab04/godev/src/runtime/proc.go:5933 +0x58 fp=0x3f74633e38 sp=0x3f74633e30 pc=0x59540
runtime.stopm()
        /home/perfxlab04/godev/src/runtime/proc.go:2534 +0x60 fp=0x3f74633e60 sp=0x3f74633e38 pc=0x50c10
runtime.findRunnable()
        /home/perfxlab04/godev/src/runtime/proc.go:3229 +0xc20 fp=0x3f74633f58 sp=0x3f74633e60 pc=0x52798
runtime.schedule()
        /home/perfxlab04/godev/src/runtime/proc.go:3582 +0xa4 fp=0x3f74633f88 sp=0x3f74633f58 pc=0x538bc
runtime.park_m(0x3f740001a0?)
        /home/perfxlab04/godev/src/runtime/proc.go:3745 +0x124 fp=0x3f74633fc8 sp=0x3f74633f88 pc=0x53e6c
runtime.mcall()
        /home/perfxlab04/godev/src/runtime/asm_riscv64.s:291 +0x40 fp=0x3f74633fd8 sp=0x3f74633fc8 pc=0x7c
af0
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 11, 2023
@mengzhuo mengzhuo self-assigned this Jul 11, 2023
@mengzhuo mengzhuo added the arch-riscv Issues solely affecting the riscv64 architecture. label Jul 11, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/508715 mentions this issue: cmd/asm, cmd/internal/obj: generate proper atomic ops for riscv64

@mengzhuo mengzhuo changed the title cmd/compile: failed on riscv64 CPU with numa cmd/compile: failed to make Go on riscv64 CPU with numa Jul 11, 2023
@mengzhuo
Copy link
Contributor Author

@bcmills hi, can I add this issue to release-blocker?

@bcmills
Copy link
Contributor

bcmills commented Jul 11, 2023

@mengzhuo, since riscv64 is not a first-class port it pretty much by definition can't be a release-blocker.

That said, I would expect that the fix can make the final go1.21.0 release anyway.

@bcmills bcmills added this to the Go1.21 milestone Jul 11, 2023
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 11, 2023
@mknyszek mknyszek moved this to In Progress in Go Compiler / Runtime Jul 19, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Go Compiler / Runtime Jul 20, 2023
@mengzhuo
Copy link
Contributor Author

@gopherbot Please open backport issues.

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #61470 (for 1.19), #61471 (for 1.20).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/511856 mentions this issue: [release-branch.go1.21] cmd/asm, cmd/internal/obj: generate proper atomic ops for riscv64

gopherbot pushed a commit that referenced this issue Jul 21, 2023
…omic ops for riscv64

Go's memory model closely follows the approach C++ concurrency memory
model (https://go.dev/ref/mem) and Go atomic "has the same semantics as C++'s
sequentially consistent atomics".

Meanwhile according to RISCV manual A.6 "Mappings from C/C++ primitives to RISC-V primitives".
C/C++ atomic operations (memory_order_acq_rel) should be map to "amo<op>.{w|d}.aqrl"
LR/SC (memory_order_acq_rel) should map to "lr.{w|d}.aq; <op>; sc.{w|d}.rl"

goos: linux
goarch: riscv64
pkg: runtime/internal/atomic
                │ atomic.old.bench │          atomic.new.bench           │
                │      sec/op      │   sec/op     vs base                │
AtomicLoad64-4         4.216n ± 1%   4.202n ± 0%        ~ (p=0.127 n=10)
AtomicStore64-4        5.040n ± 0%   6.718n ± 0%  +33.30% (p=0.000 n=10)
AtomicLoad-4           4.217n ± 0%   4.213n ± 0%        ~ (p=0.145 n=10)
AtomicStore-4          5.040n ± 0%   6.718n ± 0%  +33.30% (p=0.000 n=10)
And8-4                 9.237n ± 0%   9.240n ± 0%        ~ (p=0.582 n=10)
And-4                  5.878n ± 0%   6.719n ± 0%  +14.31% (p=0.000 n=10)
And8Parallel-4         28.44n ± 0%   28.46n ± 0%   +0.07% (p=0.000 n=10)
AndParallel-4          28.40n ± 0%   28.43n ± 0%   +0.11% (p=0.000 n=10)
Or8-4                  8.399n ± 0%   8.398n ± 0%        ~ (p=0.357 n=10)
Or-4                   5.879n ± 0%   6.718n ± 0%  +14.27% (p=0.000 n=10)
Or8Parallel-4          28.43n ± 0%   28.45n ± 0%   +0.09% (p=0.000 n=10)
OrParallel-4           28.40n ± 0%   28.43n ± 0%   +0.11% (p=0.000 n=10)
Xadd-4                 30.05n ± 0%   30.10n ± 0%   +0.18% (p=0.000 n=10)
Xadd64-4               30.05n ± 0%   30.09n ± 0%   +0.12% (p=0.000 n=10)
Cas-4                  60.48n ± 0%   61.13n ± 0%   +1.08% (p=0.000 n=10)
Cas64-4                62.28n ± 0%   62.34n ± 0%        ~ (p=0.810 n=10)
Xchg-4                 30.05n ± 0%   30.09n ± 0%   +0.15% (p=0.000 n=10)
Xchg64-4               30.05n ± 0%   30.09n ± 0%   +0.13% (p=0.000 n=10)
geomean                15.42n        16.17n        +4.89%

Fixes #61295

Change-Id: I97b5325db50467eeec36fb079bded7b09a32330f
Reviewed-on: https://go-review.googlesource.com/c/go/+/508715
Reviewed-by: Austin Clements <[email protected]>
Reviewed-by: Joel Sing <[email protected]>
Run-TryBot: M Zhuo <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
(cherry picked from commit 890b96f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/511856
Auto-Submit: M Zhuo <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
Reviewed-by: M Zhuo <[email protected]>
bradfitz pushed a commit to tailscale/go that referenced this issue Aug 2, 2023
…omic ops for riscv64

Go's memory model closely follows the approach C++ concurrency memory
model (https://go.dev/ref/mem) and Go atomic "has the same semantics as C++'s
sequentially consistent atomics".

Meanwhile according to RISCV manual A.6 "Mappings from C/C++ primitives to RISC-V primitives".
C/C++ atomic operations (memory_order_acq_rel) should be map to "amo<op>.{w|d}.aqrl"
LR/SC (memory_order_acq_rel) should map to "lr.{w|d}.aq; <op>; sc.{w|d}.rl"

goos: linux
goarch: riscv64
pkg: runtime/internal/atomic
                │ atomic.old.bench │          atomic.new.bench           │
                │      sec/op      │   sec/op     vs base                │
AtomicLoad64-4         4.216n ± 1%   4.202n ± 0%        ~ (p=0.127 n=10)
AtomicStore64-4        5.040n ± 0%   6.718n ± 0%  +33.30% (p=0.000 n=10)
AtomicLoad-4           4.217n ± 0%   4.213n ± 0%        ~ (p=0.145 n=10)
AtomicStore-4          5.040n ± 0%   6.718n ± 0%  +33.30% (p=0.000 n=10)
And8-4                 9.237n ± 0%   9.240n ± 0%        ~ (p=0.582 n=10)
And-4                  5.878n ± 0%   6.719n ± 0%  +14.31% (p=0.000 n=10)
And8Parallel-4         28.44n ± 0%   28.46n ± 0%   +0.07% (p=0.000 n=10)
AndParallel-4          28.40n ± 0%   28.43n ± 0%   +0.11% (p=0.000 n=10)
Or8-4                  8.399n ± 0%   8.398n ± 0%        ~ (p=0.357 n=10)
Or-4                   5.879n ± 0%   6.718n ± 0%  +14.27% (p=0.000 n=10)
Or8Parallel-4          28.43n ± 0%   28.45n ± 0%   +0.09% (p=0.000 n=10)
OrParallel-4           28.40n ± 0%   28.43n ± 0%   +0.11% (p=0.000 n=10)
Xadd-4                 30.05n ± 0%   30.10n ± 0%   +0.18% (p=0.000 n=10)
Xadd64-4               30.05n ± 0%   30.09n ± 0%   +0.12% (p=0.000 n=10)
Cas-4                  60.48n ± 0%   61.13n ± 0%   +1.08% (p=0.000 n=10)
Cas64-4                62.28n ± 0%   62.34n ± 0%        ~ (p=0.810 n=10)
Xchg-4                 30.05n ± 0%   30.09n ± 0%   +0.15% (p=0.000 n=10)
Xchg64-4               30.05n ± 0%   30.09n ± 0%   +0.13% (p=0.000 n=10)
geomean                15.42n        16.17n        +4.89%

Fixes golang#61295

Change-Id: I97b5325db50467eeec36fb079bded7b09a32330f
Reviewed-on: https://go-review.googlesource.com/c/go/+/508715
Reviewed-by: Austin Clements <[email protected]>
Reviewed-by: Joel Sing <[email protected]>
Run-TryBot: M Zhuo <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
(cherry picked from commit 890b96f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/511856
Auto-Submit: M Zhuo <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
Reviewed-by: M Zhuo <[email protected]>
@golang golang locked and limited conversation to collaborators Jul 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-riscv Issues solely affecting the riscv64 architecture. compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants