Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2014-04-01

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

All times shown according to UTC.

Time Nick Message
00:01 lizmat joined #moarvm
01:19 woosley joined #moarvm
01:29 jnap joined #moarvm
01:30 FROGGS_ joined #moarvm
01:47 ilbot3 joined #moarvm
01:47 Topic for #moarvm is now https://github.com/moarvm/moarvm | IRC logs at  http://irclog.perlgeek.de/moarvm/today
02:20 btyler joined #moarvm
02:30 jnap joined #moarvm
02:56 benabik joined #moarvm
03:31 jnap joined #moarvm
04:32 jnap joined #moarvm
05:33 jnap joined #moarvm
06:23 woolfy1 joined #moarvm
06:33 jnap joined #moarvm
07:06 zakharyas joined #moarvm
07:20 brrt joined #moarvm
07:29 FROGGS_ joined #moarvm
07:34 jnap joined #moarvm
08:35 jnap joined #moarvm
09:07 * jnthn makes coffee and digs into some coding
09:11 brrt morning
09:12 JimmyZ morning
09:13 lizmat joined #moarvm
09:16 jnthn o/
09:17 moritz \o
09:18 yawnt o/
09:23 FROGGS_ \o
09:23 nwc10 o/
09:35 TimToady \o
09:36 jnap joined #moarvm
09:37 lizmat joined #moarvm
10:02 woolfy joined #moarvm
10:17 masak o/
10:18 woosley left #moarvm
10:20 woolfy left #moarvm
10:36 jnap joined #moarvm
11:37 jnap joined #moarvm
11:50 FROGGS_ joined #moarvm
12:17 colomon joined #moarvm
12:38 jnap joined #moarvm
13:02 dalek Heuristic branch merge: pushed 38 commits to MoarVM/spesh by jnthn
13:07 brrt joined #moarvm
13:11 jnthn So, what I just pushed to the spesh branch is the work I've been doing to build a framework for optimization. It knows how to turn MoarVM bytecode into a CFG in SSA form, turn that back into bytecode, and can do a few very simple optimizations so far.
13:11 jnthn It currently has a crack at anything that is called at least 10 times.
13:11 nwc10 \o/
13:11 nwc10 I think
13:12 jnthn It likely won't make much difference *yet* because it's doing a lot of analysis and then barely using it so far.
13:13 jnthn It is smart enough to remove a hash lookups for most method dispatches in any hot-path code.
13:13 jnthn s/a//
13:14 jnthn And can do some check tossing on parameter handling.
13:14 nwc10 OK, this optimises bytecode. So it's completely independant of any optimisation the compiler does?
13:14 nwc10 (stupid question, but follows up with)
13:14 jnthn Right, different levels.
13:15 nwc10 what sorts of optimisations exist that can be done at runtime, but not at compile time?
13:15 jnthn Anything based on knowing what types things have at runtime.
13:15 jnthn Which can't be inferred statically.
13:16 jnthn Also things you can't convey over the bytecode boundary to the satisfaction of "proof", or things that aren't safe to assume until post-"link".
13:17 nwc10 ah OK. The former is stuff that it has to be ready to undo at runtime if types change. The latter is not things that I would have thought of.
13:18 jnthn Later things include escape analysis (which goes on beneath the API of the VM).
13:18 jnthn And inlinings we can't figure out at compile time, due to insufficient info.
13:20 jnthn Also, the graph it builds up to do this should be useful for JIT work.
13:24 jnap joined #moarvm
13:25 JimmyZ does it mean parts can be aslo done at compile time if we have types things?
13:26 jnthn JimmyZ: Yes, that's what the inlining stuff in Rakudo's Optimizer.pm is doing.
13:26 jnthn uh. Optimizer.nqp
13:27 JimmyZ Nice!
13:27 nwc10 my sort-of-implied question is, can't that also be done on the AST? Or at least, earlier than the bytecode?
13:27 jnthn nwc10: The bytecode is what you have at runtime.
13:28 jnthn nwc10: And QAST trees are OK for some kinds of optimization, but hardly suited to all analyses.
13:28 nwc10 yes, I more meant, "inlining stuff in optimiser" - it did seem that some of the things could also be done at compile time
13:29 nwc10 I was asuming that only the bytecode was present at runtime. Else you'd have to trust that a supplied AST was truthfully the same as the bytecode.
13:29 jnthn my int $a = 1; my int $b = 2; say $a + $b; # the infix:<+> here is already inlined at compile time.
13:29 nwc10 which seems, um, less than secure
13:29 jnthn Yes, the VM shouldn't trust the bytecode too much either :)
13:30 jnthn And that compile-time inline I showed above happens on the AST.
13:31 jnthn It's worth noting also that C# and Java compilers do comparatively little optimization work, and leave the JVM/CLR to do the heavy lifting.
13:32 jnthn I believe they do *no* inlining, for example.
13:33 nwc10 the assumption is that there's a JIT, and the JIT gets it all?
13:33 jnthn Right
13:46 btyler joined #moarvm
13:55 cognominal joined #moarvm
14:14 dalek MoarVM/spesh: e7ed01e | jnthn++ | src/spesh/args.c:
14:14 dalek MoarVM/spesh: Fix off-by-one in args optimization.
14:14 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/e7ed01e91c
14:14 dalek MoarVM/spesh: 5d311de | jnthn++ | src/ (4 files):
14:14 dalek MoarVM/spesh: If MVM_SPESH_LOG is in env, log spesh work to it.
14:14 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/5d311dea1d
14:36 brrt wait wait
14:36 brrt i missed the conversation
14:39 jnthn There's lacklog :)
14:39 jnthn uh, bcklog
14:39 jnthn ...yeah, I can type.
14:43 brrt seeing backlog
14:46 JimmyZ jnthn: I havea stupid question: Why does only effective_spesh_slots in tc->cur_frame need lock...
14:47 jnthn JimmyZ: Because it's not thread local
14:47 jnthn JimmyZ: It's a global cache
14:47 jnthn The lock prevents us racing to write into it.
14:48 timotimo ooooh spesh
14:48 jnthn Just about everything on cur_frame is thread local or immutable.
14:48 timotimo can you recommend something specific for me to look at?
14:48 timotimo to perhaps come up with cool new stuff?
14:49 JimmyZ the pdf?
14:49 timotimo you mentioned something about strength reduction
14:49 timotimo there's a pdf?
14:49 woolfy joined #moarvm
14:49 jnthn There's a PDF? :D
14:49 JimmyZ yes, two
14:49 jnthn Oh...those two :)
14:49 timotimo well, i kind of know about SSA, i don't know much about CFG except i have a basic idea how you would make one
14:50 jnthn timotimo: Well, to start with I suggest reading/comprehending spesh/graph.h.
14:50 jnthn That's *the* data structure
14:50 jnthn spesh/facts.h is also important
14:51 timotimo thanks :)
14:51 timotimo ooh this is exciting :3
14:52 timotimo any easy optimization opportunity you've left out so far due to lack of time? something i could use as a way to get to know the system?
14:53 brrt what timotimo said :-)
14:53 jnthn timotimo: Oh, there's almost no optimizations implemented yet.
14:53 jnthn The work has all been building analysis.
14:53 jnthn And then just a few opts.
14:54 cognominal I know what is a SSA but not a CFG :(
14:54 brrt control flow graph
14:54 cognominal ho
14:54 brrt i had to google / ask :-)
14:54 jnthn cognominal: Just a graph of the basic blocks and how flow goes between them.
14:54 cognominal I should have guesse
14:54 jnthn cognominal: Like a conditional can branch two ways.
14:54 brrt could've been many things
14:54 cognominal I did not know the acronym
14:54 jnthn Basically, every basic block has a few relations to others in the graph
14:55 brrt i should spend some time, too, to get to know it
14:55 jnthn It's predecessors, successors, and (dominance) children
14:55 brrt is the CFG parralel to the SSA?
14:55 cognominal good slides about the subject :  http://www.cs.utexas.edu/~pingali/CS380C/2013/lectures/ssa-slides.pdf
14:55 timotimo brrt: the CFG is a bunch of blocks, each of the blocks is instructions in SSA
14:55 brrt ah… i see
14:55 timotimo is my understanding
14:55 brrt yes
14:56 jnthn brrt: Well, that's a curious way to put it...
14:56 jnthn brrt: You need a CFG before you can compute SSA
14:56 brrt … yes
14:56 brrt :-)
14:56 brrt exciting stuff
14:56 jnthn timotimo: Well, except that things have lifetimes longer than blocks so you have to insert phi functions to cope with that.
14:58 dalek MoarVM/spesh: fb0f63c | jnthn++ | src/spesh/optimize.c:
14:58 dalek MoarVM/spesh: Turn known-unrequired decont into set.
14:58 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/fb0f63c006
14:58 dalek MoarVM/spesh: cec2a2b | jnthn++ | src/ (3 files):
14:58 dalek MoarVM/spesh: Make MVM_SPESH_DISABLE env var disable spesh.
14:58 dalek MoarVM/spesh:
14:58 dalek MoarVM/spesh: For debugging, or easily trying with/without it. Note that it's about
14:58 dalek MoarVM/spesh: if the envvar is defined/non-empty; it doesn't care for the value.
14:58 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/cec2a2b741
14:58 jnthn If you define MVM_SPESH_LOG=somefile and then run some NQP or Perl 6 program, it will dump *loads* of info.
14:58 timotimo jnthn: ah, so that's the magical phi instruction
14:59 timotimo jnthn: should i see if i can parse the log and create a graphviz visualization or something?
15:00 jnthn timotimo: that would be cute, though probably one of the other nice things to do is to take the before/after output and produce/show diffs.
15:00 jnthn timotimo: So you can easily see what changed.
15:00 timotimo i assume you'll allow me to change the output of the log to make it easy to parse?
15:00 jnthn So long as it's still easy to diff
15:00 jnthn It's already quite structured
15:01 jnthn However, there's a bunch of <nyi>
15:01 jnthn Where it doesn't know how to dump certain things
15:01 timotimo src/spesh/manipulate.h:1:1: warning: data definition has no type or storage class [enabled by default]
15:01 timotimo i get this a bazillion times during compilation
15:01 jnthn whee
15:01 jnthn oh, I see...
15:01 timotimo a missing typedec perhaps?
15:01 timotimo typedef*
15:02 jnthn fixing
15:02 timotimo oh
15:02 timotimo missing a void in front
15:02 dalek MoarVM/spesh: aceb5dd | jnthn++ | src/spesh/manipulate. (2 files):
15:02 dalek MoarVM/spesh: Missing return type; timotimo++.
15:02 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/aceb5dd703
15:02 timotimo (in two files)
15:02 timotimo yeah
15:03 timotimo will it support MVM_SPESH_LOG=- ? :)
15:03 jnthn It calls fopen
15:04 jnthn Seems not on Windows.
15:04 timotimo ah. well, /dev/stdout works :)
15:04 timotimo and yeah, that's a lot of output :)
15:04 jnthn Yeah; it's before/after of everything it specialized.
15:04 timotimo the "goto <nyi>" i see, does that mean that the output of the goto op is not yet implemented?
15:04 jnthn Yeah, it's purely that dump.c is missing a bunch of things
15:04 jnthn I wrote the ones I needed to debug the problems I had :)
15:05 jnthn Instructions are actually always wanting output like BB42 or so
15:05 jnthn (that is, basic block 42)
15:05 jnthn The info is all there in the graph.
15:05 jnthn It's just adding more cases to the switch/case for operand dumping.
15:06 jnthn There's a few things we need besides more optimizations to let this be more effective...
15:07 jnthn 1) It currently only knows how to deal with locals, not lexicals. This makes lexical => local lowering even more valuable.
15:07 jnthn 2) It doesn't know how to de-opt yet.
15:07 timotimo oof, that opt ...
15:07 timotimo i've had quite a lot of trouble with that optimization in the past :)
15:07 timotimo lexical to local i mean
15:07 jnthn Yeah, I don't mind trying to pick it up and work on it.
15:07 jnthn Maybe I should do that.
15:08 jnthn There are a few things that can force de-opt.
15:08 jnthn Mixins are *the* huge pain because they're the only time an object we already think we know what is can change type.
15:08 jnthn I thought about trying to track it cleverly
15:09 jnthn Then in the end was like, "you know, screw it, just walk the whole stack and de-opt the lot"
15:09 timotimo probably good enough
15:09 jnthn It's far safer.
15:09 timotimo i wonder if my newest code for lex2loc is up on github yet
15:10 jnthn Anyway, implementing the de-opt is...a todo. :)
15:11 jnthn Basically, you always need a map of return address in optimized code to return address in original code.
15:11 timotimo there it is.
15:11 timotimo r2-lex-to-loc
15:11 jnthn Thanks.
15:12 timotimo i'm not proud of the state of the code ...
15:12 timotimo but i'll be happy when you drag it kicking and screaming into a working and beautiful state
15:12 jnthn OK.
15:14 timotimo the basic structure is probably sound; a friend gave me the helpful advice that i'll need to do two descents
15:14 timotimo first i descend the whole tree downwards so i'm closest to the leaves
15:14 timotimo leafs?
15:14 timotimo w/e
15:15 timotimo then, while "going outwards" (that is: after visit_children() has finished) i need to go towards the levaes again to do the check what variables can be local'd and whether or not any remain that would prevent block-to-stmts transformation
15:15 jnthn Good to know. I'll take a look at it later on.
15:16 timotimo yay
15:20 timotimo aaw
15:20 timotimo build_cfg clears out ins_to_bb
15:20 timotimo if i want to dump the output of a jumping op, i'll need to access that information later on, won't i?
15:20 timotimo hm, though it should stash the address of the basic block somewhere as well, shouldn't it?
15:21 jnthn The info is in the spesh graph still
15:22 timotimo ah. just not in the same way. okay
15:22 jnthn See MVMSpeshOperand
15:22 jnthn MVMSpeshBB  *ins_bb;
15:22 jnthn That one
15:22 jnthn If you grab that and ->idx it, you get the index.
15:23 timotimo oh!
15:23 timotimo i thought i'd find an ins_offset there
15:23 timotimo but if it'll be a _bb, that's the best thing that can happen
15:23 jnthn No; it replaces all those once the bbs exist.
15:23 jnthn The offsets are meaningless as soon as you mutate the graph, but bbs are forever :)
15:24 jnthn Well, unless you make them unreachable. :)
15:24 timotimo best buddies forever <3
15:25 timotimo o_O
15:25 timotimo these phi instructions will not end up in actual code, right?
15:26 jnthn Correct.
15:26 jnthn Before the stuff got shoved into academic papers, they were called phoney instructions.
15:27 timotimo hehehe.
15:27 timotimo yeah, a greek letter is much more academic
15:29 timotimo unless_i r4(2), BB(3)
15:30 timotimo doesn't look half bad
15:30 jnthn \o/
15:30 jnthn Note that r4(2) means "r4 in the original bytecode, 2nd version"
15:30 timotimo also, now there's "<nyi lit>" in addition to "<nyi>"
15:30 timotimo maybe i'll put a _ there
15:30 timotimo yeah, i should do that
15:31 * brrt will check this out @home after dinner
15:31 brrt bye!
15:31 jnthn You can dump the literals quite easily though, I think :)
15:31 jnthn o/ brrt
15:31 timotimo bon appetit!
15:31 timotimo oh, he's gone
15:31 timotimo yeah, i'll dump them next.
15:32 timotimo oh, oops
15:32 timotimo seems like i forgot to ->info in between and it still worked?
15:32 timotimo cur_ins->operands vs cur_ins->info->operands
15:32 timotimo oh, the code i saw before used both, too
15:32 timotimo weird.
15:33 jnthn They are...differnet :)
15:34 jnthn ->info->operands is the flags telling you what the operand is (register, literal, etc.)
15:34 timotimo i use one &ed to the operand masks to figure out what the type is and the other ... ah
15:34 jnthn ->operands are the actual values
15:34 timotimo well, that's perfect then :)
15:35 timotimo throwcatdyn r5(1), liti64(16)
15:35 jnthn :)
15:35 jnthn Poor cat...
15:35 timotimo what are these FH related annotations?
15:36 jnthn FH = Frame Handler
15:36 jnthn Consider a try, or a loop with control exceptions
15:36 timotimo ah, right
15:36 jnthn We need to know where the start/end of the exception handler is in the specialized code.
15:37 dalek MoarVM/spesh: 720e905 | (Timo Paulssen)++ | src/spesh/dump.c:
15:37 dalek MoarVM/spesh: dump out BBs for jump targets
15:37 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/720e9053ea
15:37 dalek MoarVM/spesh: 1490226 | (Timo Paulssen)++ | src/spesh/dump.c:
15:37 dalek MoarVM/spesh: dump literal ints and nums
15:37 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/14902267b7
15:37 timotimo should i dump strings literally (actually, escaped)?
15:37 timotimo or as an index to the string table?
15:38 timotimo or both?
15:38 jnthn Hmm
15:38 jnthn Good question. Maybe the string itself is more useful for reading the code.
15:38 timotimo yes, but it may disturb the flow of the reader :P
15:38 timotimo if it's a ten-line heredoc or something :)
15:39 jnthn True :)
15:39 jnthn But if somebody gives me a program to debug spesh on with a 10 line heredoc in, I might just remove the 10 line heredoc :P
15:39 timotimo :D
15:40 timotimo i could implement it as a fuse filesystem on linux that gives you a folder strings/ and that has text files in it for each number! :P
15:40 timotimo or a HTTP server that'll serve these strings to any curl that asks!!
15:40 timotimo this is brilliant!
15:40 timotimo all the possibilities forever!
15:42 jnthn o.O
15:42 jnthn Crazy ideas are crazy :)
15:45 colomon joined #moarvm
15:47 FROGGS_ a less crazy idea would be to upload the star release tarballs :o)
15:50 FROGGS[mobile] joined #moarvm
15:58 jnthn FROGGS[mobile]: I don't seem to find an SSH key..hmm
16:29 benabik joined #moarvm
16:36 dalek MoarVM/spesh: a32a5f1 | jnthn++ | src/spesh/graph.c:
16:36 dalek MoarVM/spesh: Set ->prev correctly during phi insertion.
16:36 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/a32a5f1450
16:36 dalek MoarVM/spesh: ed9db72 | jnthn++ | / (4 files):
16:36 dalek MoarVM/spesh: Add :pure annotations to side-effect-free ops.
16:36 dalek MoarVM/spesh:
16:36 dalek MoarVM/spesh: These are ones we know we can safely delete if they are unused.
16:36 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/ed9db7251d
16:37 dalek MoarVM/spesh: 677a5dc | jnthn++ | src/spesh/facts. (2 files):
16:37 dalek MoarVM/spesh: Start tracking usage per SSA local.
16:37 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/677a5dc6b5
16:37 dalek MoarVM/spesh: 9ef4e75 | jnthn++ | src/spesh/optimize.c:
16:37 dalek MoarVM/spesh: Back-propagate usage; eliminate unused pure ops.
16:37 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/9ef4e75b40
16:37 benabik …  phi insertion?  Excellent.
16:38 jnthn :)
16:45 timotimo should the log only output diffs or should it also log whenever it successfully applies some transformation?
16:46 jnthn I think the diff between before and after will tell us enough.
16:46 timotimo oh, also: the diff between before and after will also contain blocks being re-ordered and perhaps dropped or merged, right?
16:49 jnthn It shows them in linear_next order
16:49 jnthn They may get dropped I guess...
16:50 jnthn Though not yet.
16:51 timotimo will transformations likely reorder BBs?
16:52 jnthn Not in the output.
16:52 jnthn Fordump, I mean.
16:52 jnthn *dump
16:52 timotimo OK, that's nice
16:52 jnthn The most immediate elimination we're gonna see is on optional params.
16:52 timotimo oh, that's nice
16:53 timotimo and with it, it'll probably also be able to do some dead code removal?
16:53 jnthn Right.
16:53 timotimo i like that
16:54 timotimo is the name "spesh" significant in any other ways than short and cute for "specializer"?
16:55 jnthn Short and cute for specializer.
16:55 jnthn "spec" would give idea of "specification"
16:55 jnthn And "specializer" was too long
16:56 timotimo sounds good to me
17:01 cognominal sounds like yiddish
17:02 FROGGS[mobile] shmok!
17:02 timotimo would you be okay with a diff display tool that's written in python?
17:05 jnthn timotimo: hm, I'd prefer it in Perl 6 ;)
17:05 jnthn timotimo: tbh I was gonna dig the bits out and then shell out the git diff :P
17:05 jnthn *to
17:06 timotimo heh.
17:06 jnthn No need to re-invent the wheel too much :)
17:06 timotimo aye
17:06 timotimo git diff also makes it pretty colorful
17:06 timotimo and it has an implementation of patience diff
17:08 jnthn aye, the colors are nice
17:11 jnthn Time for some dinner. :)
17:11 timotimo i now realize the problem i imagined with using perl6 to parse the output of a perl6 script is not even a problem
17:11 timotimo i was like "but if i pipe it to a moarvm based perl6, it'll inherit the log env var and clobber the log!"
17:11 timotimo but it would make more sense to output the log to an actual file.
17:13 * timotimo heads out
17:31 FROGGS joined #moarvm
18:11 timotimo i'm getting "malformed UTF8" from my tool now :|
18:12 timotimo ah
18:12 timotimo somehow something weird came into the file
18:12 timotimo possibly from me hitting ctrl-c or so
18:13 timotimo wat.
18:13 timotimo more bogus output
18:14 timotimo where do these weird characters come from.
18:15 timotimo 17851786After:
18:15 timotimo er.
18:15 timotimo that's not actually helpful output
18:15 jnthn hmm
18:16 jnthn I was gonna say did it fail to null terminate it, but it looks OK to me...
18:16 jnthn append(&ds, "\n\0");
18:17 timotimo a well placed + 1 seems to have fixed it
18:18 timotimo in the memcpy of append
18:18 jnthn I just noticed we don't free the before/after
18:18 jnthn oh :)
18:18 timotimo len + 1 causes it to no longer explode
18:18 jnthn oh, hang on...
18:19 timotimo the output of this simple script is quite huuuuge
18:19 jnthn Well, remember it's optimizing the compiler too :)
18:20 timotimo i was about to complain that some cuids get optimized multiple times
18:20 timotimo but that totally makes sense.
18:21 jnthn timotimo: OK, here's the acutal issue
18:21 jnthn The memcpy is fine normall
18:22 jnthn It just doesn't append the \0 'cus it uses strlen to figure out how much to append
18:22 timotimo ah, hehehe :)
18:23 timotimo okay, i'm getting somewhere
18:23 timotimo i haven't done actual proper perl6 code in a long while, it seems
18:23 timotimo i'm surprised by how clean the code seems to be
18:23 timotimo it's a for lines() with a bunch of whens that change state and push a completed thingie into an array once it's done
18:24 jnthn Building a fix now for the dump thing
18:25 timotimo do you mean it isn't always safe to just copy an additional byte?!?!?!?!!kkkkk
18:25 timotimo !!!kkkκκκκκκ
18:25 timotimo :D
18:25 jnthn :P
18:26 timotimo (capslock + k gives ! on my layout, capslock+shift + k gives κ)
18:26 dalek MoarVM/spesh: e53001b | jnthn++ | src/spesh/ (2 files):
18:26 dalek MoarVM/spesh: Fix spesh dump missing null and memory leak.
18:26 dalek MoarVM/spesh:
18:26 dalek MoarVM/spesh: timotimo++ for discovering the former.
18:26 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/e53001ba1d
18:30 timotimo time for foods
18:48 lizmat joined #moarvm
18:50 timotimo and also groceries
19:25 cognominal jnthn, is spesh dynamic or static optimizations?
19:26 jnthn dynamic; it factors things we can't (or can't easily) see at compile time
19:26 jnthn *factors in
19:27 jnthn And will increasingly come to do so.
19:27 cognominal like v8 as described in the self papers?
19:31 jnthn Well, some of the same techniques, sure
19:31 jnthn Though nothing so advanced yet.
19:33 cognominal yet is the operative word :)
19:45 * timotimo is back
19:59 timotimo https://gist.github.com/timo/c32f6687135849294aa4 - what do you think?
19:59 timotimo apart from it being after -> before rather than before -> after m)
20:00 jnthn nice :)
20:01 timotimo ok, there were changes in the mean time o_O
20:01 timotimo nope
20:02 timotimo i just accidentally reset spesh to master
20:03 timotimo git diff only accepts two filesystem files at once
20:04 timotimo should i just shell out to git-diff a bunch of times in sequence for all pairs?
20:04 timotimo in order to get the colors, i need to shell out :|
20:04 timotimo otherwise i could output it to files
20:04 timotimo or perhaps offer a menu
20:04 jnthn Could do, yeah. And if the script can take an optional arg which is a way to grep for names, it's even better.
20:04 timotimo oh, yeah
20:05 timotimo how about a -e that'll get eval'd and given to a smartmatchy grep?
20:05 jnthn sounds OK
20:05 timotimo -e "name => /foo/" will give you "search for /foo/ in the name field" for example
20:05 jnthn Though plain text would do me :)
20:05 timotimo is that how it works?
20:05 jnthn oh wow
20:05 jnthn That's nice :)
20:05 timotimo i've got to try that first
20:05 timotimo before i promise anything :)
20:07 timotimo if you f5 the gist, you'll get th eright direction, -before +after
20:07 timotimo (need to upload it first)
20:10 timotimo i promised too much, sorry
20:10 timotimo name => /foo/ wouldn't "just work"
20:10 timotimo but i could make it work :)
20:11 jnthn I don't especially need it ;)
20:12 timotimo well, then you could search for stuff in before and after
20:13 timotimo maybe it'd be most interesting to search for befores that have one string and afters that have another string
20:13 timotimo actually, in that case you'd want something like the pickaxe search where only lines with + or - in the diff will get considered
20:13 timotimo anyway
20:14 timotimo the specializer does a good job getting rid of PHI instructions :P
20:34 brrt joined #moarvm
20:43 timotimo i now have a sub called supersmartmatch
20:47 jnthn timotimo: Yeah - it looks silly at first glance to do so, until you realize that getting rid of them means it also decrements the usage counts on the things that they bring together
20:47 jnthn timotimo: Which may in turn allow getting rid of real instructions
20:55 timotimo oh god this is glorious
20:55 timotimo it's working
21:00 jnthn ooh :)
21:01 timotimo https://gist.github.com/timo/8d0187163cdbebc35d70
21:01 timotimo you see the * in the list of cuids? :)
21:05 jnthn yes?
21:06 jnthn That means multiple?
21:06 jnthn Or no difference?
21:06 timotimo that means "selected by the matcher"
21:06 timotimo underscores after the cuids means "multiples"
21:08 timotimo allow me to blow your mind in a few minutes
21:10 jnthn oh, cool!
21:13 _sri joined #moarvm
21:14 timotimo something's not working right in order to let me blow your mind
21:14 timotimo but i'll keep trying!
21:16 * jnthn is working on that "skip the proto" multi-dispatch thing he mentioned a week or two ago
21:17 timotimo perl6-m ../moarvm/tools/spesh_diff.p6 --matcher="diff => / '+' .*? 'lit' .*? '(8)' /" testlog.txt
21:17 timotimo matcher selected 75 out of 172 cuids
21:17 timotimo \o/
21:18 jnthn ooh!
21:18 timotimo yes! :D
21:18 jnthn That basically lets us see if it applied certain optimizations :)
21:18 timotimo i may need to move the output of the cuid list after the generation of diffs so that it will precisely display which are matched
21:20 timotimo yay
21:20 timotimo now the list of cuids is precise, too
21:24 timotimo i shall commit this.
21:25 timotimo it will clobber the filesystem, though
21:25 timotimo it'll add a folder for the before and the after files
21:25 timotimo but IMO it's acceptable because you may want to do your own analysis
21:27 lizmat clobbering filesystems with useful data, is what they are for, no?
21:29 timotimo :)
21:29 timotimo what should the semantics of --matcher="foo" be?
21:29 timotimo should it match names by default?
21:29 timotimo or "everything concatenated"? :P
21:29 jnthn That's perhaps most useful
21:29 timotimo agreed
21:41 dalek MoarVM/spesh: a2a5e73 | (Timo Paulssen)++ | tools/spesh_diff.p6:
21:41 dalek MoarVM/spesh: this tool splits and diffs spesh log output
21:41 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/a2a5e73617
21:41 dalek MoarVM/spesh: df0ddaf | (Timo Paulssen)++ | tools/spesh_diff.p6:
21:41 dalek MoarVM/spesh: supersmartmatch defaults to name, add usage.
21:41 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/df0ddafad0
21:43 jnthn Good news: the multi thingy I'm working on gives a 10%-15% improvement on things like "for 1..1000000 { $i++ }".
21:43 jnthn Bad news: something's wrong with it.
21:43 jnthn Of note, with module loading.
21:44 hoelzro what's spesh?
21:44 timotimo our very own bytecode specializer! :)
21:45 timotimo i'm still surprised how clean this tool turned out
21:47 jnthn m: say IO::Spec.rel2abs('lib')
21:47 camelia rakudo-moar 358582: OUTPUT«/home/p6eval/lib␤»
21:50 d4l3k_ joined #moarvm
21:51 ggoebel11119 joined #moarvm
21:52 jnthn m: say IO::Spec::Win32.splitpath('C:\consulting\rakudo', :nofile)
21:52 camelia rakudo-moar 358582: OUTPUT«C: \consulting\rakudo ␤»
21:53 masak_ joined #moarvm
22:10 timotimo jnthn: you think the bytecode specializer would be a good place to do strength reduction?
22:11 jnthn Could be.
22:12 timotimo should i try? :)
22:13 jnthn But there's probably other things to add that'd have more effect.
22:13 timotimo otherwise, feel free to suggest other things
22:13 timotimo but keep in mind i don't know terribly much :)
22:13 jnthn Well, the optional param thing is worthwhile.
22:13 timotimo isn't that something you've already done?
22:14 timotimo i'm confuse
22:15 jnthn No
22:16 jnthn args.c handles improving the situation for things taking a bunch of required params only.
22:22 timotimo that's the part that will specialize on types?
22:22 jnthn Well, at the moment it's not even caring about incoming arg type
22:22 jnthn But when you specialize you know the callsite
22:22 jnthn if we have
22:22 jnthn sub foo($x = 42) { }
22:22 jnthn And we call it as foo()
22:23 jnthn Then we know when we specialize with that callsite that we'll not even need to ask if there's an incoming arg, and we should run the code to use the default
22:24 jnthn By contrast, if it's called as foo(100) then we know we can grab the arg and toss the default code.
22:26 colomon joined #moarvm
22:29 timotimo mhm
22:29 timotimo afk for a bit
22:40 timotimo paramnamesused is the position from where the names of parameters are not interesting any more?
22:40 timotimo or something like that?
22:40 dalek MoarVM: 28cac54 | jnthn++ | / (12 files):
22:40 dalek MoarVM: Add setmultispec mechanism.
22:40 dalek MoarVM:
22:40 dalek MoarVM: When we have onlystar protos with simple signatures, there's no reason
22:40 dalek MoarVM: to call the proto, to have it wrap the args in an object to then use
22:40 dalek MoarVM: to do a lookup in a multi cache. Provide a mechanism to try the cache
22:40 dalek MoarVM: right away, falling back to the proto (which may populate the cache).
22:40 dalek MoarVM: review: https://github.com/MoarVM/MoarVM/commit/28cac542d8
22:40 jnthn It asserts that there are no unconsumed named parameters
22:40 jnthn spesh isn't trying to handle names at all yet
22:40 jnthn We need to move names into the MVMCallsite before that
22:41 timotimo ha
22:41 timotimo er
22:41 timotimo ah
22:41 jnthn But optional positional params we could handle better now.
22:45 timotimo that.s all the _op_ and _on_ OP_params?
22:45 timotimo i suppose that's positional an dnamed?
22:45 timotimo and rp/rn are required positional, required named?
22:46 jnthn op = optional positional
22:46 jnthn yeah, you got it
22:46 jnthn and sp and sn are slurpy...
22:46 timotimo ah
22:47 timotimo o, s, n, i are object, string, num, int?
22:47 jnthn Correct
22:53 timotimo the first successor in the list is the one the block will go to if no jump was done, the others are blocks referred to via jump operations?
22:53 jnthn Uh...not sure
22:54 timotimo well, just look at my super simple testsub here:
22:54 jnthn The robust way is to look for the successor that is not linear_next
22:54 jnthn Because a successor matching that is the non-jump case.
22:54 timotimo https://gist.github.com/timo/ee59cf9e9a80c481a7c0
22:55 timotimo the param_op_o is, i suppose, "is this param set? if so, jump"
22:55 jnthn It's an interesting op
22:55 jnthn It sees if the param was passed
22:55 jnthn If it was it writes it to the w reg
22:55 jnthn And then jumps
22:56 jnthn If it wasn't, it just falls through to the next instruction (which in this case is in the linear_next basic block)
22:56 timotimo so if we have a callsite where the optional wasn't set, we can either turn that into an unconditional jump (and a set or decont in that case) or remove it?
22:56 timotimo er, i mean
22:57 timotimo if we know whether or not it was set
22:57 jnthn If it wasn't set, you simply toss the op altogether.
22:58 timotimo that seems somewhat simple, i'll just have to figure out how the manipulate_delete_ins thing works exactly
22:59 jnthn It basically does that it says :)
22:59 timotimo ah, there's only one MVM_OP_param* for each of the positional rags
22:59 jnthn You pass it the instruction to delete and the basic block containing it...
22:59 timotimo that's why MAX_POS_ARGS works?
22:59 timotimo oh, that sounds simple enough
23:00 timotimo i found a copypasto in your code \o/
23:00 jnthn oh?
23:00 jnthn :)
23:00 brrt left #moarvm
23:01 dalek MoarVM/spesh: e83aaae | (Timo Paulssen)++ | src/spesh/args.c:
23:01 dalek MoarVM/spesh: fix a copypasto
23:01 dalek MoarVM/spesh: review: https://github.com/MoarVM/MoarVM/commit/e83aaae090
23:01 timotimo wasn't dangerous
23:02 jnthn ah, yeah
23:08 timotimo so the new logic will be ...
23:09 timotimo reg_max + 1 used to have to == cs->num_pos
23:09 timotimo but now cs->num_pos may be more than reg_max
23:09 timotimo but no more than reg_max + opt_max
23:09 timotimo but it's apparently offset by one, so i have to add 1 or maybe even 2 in there?
23:09 timotimo probably because it starts both counters at -1?
23:11 timotimo oh, this optimization could really do good for the accessors we have all across nqp
23:14 jnthn Yes, it will :)
23:15 jnthn Yeah, the idx is index into the array, thus the +1
23:18 timotimo oh
23:18 timotimo can i figure out, for debugging purposes, what the name for the callsite is?
23:18 timotimo when i'm in MVM_spesh_args?
23:20 timotimo i think this is the right one:
23:20 timotimo # we have a callsite here with num_pos => 0, req_max => -1, opt_max => 0
23:20 jnthn There's not really a name for a callsite; their identify is tied up in their flags...
23:20 timotimo that could correspond to calling testsub($foo = "hello") like testsub()
23:20 jnthn Seems along the right lines, yes
23:21 timotimo so now req_max + 1 == num_pos and the 0th optional shall be tossed
23:25 jnthn Seems like you're onto something :)
23:25 jnthn Have fun...I'm gonna go rest
23:26 jnthn 'night
23:28 timotimo good night!
23:49 timotimo oh, hm
23:49 timotimo so do i turn a param_op into a param_rp if i know it's passed?
23:49 timotimo seems sensible
23:49 timotimo now i'll have to fix the number of operands or something
23:56 timotimo though i'm not quite sure ... do i have to null out the operand?
23:56 timotimo i probably do

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