Attention is currently required from: Michael Knyszek, Cherry Zhang.
Austin Clements would like Michael Knyszek and Cherry Zhang to review this change.
runtime: port performance-critical functions to regabi
DO NOT SUBMIT. Needs benchmarks (early results are looking good but
not perfect).
This CL ports a few performance-critical runtime assembly functions to
use register arguments directly. While using the faster ABI is nice,
the real win here is that we avoid ABI wrappers: since these are
"builtin" functions in the compiler, it can generate calls to them
without knowing that their native implementation is ABI0. Hence, it
generates ABIInternal calls that go through ABI wrappers. By porting
them to use ABIInternal natively, we avoid the overhead of the ABI
wrapper.
Change-Id: I8f77f010b0abc658064df569a27a9c7a7b1c7bf9
---
M src/runtime/asm_amd64.s
M src/runtime/memclr_amd64.s
M src/runtime/memmove_amd64.s
M src/runtime/stubs.go
4 files changed, 169 insertions(+), 58 deletions(-)
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index 77f4939..20b8664 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -1011,34 +1011,62 @@
// func memhash(p unsafe.Pointer, h, s uintptr) uintptr
// hash function using AES hardware instructions
-TEXT runtime·memhash(SB),NOSPLIT,$0-32
+TEXT runtime·memhash<ABIInternal>(SB),NOSPLIT,$0-32
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr to data
+ // BX = seed
+ // CX = size
+#endif
CMPB runtime·useAeshash(SB), $0
JEQ noaes
+#ifndef GOEXPERIMENT_regabiargs
MOVQ p+0(FP), AX // ptr to data
MOVQ s+16(FP), CX // size
LEAQ ret+24(FP), DX
+#endif
JMP aeshashbody<>(SB)
noaes:
- JMP runtime·memhashFallback(SB)
+ JMP runtime·memhashFallback<ABIInternal>(SB)
// func strhash(p unsafe.Pointer, h uintptr) uintptr
-TEXT runtime·strhash(SB),NOSPLIT,$0-24
+TEXT runtime·strhash<ABIInternal>(SB),NOSPLIT,$0-24
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr to string struct
+ // BX = seed
+#endif
CMPB runtime·useAeshash(SB), $0
JEQ noaes
+#ifndef GOEXPERIMENT_regabiargs
MOVQ p+0(FP), AX // ptr to string struct
+#endif
MOVQ 8(AX), CX // length of string
MOVQ (AX), AX // string data
+#ifndef GOEXPERIMENT_regabiargs
LEAQ ret+16(FP), DX
+#endif
JMP aeshashbody<>(SB)
noaes:
- JMP runtime·strhashFallback(SB)
+ JMP runtime·strhashFallback<ABIInternal>(SB)
// AX: data
+#ifdef GOEXPERIMENT_regabiargs
+// BX: hash seed
+#else
+// h+8(FP): hash seed
+#endif
// CX: length
+#ifdef GOEXPERIMENT_regabiargs
+// At return: AX = return value
+#else
// DX: address to put return value
+#endif
TEXT aeshashbody<>(SB),NOSPLIT,$0-0
// Fill an SSE register with our seeds.
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ BX, X0 // 64 bits of per-table hash seed
+#else
MOVQ h+8(FP), X0 // 64 bits of per-table hash seed
+#endif
PINSRW $4, CX, X0 // 16 bits of length
PSHUFHW $0, X0, X0 // repeat length 4 times total
MOVO X0, X1 // save unscrambled seed
@@ -1075,7 +1103,11 @@
AESENC X1, X1 // scramble combo 3 times
AESENC X1, X1
AESENC X1, X1
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X1, AX // return X1
+#else
MOVQ X1, (DX)
+#endif
RET
endofpage:
@@ -1091,7 +1123,11 @@
aes0:
// Return scrambled input seed
AESENC X0, X0
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X0, AX // return X0
+#else
MOVQ X0, (DX)
+#endif
RET
aes16:
@@ -1121,7 +1157,11 @@
// combine results
PXOR X3, X2
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X2, AX // return X2
+#else
MOVQ X2, (DX)
+#endif
RET
aes33to64:
@@ -1163,7 +1203,11 @@
PXOR X6, X4
PXOR X7, X5
PXOR X5, X4
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X4, AX // return X4
+#else
MOVQ X4, (DX)
+#endif
RET
aes65to128:
@@ -1245,7 +1289,13 @@
PXOR X10, X8
PXOR X11, X9
PXOR X9, X8
+#ifdef GOEXPERIMENT_regabiargs
+ // X15 must be zero on return
+ XORPS X15, X15
+ MOVQ X8, AX // return X8
+#else
MOVQ X8, (DX)
+#endif
RET
aes129plus:
@@ -1361,38 +1411,70 @@
PXOR X10, X8
PXOR X11, X9
PXOR X9, X8
+#ifdef GOEXPERIMENT_regabiargs
+ // X15 must be zero on return
+ XORPS X15, X15
+ MOVQ X8, AX // return X8
+#else
MOVQ X8, (DX)
+#endif
RET
// func memhash32(p unsafe.Pointer, h uintptr) uintptr
-TEXT runtime·memhash32(SB),NOSPLIT,$0-24
+// ABIInternal for performance.
+TEXT runtime·memhash32<ABIInternal>(SB),NOSPLIT,$0-24
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr to data
+ // BX = seed
+#endif
CMPB runtime·useAeshash(SB), $0
JEQ noaes
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ BX, X0 // X0 = seed
+#else
MOVQ p+0(FP), AX // ptr to data
MOVQ h+8(FP), X0 // seed
+#endif
PINSRD $2, (AX), X0 // data
AESENC runtime·aeskeysched+0(SB), X0
AESENC runtime·aeskeysched+16(SB), X0
AESENC runtime·aeskeysched+32(SB), X0
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X0, AX // return X0
+#else
MOVQ X0, ret+16(FP)
+#endif
RET
noaes:
- JMP runtime·memhash32Fallback(SB)
+ JMP runtime·memhash32Fallback<ABIInternal>(SB)
// func memhash64(p unsafe.Pointer, h uintptr) uintptr
-TEXT runtime·memhash64(SB),NOSPLIT,$0-24
+// ABIInternal for performance.
+TEXT runtime·memhash64<ABIInternal>(SB),NOSPLIT,$0-24
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr to data
+ // BX = seed
+#endif
CMPB runtime·useAeshash(SB), $0
JEQ noaes
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ BX, X0 // X0 = seed
+#else
MOVQ p+0(FP), AX // ptr to data
MOVQ h+8(FP), X0 // seed
+#endif
PINSRQ $1, (AX), X0 // data
AESENC runtime·aeskeysched+0(SB), X0
AESENC runtime·aeskeysched+16(SB), X0
AESENC runtime·aeskeysched+32(SB), X0
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X0, AX // return X0
+#else
MOVQ X0, ret+16(FP)
+#endif
RET
noaes:
- JMP runtime·memhash64Fallback(SB)
+ JMP runtime·memhash64Fallback<ABIInternal>(SB)
// simple mask to get rid of data in the high part of the register.
DATA masks<>+0x00(SB)/8, $0x0000000000000000
diff --git a/src/runtime/memclr_amd64.s b/src/runtime/memclr_amd64.s
index 37fe974..b4bc998 100644
--- a/src/runtime/memclr_amd64.s
+++ b/src/runtime/memclr_amd64.s
@@ -12,9 +12,16 @@
// See memclrNoHeapPointers Go doc for important implementation constraints.
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
-TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-16
+// ABIInternal for performance.
+TEXT runtime·memclrNoHeapPointers<ABIInternal>(SB), NOSPLIT, $0-16
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr
+ // BX = n
+ MOVQ AX, DI // DI = ptr
+#else
MOVQ ptr+0(FP), DI
MOVQ n+8(FP), BX
+#endif
XORQ AX, AX
// MOVOU seems always faster than REP STOSQ.
@@ -31,7 +38,9 @@
JE _8
CMPQ BX, $16
JBE _9through16
- PXOR X0, X0
+#ifndef GOEXPERIMENT_regabig
+ PXOR X15, X15
+#endif
CMPQ BX, $32
JBE _17through32
CMPQ BX, $64
@@ -45,22 +54,22 @@
// TODO: for really big clears, use MOVNTDQ, even without AVX2.
loop:
- MOVOU X0, 0(DI)
- MOVOU X0, 16(DI)
- MOVOU X0, 32(DI)
- MOVOU X0, 48(DI)
- MOVOU X0, 64(DI)
- MOVOU X0, 80(DI)
- MOVOU X0, 96(DI)
- MOVOU X0, 112(DI)
- MOVOU X0, 128(DI)
- MOVOU X0, 144(DI)
- MOVOU X0, 160(DI)
- MOVOU X0, 176(DI)
- MOVOU X0, 192(DI)
- MOVOU X0, 208(DI)
- MOVOU X0, 224(DI)
- MOVOU X0, 240(DI)
+ MOVOU X15, 0(DI)
+ MOVOU X15, 16(DI)
+ MOVOU X15, 32(DI)
+ MOVOU X15, 48(DI)
+ MOVOU X15, 64(DI)
+ MOVOU X15, 80(DI)
+ MOVOU X15, 96(DI)
+ MOVOU X15, 112(DI)
+ MOVOU X15, 128(DI)
+ MOVOU X15, 144(DI)
+ MOVOU X15, 160(DI)
+ MOVOU X15, 176(DI)
+ MOVOU X15, 192(DI)
+ MOVOU X15, 208(DI)
+ MOVOU X15, 224(DI)
+ MOVOU X15, 240(DI)
SUBQ $256, BX
ADDQ $256, DI
CMPQ BX, $256
@@ -141,40 +150,40 @@
MOVQ AX, -8(DI)(BX*1)
RET
_17through32:
- MOVOU X0, (DI)
- MOVOU X0, -16(DI)(BX*1)
+ MOVOU X15, (DI)
+ MOVOU X15, -16(DI)(BX*1)
RET
_33through64:
- MOVOU X0, (DI)
- MOVOU X0, 16(DI)
- MOVOU X0, -32(DI)(BX*1)
- MOVOU X0, -16(DI)(BX*1)
+ MOVOU X15, (DI)
+ MOVOU X15, 16(DI)
+ MOVOU X15, -32(DI)(BX*1)
+ MOVOU X15, -16(DI)(BX*1)
RET
_65through128:
- MOVOU X0, (DI)
- MOVOU X0, 16(DI)
- MOVOU X0, 32(DI)
- MOVOU X0, 48(DI)
- MOVOU X0, -64(DI)(BX*1)
- MOVOU X0, -48(DI)(BX*1)
- MOVOU X0, -32(DI)(BX*1)
- MOVOU X0, -16(DI)(BX*1)
+ MOVOU X15, (DI)
+ MOVOU X15, 16(DI)
+ MOVOU X15, 32(DI)
+ MOVOU X15, 48(DI)
+ MOVOU X15, -64(DI)(BX*1)
+ MOVOU X15, -48(DI)(BX*1)
+ MOVOU X15, -32(DI)(BX*1)
+ MOVOU X15, -16(DI)(BX*1)
RET
_129through256:
- MOVOU X0, (DI)
- MOVOU X0, 16(DI)
- MOVOU X0, 32(DI)
- MOVOU X0, 48(DI)
- MOVOU X0, 64(DI)
- MOVOU X0, 80(DI)
- MOVOU X0, 96(DI)
- MOVOU X0, 112(DI)
- MOVOU X0, -128(DI)(BX*1)
- MOVOU X0, -112(DI)(BX*1)
- MOVOU X0, -96(DI)(BX*1)
- MOVOU X0, -80(DI)(BX*1)
- MOVOU X0, -64(DI)(BX*1)
- MOVOU X0, -48(DI)(BX*1)
- MOVOU X0, -32(DI)(BX*1)
- MOVOU X0, -16(DI)(BX*1)
+ MOVOU X15, (DI)
+ MOVOU X15, 16(DI)
+ MOVOU X15, 32(DI)
+ MOVOU X15, 48(DI)
+ MOVOU X15, 64(DI)
+ MOVOU X15, 80(DI)
+ MOVOU X15, 96(DI)
+ MOVOU X15, 112(DI)
+ MOVOU X15, -128(DI)(BX*1)
+ MOVOU X15, -112(DI)(BX*1)
+ MOVOU X15, -96(DI)(BX*1)
+ MOVOU X15, -80(DI)(BX*1)
+ MOVOU X15, -64(DI)(BX*1)
+ MOVOU X15, -48(DI)(BX*1)
+ MOVOU X15, -32(DI)(BX*1)
+ MOVOU X15, -16(DI)(BX*1)
RET
diff --git a/src/runtime/memmove_amd64.s b/src/runtime/memmove_amd64.s
index d91641a..df38551 100644
--- a/src/runtime/memmove_amd64.s
+++ b/src/runtime/memmove_amd64.s
@@ -31,11 +31,20 @@
// See memmove Go doc for important implementation constraints.
// func memmove(to, from unsafe.Pointer, n uintptr)
-TEXT runtime·memmove(SB), NOSPLIT, $0-24
-
+// ABIInternal for performance.
+TEXT runtime·memmove<ABIInternal>(SB), NOSPLIT, $0-24
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = to
+ // BX = from
+ // CX = n
+ MOVQ AX, DI
+ MOVQ BX, SI
+ MOVQ CX, BX
+#else
MOVQ to+0(FP), DI
MOVQ from+8(FP), SI
MOVQ n+16(FP), BX
+#endif
// REP instructions have a high startup cost, so we handle small sizes
// with some straightline code. The REP MOVSQ instruction is really fast
@@ -244,6 +253,10 @@
MOVOU X13, -48(DI)(BX*1)
MOVOU X14, -32(DI)(BX*1)
MOVOU X15, -16(DI)(BX*1)
+#ifdef GOEXPERIMENT_regabiargs
+ // X15 must be zero on return
+ XORPS X15, X15
+#endif
RET
move_256through2048:
SUBQ $256, BX
@@ -283,6 +296,10 @@
LEAQ 256(SI), SI
LEAQ 256(DI), DI
JGE move_256through2048
+#ifdef GOEXPERIMENT_regabiargs
+ // X15 must be zero on return
+ XORPS X15, X15
+#endif
JMP tail
avxUnaligned:
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index f635d94..16d7583 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -109,6 +109,9 @@
//go:noescape
func memmove(to, from unsafe.Pointer, n uintptr)
+// Outside assembly calls memmove. Make sure it has ABI wrappers.
+//go:linkname memmove
+
//go:linkname reflect_memmove reflect.memmove
func reflect_memmove(to, from unsafe.Pointer, n uintptr) {
memmove(to, from, n)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek, Cherry Zhang.
Patch set 1:Run-TryBot +1
1 comment:
Patchset:
TRY=linux-amd64-regabi
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 1:Code-Review +2
3 comments:
File src/runtime/asm_amd64.s:
For register ABI, the frame size does not include the result. (Not sure how much it matters.) (Also below.
#ifdef GOEXPERIMENT_regabiargs
// AX = ptr to data
// BX = seed
// CX = size
#endif
I guess this is fine, but a little weird for an ifdef block that contains only comments.
File src/runtime/stubs.go:
Patch Set #1, Line 112: // Outside assembly calls memmove. Make sure it has ABI wrappers.
How do you feed about just breaking them...
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 2:Code-Review +2
1 comment:
File src/runtime/memmove_amd64.s:
Patch Set #1, Line 256: #ifdef GOEXPERIMENT_regabiargs
I think the register needs to be zeroed when regabig is enabled (regabiargs may not be enabled). (Also other places.)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek.
1 comment:
File src/runtime/memmove_amd64.s:
Patch Set #1, Line 256: #ifdef GOEXPERIMENT_regabiargs
I think the register needs to be zeroed when regabig is enabled (regabiargs may not be enabled). […]
Oh, you're right, because we're calling this an ABIInternal function regardless of experiment configuration now. Done.
PTAL.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek, Cherry Zhang.
4 comments:
Patchset:
1 of 24 SlowBots failed:
Failed on linux-amd64-regabi: https://storage.googleapis.com/go-build-log/823bb967/linux-amd64-regabi_fb3eb3b5.log
Looking into this...
File src/runtime/asm_amd64.s:
For register ABI, the frame size does not include the result. (Not sure how much it matters. […]
Fixed.
(This happened with panicIndex/Slice, too.)
#ifdef GOEXPERIMENT_regabiargs
// AX = ptr to data
// BX = seed
// CX = size
#endif
I guess this is fine, but a little weird for an ifdef block that contains only comments.
I agree it's a little weird. The idea is that when we pull out the non-experiment path, we'll wind up with the right comments.
File src/runtime/stubs.go:
Patch Set #1, Line 112: // Outside assembly calls memmove. Make sure it has ABI wrappers.
How do you feed about just breaking them...
Bad. :(
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek, Cherry Zhang.
Austin Clements uploaded patch set #3 to this change.
runtime: port performance-critical functions to regabi
DO NOT SUBMIT. Needs benchmarks (early results are looking good but
not perfect).
This CL ports a few performance-critical runtime assembly functions to
use register arguments directly. While using the faster ABI is nice,
the real win here is that we avoid ABI wrappers: since these are
"builtin" functions in the compiler, it can generate calls to them
without knowing that their native implementation is ABI0. Hence, it
generates ABIInternal calls that go through ABI wrappers. By porting
them to use ABIInternal natively, we avoid the overhead of the ABI
wrapper.
Change-Id: I8f77f010b0abc658064df569a27a9c7a7b1c7bf9
---
M src/runtime/asm_amd64.s
M src/runtime/memclr_amd64.s
M src/runtime/memmove_amd64.s
M src/runtime/stubs.go
4 files changed, 183 insertions(+), 58 deletions(-)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 3:Code-Review +2
1 comment:
File src/runtime/asm_amd64.s:
Fixed. […]
I _think_ the spill slots are actually included, so this will be 24 for regabiargs. This is what I saw on the compiler side. I still haven't thought carefully what it implies.
Stack scanning at morestack might need that, but these are all nosplit. Defer is another case where argument size matters, but we now only defer argument-less functions. Maybe it doesn't matter.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek.
1 comment:
File src/runtime/asm_amd64.s:
I _think_ the spill slots are actually included, so this will be 24 for regabiargs. […]
Oh no, you're right. But I also think you're right that it doesn't matter... Fixed. (Again (I hope))
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek.
Austin Clements uploaded patch set #4 to this change.
runtime: port performance-critical functions to regabi
This CL ports a few performance-critical runtime assembly functions to
use register arguments directly. While using the faster ABI is nice,
the real win here is that we avoid ABI wrappers: since these are
"builtin" functions in the compiler, it can generate calls to them
without knowing that their native implementation is ABI0. Hence, it
generates ABIInternal calls that go through ABI wrappers. By porting
them to use ABIInternal natively, we avoid the overhead of the ABI
wrapper.
This significantly improves performance on several benchmarks,
comparing regabiwrappers before and after this change:
name old time/op new time/op delta
BiogoIgor 15.7s ± 2% 15.7s ± 2% ~ (p=0.617 n=25+25)
BiogoKrishna 18.5s ± 5% 17.7s ± 2% -4.61% (p=0.000 n=25+25)
BleveIndexBatch100 5.91s ± 3% 5.82s ± 3% -1.60% (p=0.000 n=25+25)
BleveQuery 6.76s ± 0% 6.60s ± 1% -2.31% (p=0.000 n=22+25)
CompileTemplate 248ms ± 5% 245ms ± 1% ~ (p=0.643 n=25+20)
CompileUnicode 94.4ms ± 3% 93.9ms ± 2% ~ (p=0.152 n=24+23)
CompileGoTypes 1.60s ± 2% 1.59s ± 2% ~ (p=0.059 n=24+24)
CompileCompiler 104ms ± 3% 103ms ± 1% ~ (p=0.056 n=25+22)
CompileSSA 10.9s ± 1% 10.9s ± 1% ~ (p=0.052 n=25+25)
CompileFlate 156ms ± 8% 152ms ± 1% -2.49% (p=0.008 n=25+21)
CompileGoParser 248ms ± 1% 249ms ± 2% ~ (p=0.058 n=21+20)
CompileReflect 595ms ± 3% 601ms ± 4% ~ (p=0.182 n=25+25)
CompileTar 211ms ± 2% 211ms ± 1% ~ (p=0.663 n=23+23)
CompileXML 282ms ± 2% 284ms ± 5% ~ (p=0.456 n=21+23)
CompileStdCmd 13.6s ± 2% 13.5s ± 2% ~ (p=0.112 n=25+24)
FoglemanFauxGLRenderRotateBoat 8.69s ± 2% 8.67s ± 0% ~ (p=0.094 n=22+25)
FoglemanPathTraceRenderGopherIter1 20.2s ± 2% 20.7s ± 3% +2.53% (p=0.000 n=24+24)
GopherLuaKNucleotide 31.4s ± 1% 31.0s ± 1% -1.28% (p=0.000 n=25+24)
MarkdownRenderXHTML 246ms ± 1% 244ms ± 1% -0.79% (p=0.000 n=20+21)
Tile38WithinCircle100kmRequest 843µs ± 4% 818µs ± 4% -2.93% (p=0.000 n=25+25)
Tile38IntersectsCircle100kmRequest 1.06ms ± 5% 1.05ms ± 3% -1.19% (p=0.021 n=24+25)
Tile38KNearestLimit100Request 1.01ms ± 1% 1.01ms ± 2% ~ (p=0.335 n=22+25)
[Geo mean] 596ms 592ms -0.71%
(https://perf.golang.org/search?q=upload:20210411.5)
It also significantly reduces the performance penalty of enabling
regabiwrappers, though it doesn't yet fully close the gap on all
benchmarks:
name old time/op new time/op delta
BiogoIgor 15.7s ± 1% 15.7s ± 2% ~ (p=0.366 n=24+25)
BiogoKrishna 17.7s ± 2% 17.7s ± 2% ~ (p=0.315 n=23+25)
BleveIndexBatch100 5.86s ± 4% 5.82s ± 3% ~ (p=0.137 n=24+25)
BleveQuery 6.55s ± 0% 6.60s ± 1% +0.83% (p=0.000 n=24+25)
CompileTemplate 244ms ± 1% 245ms ± 1% ~ (p=0.208 n=21+20)
CompileUnicode 94.0ms ± 4% 93.9ms ± 2% ~ (p=0.666 n=24+23)
CompileGoTypes 1.60s ± 2% 1.59s ± 2% ~ (p=0.154 n=25+24)
CompileCompiler 103ms ± 1% 103ms ± 1% ~ (p=0.905 n=24+22)
CompileSSA 10.9s ± 2% 10.9s ± 1% ~ (p=0.803 n=25+25)
CompileFlate 153ms ± 1% 152ms ± 1% ~ (p=0.182 n=23+21)
CompileGoParser 250ms ± 2% 249ms ± 2% ~ (p=0.843 n=24+20)
CompileReflect 595ms ± 4% 601ms ± 4% ~ (p=0.141 n=25+25)
CompileTar 212ms ± 3% 211ms ± 1% ~ (p=0.499 n=23+23)
CompileXML 282ms ± 1% 284ms ± 5% ~ (p=0.129 n=20+23)
CompileStdCmd 13.5s ± 2% 13.5s ± 2% ~ (p=0.480 n=24+24)
FoglemanFauxGLRenderRotateBoat 8.66s ± 1% 8.67s ± 0% ~ (p=0.325 n=25+25)
FoglemanPathTraceRenderGopherIter1 20.6s ± 3% 20.7s ± 3% ~ (p=0.137 n=25+24)
GopherLuaKNucleotide 30.5s ± 2% 31.0s ± 1% +1.68% (p=0.000 n=23+24)
MarkdownRenderXHTML 243ms ± 1% 244ms ± 1% +0.51% (p=0.000 n=23+21)
Tile38WithinCircle100kmRequest 801µs ± 2% 818µs ± 4% +2.11% (p=0.000 n=25+25)
Tile38IntersectsCircle100kmRequest 1.01ms ± 2% 1.05ms ± 3% +4.34% (p=0.000 n=24+25)
Tile38KNearestLimit100Request 1.00ms ± 1% 1.01ms ± 2% +0.81% (p=0.008 n=21+25)
[Geo mean] 589ms 592ms +0.50%
(https://perf.golang.org/search?q=upload:20210411.6)
Change-Id: I8f77f010b0abc658064df569a27a9c7a7b1c7bf9
---
M src/runtime/asm_amd64.s
M src/runtime/memclr_amd64.s
M src/runtime/memmove_amd64.s
M src/runtime/stubs.go
4 files changed, 183 insertions(+), 58 deletions(-)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 4:Code-Review +2
2 comments:
Patchset:
Is PS4
File src/runtime/asm_amd64.s:
Oh no, you're right. But I also think you're right that it doesn't matter... Fixed. […]
Is PS4 the one I'm supposed to be looking at? It seems the same as PS3, with 0 argument area sizes.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Austin Clements uploaded patch set #5 to this change.
4 files changed, 184 insertions(+), 59 deletions(-)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
File src/runtime/asm_amd64.s:
Is PS4 the one I'm supposed to be looking at? It seems the same as PS3, with 0 argument area sizes.
Now I'm super confused and the only explanation I can think of is that I must have somehow lost the argument size fixes in a rebase disaster. PTAL at PS5.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 5:Code-Review +2
1 comment:
File src/runtime/asm_amd64.s:
Now I'm super confused and the only explanation I can think of is that I must have somehow lost the […]
Why 8? I think it is 24, for the spill slots of three args. Also for the functions below, just one fewer word for the result.
Also memmove and memclr in the other files. I think the arg area size is the same for both ABIs.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
1 comment:
Patchset:
Patch Set 5: TryBot-Result-1
13 of 24 SlowBots failed:
Failed on freebsd-amd64-12_0: https://storage.googleapis.com/go-build-log/70bf0dda/freebsd-amd64-12_0_b980c408.log
Failed on misc-compile-darwin: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-darwin_23b0a536.log
Failed on linux-amd64-regabi: https://storage.googleapis.com/go-build-log/70bf0dda/linux-amd64-regabi_77eea346.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/70bf0dda/linux-amd64_c15efe41.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/70bf0dda/windows-amd64-2016_62a364ab.log
Failed on openbsd-amd64-68: https://storage.googleapis.com/go-build-log/70bf0dda/openbsd-amd64-68_f039a498.log
Failed on android-amd64-emu: https://storage.googleapis.com/go-build-log/70bf0dda/android-amd64-emu_d23fdf53.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/70bf0dda/linux-amd64-race_c7cc0250.log
Failed on misc-compile-solaris: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-solaris_c93f24ee.log
Failed on misc-compile-plan9: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-plan9_14bd7e23.log
Failed on misc-compile-other: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-other_485dd8a6.log
Failed on misc-compile-netbsd: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-netbsd_38957ff7.log
Failed on misc-compile-openbsd: https://storage.googleapis.com/go-build-log/70bf0dda/misc-compile-openbsd_ff91750a.logConsult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.
SlowBot builds that ran:
- linux-amd64-regabi
Apparently vet doesn't know how to compute ABIInternal argument area size, but it still does check it (!). For now we could just leave them unchanged, and I think that is fine for the moment.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek.
2 comments:
Patchset:
> Patch Set 5: TryBot-Result-1 […]
vet is getting increasingly unhelpful for these ABIInternal functions, I'm afraid. But they're also buried in so much preprocessor goo that I think we'll have to fix golang.org/cl/17544 before we can really address this.
File src/runtime/asm_amd64.s:
Why 8? I think it is 24, for the spill slots of three args. […]
Restored the original argument sizes to keep vet happy. ¯\_(ツ)_/¯
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Michael Knyszek.
Austin Clements uploaded patch set #6 to this change.
4 files changed, 174 insertions(+), 58 deletions(-)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Austin Clements, Michael Knyszek.
Patch set 6:Code-Review +2
1 comment:
Patchset:
LGTM. Thanks.
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.
Austin Clements submitted this change.
Reviewed-on: https://go-review.googlesource.com/c/go/+/308931
Trust: Austin Clements <aus...@google.com>
Run-TryBot: Austin Clements <aus...@google.com>
Reviewed-by: Cherry Zhang <cher...@google.com>
TryBot-Result: Go Bot <go...@golang.org>
---
M src/runtime/asm_amd64.s
M src/runtime/memclr_amd64.s
M src/runtime/memmove_amd64.s
M src/runtime/stubs.go
4 files changed, 174 insertions(+), 58 deletions(-)
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index 77f4939..e883f20 100644
@@ -1245,7 +1289,15 @@
PXOR X10, X8
PXOR X11, X9
PXOR X9, X8
+#ifdef GOEXPERIMENT_regabig
+ // X15 must be zero on return
+ PXOR X15, X15
+#endif
+#ifdef GOEXPERIMENT_regabiargs
+ MOVQ X8, AX // return X8
+#else
MOVQ X8, (DX)
+#endif
RET
aes129plus:
@@ -1361,38 +1413,73 @@
PXOR X10, X8
PXOR X11, X9
PXOR X9, X8
+#ifdef GOEXPERIMENT_regabig
+ // X15 must be zero on return
+ PXOR X15, X15
+#endif
+#ifdef GOEXPERIMENT_regabiargs
+ // AX = ptr to data
+ // BX = seed
+#elseindex d91641a..f1e3403 100644+#ifdef GOEXPERIMENT_regabig
+ // X15 must be zero on return
+ PXOR X15, X15
+#endif
RET
move_256through2048:
SUBQ $256, BX
@@ -283,6 +296,10 @@
LEAQ 256(SI), SI
LEAQ 256(DI), DI
JGE move_256through2048
+#ifdef GOEXPERIMENT_regabig
+ // X15 must be zero on return
+ PXOR X15, X15
+#endif
JMP tail
avxUnaligned:
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index f635d94..16d7583 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -109,6 +109,9 @@
//go:noescape
func memmove(to, from unsafe.Pointer, n uintptr)
+// Outside assembly calls memmove. Make sure it has ABI wrappers.
+//go:linkname memmove
+
//go:linkname reflect_memmove reflect.memmove
func reflect_memmove(to, from unsafe.Pointer, n uintptr) {
memmove(to, from, n)
To view, visit change 308931. To unsubscribe, or for help writing mail filters, visit settings.