Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2014-05-08

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:17 timotimo couldn't fall asleep just yet, tried to hack up a little prototype
00:17 timotimo this one gets pretty unhappy while compiling nqp.
00:19 timotimo STable conflict detected during deserialization. ← code-gen bugs always lead to funny results >_<
00:28 timotimo i'm seeing some code where a wval + decont gets turned into a wval targeting the register the decont used to target
00:28 timotimo it *seems* correct
00:35 dalek MoarVM/spesh_remove_set_op: be182ce | (Timo Paulssen)++ | src/spesh/facts. (2 files):
00:35 dalek MoarVM/spesh_remove_set_op: if an op writes to its first arg, remember it as the assigner.
00:35 dalek MoarVM/spesh_remove_set_op: review: https://github.com/MoarVM/MoarVM/commit/be182ce6ef
00:35 dalek MoarVM/spesh_remove_set_op: db5e8e4 | (Timo Paulssen)++ | src/spesh/optimize.c:
00:35 dalek MoarVM/spesh_remove_set_op: sometimes deconts can turn into nothing instead of a set.
00:35 dalek MoarVM/spesh_remove_set_op: review: https://github.com/MoarVM/MoarVM/commit/db5e8e49a3
00:35 timotimo here's some code for you to try or look at tomorrow; i'll try to get some sleep now. again.
01:18 FROGGS_ joined #moarvm
02:08 jnap joined #moarvm
02:10 jnap1 joined #moarvm
02:26 donaldh joined #moarvm
03:11 jnap joined #moarvm
03:12 jnap1 joined #moarvm
03:13 jnap joined #moarvm
03:23 jnap joined #moarvm
06:24 brrt joined #moarvm
06:55 FROGGS joined #moarvm
07:14 zakharyas joined #moarvm
07:15 brrt gotta love intel x86
07:16 brrt 64 bit operations generate a 64 bit result into the register
07:16 brrt 32 bit operatiosn generate a 32 bit result that is zero extended to 64 bits
07:16 brrt however
07:17 brrt 16 and 8 bit operations generate a 16 / 8 bit result - and do not zero-extend it (i.e. the register is not overwritten)
07:18 FROGGS :/
07:18 brrt so the following sequence: mov64 rax, 0xffff0000 ; mov8 rax, 0xff gives you 0xffff00ff
07:18 FROGGS I guess the had to keep the existing behaviour for 8/16 bit operations?
07:19 brrt i suppose
07:19 brrt no, i rather suppose that back in the 80s when they designed 386, they were just lazy
07:19 FROGGS that's why it is called back*warts*
07:19 brrt or perhaps cheap with transistors
07:20 FROGGS I bet on cheap :o)
07:27 domidumont joined #moarvm
07:41 brrt left #moarvm
07:50 tadzik chaep
07:51 tadzik yesterday I found that since 286 you can't do i << 32
07:51 tadzik because they only have 5 bits for the shift amount
07:51 timotimo m)
07:51 tadzik because performance, they say
07:51 tadzik but it's even sillier now that we have 64 bits
08:00 FROGGS tadzik: I guess we need that to be able to run older programs
10:04 jnthn Wow...I must have been a lot more exhausted than I realized...
10:04 nwc10 good no-longer morning?
10:06 jnthn aye :)
10:26 FROGGS o/
10:28 jnthn Well, I worked 7 hours on Sunday, and felt I might be about to get ill the last 3 days, so probably no bad thing that I got some good rest.
10:30 timotimo oh, yeah
10:30 timotimo resting for $longtime is much better than being sick for $evenlonger
10:33 jnthn aye
10:51 lee__ joined #moarvm
11:02 bonsaikitten joined #moarvm
11:54 tgt joined #moarvm
12:18 flussence joined #moarvm
12:18 _sri joined #moarvm
12:55 LLamaRider joined #moarvm
13:05 jnthn OK, time for some more spesh hacking :)
13:08 jnthn Todays hacking music: new albums from Insomnium and Epica \o/
13:41 jnthn Hmm...deopt of guards is actually tricker than I realized...
13:54 jnthn hm, but mebbe this cute hack works...
13:55 JimmyZ :-)
13:55 btyler joined #moarvm
13:56 jnap joined #moarvm
13:56 jnthn bother, segv
14:00 * masak .oO( a SEGV is C's way to say "I love you, flaws and all" ) :P
14:01 lizmat .oO( I thought it indicated a lack of DWIM? )
14:01 jnthn oh, duh...
14:25 donaldh joined #moarvm
14:36 jnthn wtf
14:36 * jnthn is seeing something really insane happening under the C debugger...
14:37 jnthn It appears to jump from the goto NEXT; into the body of the next op?!
14:37 brrt joined #moarvm
14:38 jnthn ah, not in a debug build, though.
14:39 nwc10 so, something uninitialised? Because under the debug build the C compiler sets everything to 0?
14:41 jnap joined #moarvm
14:42 jnthn nwc10: The behavior externally is the same udner both. I think it's just some mess-up in writing the debug locations file...
14:42 jnthn nwc10: I think it's done a code-size opt and then written a debug file that reveals what it did.
14:42 jnthn Just looked every confusing.
15:10 dalek MoarVM/spesh_trace: 3810ab3 | jnthn++ | src/spesh/dump.c:
15:10 dalek MoarVM/spesh_trace: Fix dumping of deopt annotations.
15:10 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/3810ab3bf4
15:10 dalek MoarVM/spesh_trace: 1d69712 | jnthn++ | src/spesh/facts.c:
15:10 dalek MoarVM/spesh_trace: Read correct log entries.
15:10 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/1d69712ba0
15:23 brrt left #moarvm
15:27 vendethiel joined #moarvm
15:53 dalek MoarVM/spesh_trace: e7ac215 | jnthn++ | / (4 files):
15:53 dalek MoarVM/spesh_trace: Break out different kinds of de-opt point.
15:53 dalek MoarVM/spesh_trace:
15:53 dalek MoarVM/spesh_trace: Can have "current frame only" for failed guards, and "all" for when
15:53 dalek MoarVM/spesh_trace: mixins happen that may invalidate many assumptions.
15:53 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/e7ac21556a
15:53 dalek MoarVM/spesh_trace: 905d410 | jnthn++ | src/spesh/ (4 files):
15:53 dalek MoarVM/spesh_trace: Record deopt annotations per deopt kind.
15:53 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/905d41088c
16:34 dalek MoarVM/spesh_trace: 5de47f6 | jnthn++ | src/spesh/log.c:
16:34 dalek MoarVM/spesh_trace: Migrate deopt-1 annotations to sp_logs.
16:34 dalek MoarVM/spesh_trace:
16:34 dalek MoarVM/spesh_trace: The log will be replaced with the guard, which is what will trigger
16:34 dalek MoarVM/spesh_trace: deopt.
16:34 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/5de47f68d3
16:34 dalek MoarVM/spesh_trace: 0c4324b | jnthn++ | src/ (3 files):
16:34 dalek MoarVM/spesh_trace: Implement all vs. one deopt.
16:34 dalek MoarVM/spesh_trace:
16:34 dalek MoarVM/spesh_trace: Also fixes a bug in looping over the deopt table, so we don't fail to
16:34 dalek MoarVM/spesh_trace: de-optimize half the time.
16:34 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/0c4324bbfd
16:36 domidumont joined #moarvm
16:38 FROGGS joined #moarvm
16:40 domidumont joined #moarvm
16:51 dalek MoarVM/spesh_trace: d1b551f | jnthn++ | src/spesh/manipulate.c:
16:51 dalek MoarVM/spesh_trace: Fix moving of handler annotations.
16:51 dalek MoarVM/spesh_trace:
16:51 dalek MoarVM/spesh_trace: We accidentally dropped some of them, leading code-gen to fail.
16:51 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/d1b551f1a5
16:51 dalek MoarVM/spesh_trace: 6aa4a3a | jnthn++ | src/spesh/facts.c:
16:51 dalek MoarVM/spesh_trace: Don't log -> guard things we needn't guard.
16:51 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/6aa4a3a6dc
17:22 zakharyas joined #moarvm
17:23 dalek MoarVM/spesh_trace: 3ff9edd | jnthn++ | src/spesh/optimize.c:
17:23 dalek MoarVM/spesh_trace: Delete any leftover log instructions in optimize.
17:23 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/3ff9edd74e
18:19 timo joined #moarvm
18:22 jnthn With latest work, spesh seems to give a 10% win on "my @a; my $i = 0; while (++$i <= 1000000) { @a[ $i ] = $i }"
18:26 FROGGS ohh!
18:26 FROGGS jnthn+++
18:28 nwc10 nice
18:28 timotimo oh, neat. where does it come from?
18:28 * timotimo fell off the 'net for a bit :(
18:30 timotimo ah, i saw it in the clogs
18:30 jnthn timotimo: I suspect at the moment avoiding method dispatches by resolving them, and avoiding type checks
18:31 timotimo did you have a chance to look at my not quite working set-removal-thingie?
18:31 jnthn Not yet, but will after dinner
18:31 timotimo cool :)
18:32 jnthn Figured I'll take the above benchmark as an example and work through getting spesh to do nice things for it.
18:32 btyler jnthn: perhaps my build is borked, but when I switch to spesh_trace and Configure.pl/make install, perl6 -e 'say "hi"' dies with a moar error: 'Unknown flag --execname=(path to perl6 bin)'
18:32 btyler switching back to master and Configuring/building everything is a-ok
18:33 FROGGS execname is new
18:33 jnthn btyler: spesh_trace is missing patches from master
18:33 btyler oh ok, gotcha
18:33 btyler I'll wait then :)
18:33 jnthn It may also explode in the NQP build. It's a branch for a reason ;)
18:33 btyler for sure, I just figured I'd take a poke and see if the win was visible here as well
18:34 jnthn :)
18:35 lee__ mine does explode when building nqp/rakudo if i pass --optimize=3 to spesh_trace
18:35 lee__ works fine if i don't, though
18:38 lee__ (sorry if that is annoying, just excited about fast perl6 :)
19:06 timotimo is that the optimize flag for rakudo or for configure.pl?
19:27 lee__ for Configure.pl on MoarVM
19:37 timotimo ah
19:38 timotimo i've never been able to use more than --optimize=1
19:38 timotimo without b0rking the build during nqp
19:45 nwc10 jnthn: seems that >99% of the values loaded by GET_I64() would fit in 16 bits
19:45 jnthn nwc10: Yeah; I'd figured that'd be an easy opt some day :)
19:46 nwc10 and 0% are >32 bit
19:46 jnthn Good to know. It'll be worthwhile then :)
19:46 nwc10 also, there are about 3 opcodes where the value read is I64, but it's immediately cast to 32 bits
19:46 nwc10 for those ones, why is it even 64 bits in the opcode stream?
19:47 nwc10 for the others, do they need to keep 64 bit variants?
19:47 jnthn Which ops, ooc?
19:47 nwc10 I was sort of assuming that the ops get 2 more variants, with 16 and 32
19:47 nwc10 throwcatdyn, throwcatlex, throwcatlexotic
19:48 jnthn oh, hm
19:48 nwc10 no urgency
19:48 jnthn aye
19:48 jnthn Those are not common ops
19:48 jnthn iconst_64 is, though
19:49 nwc10 my assumption was (not checked this yet) that the bytecode generating code in C would substitute the smallest opcode variant that could hold the value
19:49 nwc10 rather than have the MAST generator do it
19:49 nwc10 or is that conceptually wrong?
19:50 jnthn I think the having the bytecode gen do it sounds sane enough
19:51 nwc10 argconst_i seems to be unused currently
19:59 domidumont joined #moarvm
20:28 domidumont joined #moarvm
21:27 jnthn aha...
21:27 jnthn Turns out we really wanted a fixed point analysis on killing dead instructions.
21:28 jnthn Relying on revserse domaince tree ordering to catch enough didn't catch enough. :)
21:34 dalek MoarVM/spesh_trace: f72aefb | jnthn++ | src/core/interp.c:
21:34 dalek MoarVM/spesh_trace: Fix guard clause checks.
21:34 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/f72aefb451
21:34 dalek MoarVM/spesh_trace: f4d2c85 | jnthn++ | src/spesh/dump.c:
21:34 dalek MoarVM/spesh_trace: Basic dumping of facts.
21:34 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/f4d2c85463
21:34 dalek MoarVM/spesh_trace: 755fb71 | jnthn++ | src/spesh/facts.c:
21:34 dalek MoarVM/spesh_trace: Use guard ops involving container checks.
21:34 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/755fb719dc
21:37 jnthn The local patch I have to do that produces much better code. Sadly, it also seems to lose handlers...
21:42 FROGGS /o\
21:42 FROGGS do we need 'em?
21:42 jnthn yes.
21:43 jnthn Otherwise we dont' know what region exception handlers cover in the specialized bytecode.
21:43 FROGGS bah, optimize it out :o)
21:43 jnthn oh dammit
21:43 jnthn Typically the one it chokes on has a HUGE graph
21:43 jnthn (EXPR)
21:44 FROGGS hehe, I tend to keep a distance between EXPR and me :o)
21:46 jnthn It has 127 basic blocks
22:03 jnthn oh...
22:09 dalek MoarVM/spesh_trace: 21689f4 | jnthn++ | src/spesh/codegen.c:
22:09 dalek MoarVM/spesh_trace: Cope with annotations being moved to a phi.
22:09 dalek MoarVM/spesh_trace:
22:09 dalek MoarVM/spesh_trace: Before, the code-gen ignored them completely, which meant we could end
22:09 dalek MoarVM/spesh_trace: up losing them. This resolves that issue. While annotations may never
22:09 dalek MoarVM/spesh_trace: start on a phi, they may be moved there by other optimizations.
22:09 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/21689f4cb4
22:14 timotimo yay things
22:16 timotimo jnthn: got a clue what'd help you figure out big graphs like that?
22:16 timotimo the pypy people have a block explorer thingie built on top of graphviz and/or sdl i think
22:18 jnthn timotimo: Well, the problem here wasn't visualizing it really
22:18 timotimo fair enough
22:19 jnthn timotimo: It was more finding the end handlers
22:19 jnthn And seeing what on earth was going on.
22:19 timotimo OK
22:19 jnthn now we....manage to get a stack overflow. d'oh.
22:20 timotimo i didn't know we even had those :)
22:20 jnthn A C-level one! o.O
22:20 timotimo well, that ought to be an infinite recursion
22:20 timotimo couldn't explain it any other way
22:21 jnthn yeah, it is
22:21 jnthn but wtf :)
22:21 jnthn oh...
22:23 jnthn oh, I can guess...
22:30 jnthn yeah, got it...
22:30 timotimo yey
22:35 dalek MoarVM/spesh_trace: c1065ae | jnthn++ | src/spesh/facts.c:
22:35 dalek MoarVM/spesh_trace: Make sure we don't clobber block handler setting.
22:35 dalek MoarVM/spesh_trace:
22:35 dalek MoarVM/spesh_trace: Block exception handlers live in a register. We must be careful not to
22:35 dalek MoarVM/spesh_trace: clobber the set instruction, assuming its result is unused. This is
22:35 dalek MoarVM/spesh_trace: handled by bumping the usage count on such registers in the facts.
22:35 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/c1065ae609
22:39 jnthn Unfortunately, various things in NQP/Rakudo build blow up on spesh_trace
22:39 jnthn Missing block at line 425, near "-> @values"
22:39 timotimo oh, meh
22:40 jnthn I thought at first it was due to my improved instruction death
22:40 jnthn But it's not; it's something else I've done earlier, I guess.
22:40 timotimo mhh
22:40 timotimo if you need a break from hard stuff, try having a look at my branch? :P
22:48 dalek MoarVM/spesh_trace: f38c767 | jnthn++ | src/spesh/optimize.c:
22:48 dalek MoarVM/spesh_trace: Typo fix.
22:48 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/f38c767a80
22:48 dalek MoarVM/spesh_trace: 0d353ce | jnthn++ | src/spesh/optimize.c:
22:48 dalek MoarVM/spesh_trace: Iterate to fixed point when finding unused instrs.
22:48 dalek MoarVM/spesh_trace:
22:48 dalek MoarVM/spesh_trace: Before we just did a backwards propagation as we went back up the
22:49 dalek MoarVM/spesh_trace: dominator tree. But that didn't catch enough. Switch to just keeping
22:49 dalek MoarVM/spesh_trace: iterating doing removals until we're done. May be more optimal ways
22:49 dalek MoarVM/spesh_trace: to walk BBs in order to speed up convergence. Either way, the results
22:49 dalek MoarVM/spesh_trace: with doing the analysis this way are better.
22:49 dalek MoarVM/spesh_trace: review: https://github.com/MoarVM/MoarVM/commit/0d353cebcb
23:03 timotimo jnthn: can that patch easily be cherry-picked to master?
23:05 jnthn timotimo: I'd rather not, given the branch is intended to be merged to master
23:06 jnthn And I'm aiming to do that at the weekend.
23:06 jnthn So it's not long to wait.
23:06 timotimo all right :)
23:06 timotimo how much better are we talking here?
23:07 jnthn Well, not sure yet
23:08 jnthn I haven't actually done the big opt that this was all in aid of yet.
23:08 jnthn (Which is using spesh type knowledge to resolve multi-dispatches.)
23:09 timotimo oooooh
23:09 jnthn Which of course is a pre-req for any useful inlining in Perl 6 code, but that'll be a separate, later thing.
23:09 timotimo righto
23:09 timotimo how much cheaper will that be than hitting the caches
23:09 timotimo ?
23:10 jnthn Well, it means you just grab the invokee out of a spesh slot and invoke it
23:10 jnthn So, cheap
23:10 timotimo we really ought to profile some time :\
23:11 jnthn Well, that's partly what led me to look into this. I could see that we were spending a lot of time in the multi-dispatch cache in some of the benchmarks.
23:11 jnthn We're spending even more on invocation, though, which inlining can help with.
23:14 timotimo ah. well, that does sound good then :)
23:14 timotimo continue :)
23:16 jnthn My overall path here is spesh time dispatch resolution in 2014.05, inlining in 2014.06, escape analysis in 2014.07, and on-stack-replacement by 2014.08 (though if it's easy it may happen sooner)
23:16 jnthn And to give a talk on performance stuff at YAPC::EU :)
23:17 jnthn Of course, I need to co-ordinate this with brrt so it fits well with the JIT work.
23:18 jnthn I'll also this weekend put an opt into Rakudo that tries to avoid creating the %_ if we can see it's not used.
23:19 jnthn Then just let spesh take out the creation of the low-level hash.
23:19 timotimo righto
23:20 jnthn Anyway, I need some rest :)
23:20 jnthn 'night
23:21 timotimo gnite jnthn!
23:31 timo joined #moarvm
23:32 timo1 joined #moarvm
23:35 timo1 joined #moarvm

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary