github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
02:08 lizmat joined
Geth MoarVM: f3fe061c36 | (Samantha McVey)++ | docs/ChangeLog
Add draft ChangeLog for 2018.06
02:49
samcv posting draft changelog. anything with a ? in front of the line (mostly JIT and Spesh sections) i haven't fully looked at
if anyone wants to look at it. brrt and timotimo maybe :)
03:50 tbrowder_ left 03:51 chansen_ left, SmokeMachine left 05:33 chansen_ joined 05:36 SmokeMachine joined 05:57 chansen_ left 05:58 SmokeMachine left 06:15 domidumont joined 06:21 domidumont left, tbrowder_ joined, domidumont joined, chansen_ joined, SmokeMachine joined, chansen_ left, chansen_ joined 06:22 SmokeMachine left, SmokeMachine joined 06:24 nine joined 06:50 robertle joined 06:59 domidumont left 07:16 domidumont joined 07:56 zakharyas joined
Geth MoarVM: eb2f5a72bb | (Bart Wiegmans)++ | docs/ChangeLog
Improve JIT Changelog a bit

Many intermediate commits rolled into one merge
07:58
07:58 brrt joined
brrt \o 07:59
08:11 zakharyas left 08:12 zakharyas joined 08:23 yoleaux joined
samcv brrt++ 08:56
09:03 zakharyas left 09:04 zakharyas joined
brrt :-) 09:32
jnthn morning o/ 09:40
09:44 brrt left 09:46 brrt joined 09:54 brrt left 10:03 domidumont left 10:04 zakharyas left 10:10 zakharyas joined 10:48 releasable6 left 10:49 releasable6 joined 10:59 zakharyas left 11:06 brrt joined 11:30 AlexDaniel joined 11:51 domidumont joined
timotimo i'd say the "stub the spesh plugin ops" change is another one of the in-between changes, i.e. they are properly implemented now; at least those used in the existing spesh plugins are 12:03
maybe we want to actually roll most of the spesh plugin changes into an entry with two or three lines briefly explaining what they are and what they add 12:06
12:09 zakharyas joined
brrt yes 12:22
12:33 raschipi joined 13:12 zakharyas left
Geth MoarVM: a4f8ce3927 | (Bart Wiegmans)++ | 2 files
[JIT] pow_i in assembly

