6g and 8g pass all tests for 5g i need to be able to test ...
12 years, 11 months ago
(2012-04-16 11:33:02 UTC)
#2
6g and 8g pass all tests
for 5g i need to be able to test somewhere
/L
On Mon, Apr 16, 2012 at 13:30, <lvd@google.com> wrote:
> Reviewers: rsc,
>
> Message:
> Hello rsc@golang.org (cc: golang-dev@googlegroups.com),
>
> I'd like you to review this change to
> https://go.googlecode.com/hg/
>
>
> Description:
> cmd/gc: inline slice[arr,str] in the frontend (mostly).
>
> Please review this at
http://codereview.appspot.com/**5966075/<http://codereview.appspot.com/5966075/>
>
> Affected files:
> M src/cmd/5g/cgen.c
> M src/cmd/5g/gg.h
> M src/cmd/5g/ggen.c
> M src/cmd/5g/gsubr.c
> M src/cmd/6g/cgen.c
> M src/cmd/6g/gg.h
> M src/cmd/6g/ggen.c
> M src/cmd/6g/gsubr.c
> M src/cmd/8g/cgen.c
> M src/cmd/8g/gg.h
> M src/cmd/8g/ggen.c
> M src/cmd/8g/gsubr.c
> M src/cmd/gc/builtin.c
> M src/cmd/gc/gen.c
> M src/cmd/gc/go.h
> M src/cmd/gc/runtime.go
> M src/cmd/gc/walk.c
> M src/pkg/runtime/slice.c
> M src/pkg/runtime/string.goc
>
>
>
On 2012/04/16 11:33:02, lvd wrote: > 6g and 8g pass all tests > for 5g ...
12 years, 11 months ago
(2012-04-17 18:18:05 UTC)
#7
On 2012/04/16 11:33:02, lvd wrote:
> 6g and 8g pass all tests
> for 5g i need to be able to test somewhere
after removed the unused variable (Node m) in 5g/gsubr.c, ./all.bash failed
test/nilptr.go:
run nilptr.go : incorrect output
panic: memory reference did not panic
goroutine 1 [running]:
main._func_001(0x1ce0c, 0x10e60)
/mnt/work2/tmp/gobuilder/linux-arm/test/nilptr.go:46 +0x78
main.shouldPanic(0x10e60, 0x0)
/mnt/work2/tmp/gobuilder/linux-arm/test/nilptr.go:49 +0x50
main.main()
/mnt/work2/tmp/gobuilder/linux-arm/test/nilptr.go:33 +0x94
goroutine 2 [syscall]:
created by runtime.main
Also, I think the test (in /test) is slower (14min vs. 7min) with this CL
applied.
This should fix the test failure (./all.bash passed on the Linux/ARM builder). I need more ...
12 years, 11 months ago
(2012-04-17 18:54:49 UTC)
#8
This should fix the test failure (./all.bash passed on the Linux/ARM builder).
I need more investigations for the possible performance regression.
http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c
File src/cmd/5g/gsubr.c (right):
http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c#newcode1208
src/cmd/5g/gsubr.c:1208: // TODO lvd
void
checkref(Node *n)
{
Node m1, m2;
if(n->type->type->width < unmappedzero)
return;
regalloc(&m1, types[TUINTPTR], n);
regalloc(&m2, types[TUINT8], n);
cgen(n, &m1);
m1.xoffset = 0;
m1.op = OINDREG;
m1.type = types[TUINT8];
gins(AMOVBU, &m1, &m2);
regfree(&m2);
regfree(&m1);
}
thank you! i hadn't gotten around to figuring out that missing bit and i didn't ...
12 years, 11 months ago
(2012-04-17 20:19:41 UTC)
#9
thank you! i hadn't gotten around to figuring out that missing bit and i
didn't have an arm to play on.
On Tue, Apr 17, 2012 at 20:54, <minux.ma@gmail.com> wrote:
> This should fix the test failure (./all.bash passed on the Linux/ARM
> builder).
>
> I need more investigations for the possible performance regression.
>
>
for 5g, the original cgen_inline wasn't even called afaict, so it would
always call the pkg/runtime functions. a factor 2 sounds excessive though.
>
>
http://codereview.appspot.com/**5966075/diff/24001/src/cmd/5g/**gsubr.c<http:...
> File src/cmd/5g/gsubr.c (right):
>
> http://codereview.appspot.com/**5966075/diff/24001/src/cmd/5g/**
>
gsubr.c#newcode1208<http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c#newcode1208>
> src/cmd/5g/gsubr.c:1208: // TODO lvd
> void
> checkref(Node *n)
> {
> Node m1, m2;
>
> if(n->type->type->width < unmappedzero)
> return;
>
> regalloc(&m1, types[TUINTPTR], n);
> regalloc(&m2, types[TUINT8], n);
> cgen(n, &m1);
> m1.xoffset = 0;
> m1.op = OINDREG;
> m1.type = types[TUINT8];
> gins(AMOVBU, &m1, &m2);
> regfree(&m2);
> regfree(&m1);
> }
>
>
http://codereview.appspot.com/**5966075/<http://codereview.appspot.com/5966075/>
>
On Tue, Apr 17, 2012 at 22:19, Luuk van Dijk <lvd@google.com> wrote: > thank you! ...
12 years, 11 months ago
(2012-04-17 20:39:30 UTC)
#10
On Tue, Apr 17, 2012 at 22:19, Luuk van Dijk <lvd@google.com> wrote:
> thank you! i hadn't gotten around to figuring out that missing bit and i
> didn't have an arm to play on.
>
> On Tue, Apr 17, 2012 at 20:54, <minux.ma@gmail.com> wrote:
>
>> This should fix the test failure (./all.bash passed on the Linux/ARM
>> builder).
>>
>> I need more investigations for the possible performance regression.
>>
>>
> for 5g, the original cgen_inline wasn't even called afaict, so it would
> always call the pkg/runtime functions. a factor 2 sounds excessive though.
>
esp since time run in test and go run in test/bench/go1 show no noticable
difference on darwin/amd64 and darwin/386...
>
>
>>
>>
http://codereview.appspot.com/**5966075/diff/24001/src/cmd/5g/**gsubr.c<http:...
>> File src/cmd/5g/gsubr.c (right):
>>
>> http://codereview.appspot.com/**5966075/diff/24001/src/cmd/5g/**
>>
gsubr.c#newcode1208<http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c#newcode1208>
>> src/cmd/5g/gsubr.c:1208: // TODO lvd
>> void
>> checkref(Node *n)
>> {
>> Node m1, m2;
>>
>> if(n->type->type->width < unmappedzero)
>> return;
>>
>> regalloc(&m1, types[TUINTPTR], n);
>> regalloc(&m2, types[TUINT8], n);
>> cgen(n, &m1);
>> m1.xoffset = 0;
>> m1.op = OINDREG;
>> m1.type = types[TUINT8];
>> gins(AMOVBU, &m1, &m2);
>> regfree(&m2);
>> regfree(&m1);
>> }
>>
>>
http://codereview.appspot.com/**5966075/<http://codereview.appspot.com/5966075/>
>>
>
>
I hand patched minux's suggested checkref only my 5g system and now all the tests ...
12 years, 11 months ago
(2012-04-18 00:56:22 UTC)
#12
I hand patched minux's suggested checkref only my 5g system and now
all the tests pass, however I share the concern that there has been a
performance regression. I'll dig into it more today but anecdotally
src/test/run took 23 minutes (i'll confirm the pre cl times) and
anything that needs to use go/parser etc (so the go tool, the api
tool) take signficantly longer and appear to be cpu bound.
Cheers
Dave
On Wed, Apr 18, 2012 at 6:41 AM, Luuk van Dijk <lvd@google.com> wrote:
>
>
> On Tue, Apr 17, 2012 at 22:39, Luuk van Dijk <lvd@google.com> wrote:
>>>>
>>>>
>>>>
http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c#newcode1208
>>>> src/cmd/5g/gsubr.c:1208: // TODO lvd
>>>> void
>>>> checkref(Node *n)
>>>> {
>>>> Node m1, m2;
>>>>
>>>> if(n->type->type->width < unmappedzero)
>>>> return;
>>>>
>>>> regalloc(&m1, types[TUINTPTR], n);
>>>> regalloc(&m2, types[TUINT8], n);
>>>> cgen(n, &m1);
>>>> m1.xoffset = 0;
>>>> m1.op = OINDREG;
>>>> m1.type = types[TUINT8];
>>>> gins(AMOVBU, &m1, &m2);
>>>> regfree(&m2);
>>>> regfree(&m1);
>>>> }
>>>>
>>>> http://codereview.appspot.com/5966075/
>>>
>>>
>>
>
> i added your checkref to my CL. thanks again.
>
> /L
On Wed, Apr 18, 2012 at 02:56, Dave Cheney <dave@cheney.net> wrote: > I hand patched ...
12 years, 11 months ago
(2012-04-18 05:46:09 UTC)
#13
On Wed, Apr 18, 2012 at 02:56, Dave Cheney <dave@cheney.net> wrote:
> I hand patched minux's suggested checkref only my 5g system and now
> all the tests pass, however I share the concern that there has been a
> performance regression. I'll dig into it more today but anecdotally
> src/test/run took 23 minutes (i'll confirm the pre cl times) and
>
wow, that is worrying. thanks for investigating.
> anything that needs to use go/parser etc (so the go tool, the api
> tool) take signficantly longer and appear to be cpu bound.
>
> Cheers
>
> Dave
>
> On Wed, Apr 18, 2012 at 6:41 AM, Luuk van Dijk <lvd@google.com> wrote:
> >
> >
> > On Tue, Apr 17, 2012 at 22:39, Luuk van Dijk <lvd@google.com> wrote:
> >>>>
> >>>>
> >>>>
>
http://codereview.appspot.com/5966075/diff/24001/src/cmd/5g/gsubr.c#newcode1208
> >>>> src/cmd/5g/gsubr.c:1208: // TODO lvd
> >>>> void
> >>>> checkref(Node *n)
> >>>> {
> >>>> Node m1, m2;
> >>>>
> >>>> if(n->type->type->width < unmappedzero)
> >>>> return;
> >>>>
> >>>> regalloc(&m1, types[TUINTPTR], n);
> >>>> regalloc(&m2, types[TUINT8], n);
> >>>> cgen(n, &m1);
> >>>> m1.xoffset = 0;
> >>>> m1.op = OINDREG;
> >>>> m1.type = types[TUINT8];
> >>>> gins(AMOVBU, &m1, &m2);
> >>>> regfree(&m2);
> >>>> regfree(&m1);
> >>>> }
> >>>>
> >>>> http://codereview.appspot.com/5966075/
> >>>
> >>>
> >>
> >
> > i added your checkref to my CL. thanks again.
> >
> > /L
>
actually, on 386 it's terrible too, and even on amd64, there's a 33% slowdown for ...
12 years, 11 months ago
(2012-04-18 06:29:48 UTC)
#15
actually, on 386 it's terrible too, and even on amd64, there's a 33%
slowdown for sliceslice. this needs some more work.
i used these benchmarks
package sl_test
import "testing"
var a [100]byte
const s = "alloallo"
func BenchmarkSliceSlice(b *testing.B) {
s1 := a[:]
lo, hi := 3, 97
var s2 []byte
for i := 0; i < b.N; i++ {
s2 = s1[lo: hi]
}
_ = s2
}
func BenchmarkSliceStr(b *testing.B) {
s1 := s[:]
lo, hi := 3, 7
var s2 string
for i := 0; i < b.N; i++ {
s2 = s1[lo: hi]
}
_ = s2
}
func BenchmarkSliceArr(b *testing.B) {
lo, hi := 3, 7
var s2 []byte
for i := 0; i < b.N; i++ {
s2 = a[lo: hi]
}
_ = s2
}
On Wed, Apr 18, 2012 at 08:29, Luuk van Dijk <lvd@google.com> wrote: > actually, on ...
12 years, 11 months ago
(2012-04-18 06:42:27 UTC)
#16
On Wed, Apr 18, 2012 at 08:29, Luuk van Dijk <lvd@google.com> wrote:
> actually, on 386 it's terrible too, and even on amd64, there's a 33%
> slowdown for sliceslice. this needs some more work.
part of it seems to be due to the safeexpr(n->left) i turned into a
copyexpr(n->left) in the last revision to fix a crashing case. hold off
your reviews, i'll hammer on it some more.
On Wed, Apr 18, 2012 at 08:42, Luuk van Dijk <lvd@google.com> wrote: > > > ...
12 years, 11 months ago
(2012-04-18 08:01:18 UTC)
#17
On Wed, Apr 18, 2012 at 08:42, Luuk van Dijk <lvd@google.com> wrote:
>
>
> On Wed, Apr 18, 2012 at 08:29, Luuk van Dijk <lvd@google.com> wrote:
>
>> actually, on 386 it's terrible too, and even on amd64, there's a 33%
>> slowdown for sliceslice. this needs some more work.
>
>
> part of it seems to be due to the safeexpr(n->left) i turned into a
> copyexpr(n->left) in the last revision to fix a crashing case. hold off
> your reviews, i'll hammer on it some more.
>
>
i uploaded a new revision that undoes that copyexpr except in one case for
which i still have to find a better fix (and the root cause).
this gets the 'realistic' benchmarks sane again on amd64 and 386 with some
big wins, presumably due to slicestr getting inlined now, and some small
losses due to sliceslice and slicearr taking 25% longer (1.85 vs. 1.4ns)
i expect the factor 2 on arm to be gone too.
looking at the generated assembly, i can only explain it from the new
layout of the bounds check which goes from
0016 (sl_test.go:14) MOVLQSX SI,BX
0017 (sl_test.go:14) MOVLQSX DX,BP
0018 (sl_test.go:14) MOVLQZX CX,R8
0019 (sl_test.go:14) CMPQ BP,R8
0020 (sl_test.go:14) JLS ,22
0021 (sl_test.go:14) CALL ,runtime.panicslice+0(SB)
0022 (sl_test.go:14) CMPQ BX,BP
0023 (sl_test.go:14) JHI ,21
to
0017 (sl_test.go:14) MOVL R10,DX
0018 (sl_test.go:14) MOVL DI,CX
0019 (sl_test.go:14) MOVL R8,AX
0020 (sl_test.go:14) CMPL R10,DI
0021 (sl_test.go:14) JCS ,25
0022 (sl_test.go:14) CMPL DI,R8
0023 (sl_test.go:14) JCS ,25
0024 (sl_test.go:14) JMP ,26
0025 (sl_test.go:14) CALL ,runtime.panicslice+0(SB)
I'll continue to work on this.
On 2012/04/19 17:45:34, minux wrote: > beside this small typo, I can confirm that the ...
12 years, 11 months ago
(2012-04-19 18:13:46 UTC)
#19
On 2012/04/19 17:45:34, minux wrote:
> beside this small typo, I can confirm that the performance regression on ARM
is
> fixed.
>
thank you!
> go run test/run.go
> old:
> real 6m9.318s user 10m42.94s sys 1m0.71s
> new:
> real 5m55.78s user 10m5.82s sys 1m0.71s
>
> http://codereview.appspot.com/5966075/diff/30022/src/cmd/5g/gsubr.c
> File src/cmd/5g/gsubr.c (right):
>
>
http://codereview.appspot.com/5966075/diff/30022/src/cmd/5g/gsubr.c#newcode1199
> src/cmd/5g/gsubr.c:1199: bsdvoid
> sorry, why is bsdvoid here?
i have absolutely no idea :-) i was wondering what dave was talkiing about.
it must have been me telling emacs the indent mode and missing a ctrl or a shift
or so.
LGTM. Before, core i5 darwin/amd64 odessa(~/go/test) % time ./run 0 known bugs; 0 unexpected bugs ...
12 years, 11 months ago
(2012-04-19 21:59:34 UTC)
#20
LGTM.
Before, core i5 darwin/amd64
odessa(~/go/test) % time ./run
0 known bugs; 0 unexpected bugs
real 0m46.944s
user 0m32.189s
sys 0m11.451s
After
odessa(~/go/test) % time ./run
0 known bugs; 0 unexpected bugs
real 0m44.288s
user 0m30.566s
sys 0m10.983s
On Sat, Jun 2, 2012 at 11:54 PM, Dave Cheney <dave@cheney.net> wrote: > Sorry, this ...
12 years, 10 months ago
(2012-06-03 03:55:43 UTC)
#25
On Sat, Jun 2, 2012 at 11:54 PM, Dave Cheney <dave@cheney.net> wrote:
> Sorry, this doesn't compile under 5c
Sorry, I meant to fix that - minux pointed it out.
If you s/bsd// is all okay?
Russ
Yup. On Sun, Jun 3, 2012 at 1:55 PM, Russ Cox <rsc@golang.org> wrote: > On ...
12 years, 10 months ago
(2012-06-03 03:56:44 UTC)
#26
Yup.
On Sun, Jun 3, 2012 at 1:55 PM, Russ Cox <rsc@golang.org> wrote:
> On Sat, Jun 2, 2012 at 11:54 PM, Dave Cheney <dave@cheney.net> wrote:
>> Sorry, this doesn't compile under 5c
>
> Sorry, I meant to fix that - minux pointed it out.
> If you s/bsd// is all okay?
>
> Russ
what a nice surprise to find coming back from holiday. thanks! On Sun, Jun 3, ...
12 years, 9 months ago
(2012-06-13 07:50:07 UTC)
#28
what a nice surprise to find coming back from holiday. thanks!
On Sun, Jun 3, 2012 at 5:57 AM, Russ Cox <rsc@golang.org> wrote:
> On Sat, Jun 2, 2012 at 11:56 PM, Dave Cheney <dave@cheney.net> wrote:
> > Yup.
>
> submitted as 6275048.
>
Issue 5966075: code review 5966075: cmd/gc: inline slice[arr,str] in the frontend (mostly).
(Closed)
Created 12 years, 12 months ago by lvd
Modified 12 years, 6 months ago
Reviewers:
Base URL:
Comments: 5