Why call out when you can code it :-)
13:13
13:14 zakharyas joined
AlexDaniel brrt: is that supposed to go into the release? ā†‘ 13:30
brrt why not :-) 13:35
it's just a small fragment though 13:36
and i'm decently sure it's correct
AlexDaniel famous last words
brrt :-D 13:37
to be honest, assembly is the only language in which I'd dare to say that with any confidence
in past times that would've included C, but what with aliasing rules...
timotimo Latest guard tree for 'BUILDALL' (cuid: 31, file: gen/moar/stage2/NQPCORE.setting:521) 13:38
0: CALLSITE (nil) | Y: 1, N: 0
that doesn't look right? what's a null pointer doing there?
13:39 zakharyas left
robertle brrt: in no way criticising, I am not an x86 assembly person, but do you think that is significantly different from what the compiler would do? just out of curiosity... 13:39
timotimo it may not be different, but we'd otherwise have had a call there
and inlining such a small piece of code is likely worth something 13:40
13:40 zakharyas joined
robertle ah, that makes a lot of sense! so it's not so much the move to assembly, but the inlining that matters 13:40
timotimo yup
brrt indeed 13:41
timotimo also, of course, we should have special implementations for when one of the two arguments is compile-time known
brrt yeah
i leave that to you timotimo :-P
timotimo hah
i'll ask if i need assembler help again
brrt i googled and apparently this is the most efficient algorithm
and also rather ancient 13:42
raschipi Biggest lie ever told in IT: "calls are cheap".
timotimo probably usually with a "if you have an inlining-capable compiler" elided for brevity 13:43
brrt then again, calls are necessry (how are you supposed to put any structure in your program otherwise?) 13:44
robertle gotos of course!
lots of them!
brrt it's goto all the way down :-) 13:45
timotimo arithmetic on the instruction pointer
brrt thing is, call+return *are* goto, just with a stack intermediate
can't do that. or, to put it in another way, that's what goto *is*
timotimo and of course handling register saving 13:46
robertle and lots of pushed and pos
pushes and pops that is, as timotimo said
raschipi Saving and restoring regirsters and spilling to the stack is what's expensive. So got and call are not the same thing.
And if you're talking x86, even more so, because there are so few registers, everything goes in the stack. 13:47
timotimo yeah, thankfully we only jit on x86_64 13:48
for that very reason
AlexDaniel samcv: fwiw please consider reverting the last commit ( cuz I trust all the testing that I do and don't really trust humans :P )
samcv: for the release I mean
:P
raschipi "arithmetic on the instruction pointer" lmao 13:49
brrt well, thanks ;-) 13:53
timotimo raschipi: it's worthwhile to check if the IP is prime
for performance reasons
i think th reason why the indices are "always" 5 is that that's exactly how many guards an assign spesh plugin has 13:54
and i suppose having a 1 there means that the first guard failed, perhaps? or the first one is a "set fallback result" and that's what gets used? 13:55
raschipi Well, calling between assembler can hand roll it's own calling convention and can be as cheap as a goto, calling into a C function or between them is what's expensive. 13:57
timotimo you could say that every BB is basically a function and going between them is like having a custom calling convention 14:00
does that make sense? ... barely.
raschipi What's a BB? 14:01
timotimo basic block 14:03
basically "any linear piece of code that can't jump anywhere else, and can't be jumped into except at the beginning"
usually makes the most sense for IRs and assembly language 14:04
raschipi I know the concept, I just didn't hear the initialism before. 14:05
timotimo ah
if you're into that topic all the time, it gets much more obvious to think of it with that acronym 14:06
japhb The worst piece of Perl code I was ever asked to maintain was written by a first-time Perl programmer whose previous only known language was an assembly language (I suspect for early embedded processors, but I don't know for sure). It was a gigantic single file, many thousands of lines, *not a single sub*. All control flow was by setting global variables and then goto LABEL. 14:15
timotimo wee
raschipi That's not normal even for people that are used to program in assembly... 14:17
timotimo if assembly was their first, it doesn't seem so unlikely to me
japhb Especially the really early embedded CPUs, where call/ret may be very expensive and/or you may have very little stack available, so conserve it obsessively. 14:19
raschipi Yeah, not unlikely.
Very little memory, most likely, can't spend it on a stack. 14:21
14:31 brrt left 14:34 domidumont1 joined 14:37 domidumont left 15:05 zakharyas left
Geth MoarVM: 6fb5277e27 | (Jonathan Worthington)++ | 3 files
JIT some recently added guard ops
15:05
15:06 zakharyas joined
jnthn samcv: fwiw, it's probably best to make a branch prior to the commits brrt and I just did for the purpose of the release, then merge it back after the release 15:06
Pretty sure brrt's assembly is right, and that my patch is OK too, but not worth the risk. 15:07
15:08 zakharyas left 15:10 zakharyas joined
timotimo those guard ops only show up if you have a rescalar rakudo, right? 15:11
15:11 zakharyas left 15:12 zakharyas joined
jnthn For assignments, yes :) 15:12
15:12 zakharyas left 15:13 zakharyas joined
timotimo any objections to me trying the "don't insert unnecessary guard" thing? 15:13
15:13 zakharyas left
jnthn Not really; it should just be a case of checking facts and not emitting the guard instructions 15:14
15:17 robertle left, domidumont1 left 15:23 travis-ci joined
travis-ci MoarVM build failed. Jonathan Worthington 'JIT some recently added guard ops' 15:23
travis-ci.org/MoarVM/MoarVM/builds/394605813 github.com/MoarVM/MoarVM/compare/a...b5277e27a4
15:23 travis-ci left
timotimo hm, throughout nqp's t/moar/52-pluggable-spesh.t it only discards a single guard_conc. i wonder if that's right. 15:29
jnthn Hmmm
I'd very much doubt it will discard much in those tests 15:30
timotimo OK, then i need to run something else j)
jnthn They were written to exercise the inserted guards
Darn, my JIT additions are wrong somehow
timotimo oh, i expect the type stored in the guard is an STable whereas the type stored in spesh facts is the type object, can that be? 15:32
that'd explain why the type check wouldn't be elided
yup, that was it 15:33
stresstest has only a few problems with "can't assign to readonly variable" or "name of variable isn't available in this spot"; i think that's what you already found, and you called those tests either wrong or overly specific? 15:40
jnthn Didn't stresstest yet, but 3 spectsets fail due to Proxy rw-related issues and yes, the error 15:41
timotimo i couldn't keep the "how many guards were elided" fprint to stderr because tests that check for stderr in other processes don't expect that
15:43 zakharyas joined
timotimo gist.github.com/timo/ad452aeb3dead...6c26892b3e - i get these failures with my changes 15:44
jnthn oh, my t/spec/S32-exceptions/misc.rakudo.moar is clean I think
Hard to check right now as I've other patches I'm half way through doing :) 15:45
timotimo let's see
aha i had an extra test in there 15:47
jnthn D'oh, think I know what I did wrong :)
(with the JIT)
timotimo without the corresponding change in rakudo, the test was wrong, and also i had forgotten to bump the plan as well
jnthn grr, well, "a thing" 15:48
Geth MoarVM: c14094afef | (Jonathan Worthington)++ | src/jit/x64/emit.dasc
Don't read an operand that doesn't exist
15:49
timotimo oooh 15:50
shall i push the "elide guards" change to a branch? or will we make a release branch off of an earlier commit anyway? 15:51
jnthn ah, duh, I see the other one too :)
I think release off an earlier commit 15:52
timotimo understood. i will push to master, then?
Geth MoarVM: 39b7b3303a | (Jonathan Worthington)++ | src/jit/graph.c
Find deopt target correctly in JIT for new guards

Some of them have 2 operands, not 3.
15:53
jnthn timotimo: Can do
That cleans up the Travis failure
Geth MoarVM: ca98311165 | (Timo Paulssen)++ | src/spesh/plugin.c
elide spesh plugin guards that are superfluous

based on what facts we've already established before.
15:54 robertle joined
timotimo i'm not 100% sure if get_and_use_facts up there should be replaced by only doing use_facts if the "if" branch was not taken 15:54
jnthn MVMSpeshFacts *guarded_facts = MVM_spesh_get_and_use_facts(tc, g, arg_regs[guard->test_idx]); 15:59
That can buffer overflow
oh, wait, not it can't, I think :)
raschipi Famous last words 16:00
jnthn Yeah, we grow arg_regs :)
So it's fine :)
I think get_and_use_facts is right 16:01
Hmm
16:01 brrt joined
jnthn But yeah, maybe we should only do it if the branch isn't taken 16:01
16:01 zakharyas left
jnthn Because what if there is an unrelated fact that we don't care for 16:01
timotimo aye
jnthn So it'd be better to only do it in an else
timotimo i'll impl that
jnthn But otherwise I think it's right 16:02
Geth MoarVM: 64a30fe4a4 | (Timo Paulssen)++ | src/spesh/plugin.c
only mark facts as used if they helped us

otherwise we might accidentally keep guards alive that are neither used by anything else nor actually interesting to us here.
16:04
16:04 domidumont joined 16:08 travis-ci joined
travis-ci MoarVM build failed. Jonathan Worthington 'Don't read an operand that doesn't exist' 16:09
travis-ci.org/MoarVM/MoarVM/builds/394625636 github.com/MoarVM/MoarVM/compare/6...4094afef4a
16:09 travis-ci left 16:18 zakharyas joined 16:34 travis-ci joined
travis-ci MoarVM build passed. Timo Paulssen 'only mark facts as used if they helped us 16:34
travis-ci.org/MoarVM/MoarVM/builds/394631734 github.com/MoarVM/MoarVM/compare/c...a30fe4a47c
16:34 travis-ci left 16:40 brrt left
timotimo i fixed it! :P 16:41
jnthn :P 16:42
jnthn looks at some of the code we're producing and sees there's gonna be some re-turning and stuff to do as a result of rescalar 16:52
(Which ain't all that surprising :)
timotimo higher inline limit because things got bigger?
bigger but not costlier
jnthn Yeah, though also we're doing a poor job on some other things extops replaced too, it seems 16:53
Costlier - well, maybe they have in some senses too, in that C cheating and reading stuff directly from the P6opaque is not the same as a getattr which has more checks to do at the moment
Though certainly waaay more explicit 16:54
So we actually have some hope of usefully doing escape analysis on Scalar once we get that in
(Because accesses just are attribute get and bind now)
timotimo if we have a scalarfromdesc right before an new-style assign, we should also be able to not guard that at all 16:55
if the descriptor is known, which i expect it will be
well, not always
jnthn Yeah, I'll take a good look through all these things in a bit. Just keen to get it to work at all first :) 16:56
timotimo aye 16:57
jnthn Though looking at the spectest so far and the spesh output, it seems it essentially is 16:59
17:01 zakharyas left, zakharyas joined
timotimo "is working at all" you mean? 17:02
jnthn Yes
It's inlining the specialized forms that the plugin chose
And picking those forms appropriately 17:04
17:06 domidumont left 17:10 zakharyas left 17:11 zakharyas joined 17:13 zakharyas left 17:18 zakharyas joined
timotimo nice. 17:19
jnthn Enough for now, bbl 17:20
17:33 domidumont joined 17:48 ggoebel left 18:01 zakharyas left 18:05 ggoebel joined 18:19 ggoebel left 18:35 ggoebel joined 18:48 brrt joined, brrt left 19:10 domidumont left 19:14 lizmat left 19:23 lizmat joined 20:37 robertle left 21:00 lizmat left 21:16 raschipi left 21:29 lizmat joined
Geth MoarVM/jit-expr-refactor: 5 commits pushed by (Bart Wiegmans)++ 21:58
22:09 MasterDuke joined 22:22 Kaiepi joined 22:26 MasterDuke left 23:07 MasterDuke joined
samcv timotimo: can you help condense the changelog section for Spesh to remove things that haven't changed fro last version? 23:17
jnthn I can help with the spesh plugins bit at least... 23:18
samcv ok cool :)
once that section is done i'll finallize it and move for release
jnthn Where's the ChangeLog? In the repo, or wiki? 23:19
samcv repo
Geth MoarVM: 4e7409a297 | (Jonathan Worthington)++ | docs/ChangeLog
Describe spesh plugin mechanism in ChangeLog

All the spesh changes were part of implementing that.
23:26
jnthn Hope that helps :)
Geth MoarVM: 621e51a15e | timo++ (committed using GitHub Web editor) | docs/ChangeLog
Just tiny rewordings of two points

one question mark remains
23:34
23:52 lizmat left 23:56 TimToady joined