github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
01:15 leont left 02:38 Kaiepi left 03:36 Kaiepi joined 03:59 nevore joined 04:22 sortiz joined
Geth MoarVM: salortiz++ created pull request #1440:
VMArray: Check slot type for read_buf and write_buf
04:24
04:37 nevore left 04:44 nevore joined 05:57 nevore left 05:58 domidumont joined 06:04 nevore joined 06:13 nevore left 07:34 sxmx left 07:46 sxmx joined 08:11 sxmx left, sxmx joined 08:22 sortiz left 08:39 brrt joined 09:04 zakharyas joined 09:16 sena_kun left 09:18 sena_kun joined 09:38 leont joined
MasterDuke anyone else watched the video of the Perseverance descent? pretty cool stuff 09:52
lizmat yeah, slick! 09:56
nine I was blown away 10:19
brrt I read about it in the 'how to' book from Randall Munroe, I didn't get to see the video yet 10:32
MasterDuke i just learned you wouldn't have been if you had been on mars, the atmosphere is so thin that there aren't enough air molecules for wind to push stuff around
10:34 patrickbkr[m] joined 10:45 linkable6 left 10:46 linkable6 joined 11:08 linkable6 left 11:10 linkable6 joined 11:27 brrt left
nine MasterDuke: well, except dust :) 11:54
MasterDuke true, but only very fine dust 11:55
12:32 zakharyas left 13:08 lizmat_ joined 13:13 lizmat_ is now known as lizmat 13:23 lizmat_ joined 13:24 lizmat left 13:25 lizmat_ left, lizmat joined 13:37 zakharyas joined 13:44 lucasb joined 13:55 lizmat_ joined 13:58 lizmat left
nine I know the solution to the "doesn't even try to inline infix:<eq>" mystery 14:19
14:21 brrt joined
nine Yesterday I noticed that we're missing stats on the interesting calls to infix:<eq>, i.e. those that happen in the main program as opposed to during module loading. 14:38
That's so because during module loading we already create a speshed version of infix:<eq>. MVM_frame_invoke looks for existing spesh candidates and takes one if one is applicable. And one is indeed, right away. This is usually a good thing, but in this case it also keeps us from ever gathering stats for this callsite. 14:40
So we end up without known decont type and cannot pick a multi candidate to inline.
This picking of an existing spesh candidate by MVM_frame_invoke takes CORE.c stage parse from 49s to 34s on my machine. But it also takes the simple micro benchmark from 13s to 459s (I kid you not) 14:41
In this case, the good is really the enemy of the perfect. 14:42
jnthn new-disp does everything on per-callsite stats rather than there being a shared multi-cache 14:49
Guards are stacked up at each callsite, for the types observed there.
Which, iiuc, means we should do better in the case you're looking at
14:49 lizmat_ is now known as lizmat
nine In other words its not worth looking for a solution. But at least we know that the thing lizmat++ was testing for is actually a TODO 14:52
jnthn IMO no, better we spend the time getting new-disp up and running 14:53
Multi dispatch (making it resumable and handling `where` clauses and other bind checks) is the main functional thing left 14:54
Then trying to switch everything over to it, and triaging what is left
Beyond that, it'll be performance re-tuning
(And there'll be further opportunities to re-work some additional things to perform better, but those'll happen after it's landed.) 14:56
nine But I guess the mis-spesh MasterDuke++ discovered will still need a fix
jnthn Not read about that in any detail yet 14:57
Few too many things going on
jnthn tries to pick which of the 4 things he should be doing right now to do :) 14:58
nine colabti.org/irclogger/irclogger_lo...-02-21#l14 is the mis-spesh thing 14:59
I'd pick the thing you feel like working on right now ;) After all the order won't matter that much 15:00
jnthn Ahh, I did skim-read that, then forgot about it :) 15:02
nine Maybe you have a bit of hand waving to throw my way then? 15:03
jnthn It'd be a bit strange to find we're calculating SSA form wrong after this many years :)
So I'm guessing it won't quite be that 15:04
Did you try turning on the DU checker?
nine not yet
jnthn That checks usage chains are correct
Worth a try
dogbert11 suggests jnthn walks toward the coffee machine
jnthn Already had my coffee for the day (at least, if I care to sleep :)). Just made a tea. 15:05
nine tea++ 15:06
DU check is quiet
jnthn Darn. 15:16
nine That r2(0) in the PHI node really looks fishy to me. And I wonder: where would I find code that writes done by instructions in an area covered by a handler just may not happen and the last version before the handler area must be added to the PHI node? 15:20
MasterDuke nine: interesting find. if it weren't for new-disp fixing it, it'd almost seem like a good case for figuring out some heuristics for removing spesh candidates... 15:33
also, not really understanding your last message. are you suggesting the SSA form might in fact be wrong?
nine Kinda yes, since the PHI node is missing a relevant version of the register 15:35
MasterDuke huh. are there any automated SSA checkers? 15:36
i wonder if moarvm's use would mean it could be added to the "Compilers using SSA form" section here en.wikipedia.org/wiki/Static_singl...nment_form 15:42
nine sure 15:43
MasterDuke is there any good writeup/blog post/etc about how moarvm uses SSA? or how/when it was introduced? 16:26
16:37 brrt left
MasterDuke while we're talking about spesh. a spesh log of `my %h = a => 42, b => 666; my $b; $b := %h<a>:exists for ^10_000_000;` has these lines: 16:43
# [001] could not inline 'postcircumfix:<{ }>' (2495) candidate 0: target has a :noinline instruction
# [002] inline-preventing instruction: assertparamcheck
this is in the "After" of `'' (cuid: 1, file: -e:1)` 16:44
anything that can be done about that? 16:46
nine MasterDuke: for that you kinda need to work it backwards. Spesh tries to optimize away assertparamcheck. We can do so if we know it will pass (according to that comment in optimize.c) 17:07
To know it passes we need to know its value. But according to my spesh log we don't have a KnVal for r7(3) 17:08
The value would be the result of an istype check of r5(3) against r8(10). We actually know the value of both, so we should be able to do that at compile time. 17:09
So why do we not?
MasterDuke i've been assuming the param it's checking is :$exists from github.com/rakudo/rakudo/blob/mast...ce.pm6#L21
nine it is 17:10
r5(3): usages=2, flags=9 KnTyp Concr (type: Bool), r8(10): usages=1, flags=19 KnTyp KnVal TyObj (type: Bool(Any))
MasterDuke ok. fwiw, i also just discovered that it may be a tiny bit faster to write the body of that as `my $e := SELF.EXISTS-KEY(key); $exists ?? $e !! !$e` 17:11
nine optimize_istype checks if both values are known (which they are), then calls MVM_6model_try_cache_type_check which apparently returns failure to check. 17:13
MasterDuke stock: Frame size: 420 bytes (168 from inlined frames), Bytecode size: 1912 byte
modified: Frame size: 330 bytes (84 from inlined frames), Bytecode size: 1460 byte
nine Sure, you're avoiding the inlining problem that way 17:14
MasterDuke yeah. but if spesh makes an assumption $exists is constant, the stockĀ  version could/should be smaller, right? 17:16
nine if we find out why optimize_istype fails
17:17 brrt joined
nine Well, a Bool is simply a different type than Bool(Any) 17:25
So this failure to inline is in essence a side effect of turning coercers into their own type objects
vrurg_: ^^^ 17:26
17:26 domidumont left
nine I'd not be surprised if this is somewhat costly... 17:31
MasterDuke nice find. we knew the coercion work had a performance impact, but the majority of it was addressed (not using nqp::ctxcaller or something like that). maybe this is the rest 18:08
could we simply cheat and say Foo(Any) == Foo (since Any is the default)? 18:09
18:11 brrt left
nine Maybe we can generate better code there, like first check for the target type, then the coercer. 19:06
But to do that we need to find out where that istype is coming from
19:14 zakharyas left
vrurg_ nine: Line 9402 in Actions.nqp. For coercive non-generic types the first thing done is nqp::istype against the target. `coerce` method is invoked only if that fails. 19:16
19:16 vrurg_ is now known as vrurg
nine But where does the istype(Bool, Bool(Any)) come from then? 19:29
MasterDuke ugh, `call MVM_dump_bytecode(tc)` at the Bool vs Bool(Any) comparison segfaults 19:42
why would `tc->cur_frame` ever be 0x0? 19:48
nine what's the backtrace? 20:12
MasterDuke gist.github.com/MasterDuke17/55441...e9926bdca6 20:14
vrurg nine: So far my only suspect for the call is at line 9289. 20:17
I need to more time to make sure it's where it happens, but would only be able to look deeper in ~1-3 hrs later. 20:19
nine cool
vrurg Do you have a code snippet to work with? 20:20
nine MasterDuke: oh that's very much to be expected. The spesh thread is simply never executing any frame
MasterDuke m: my %h = a => 42, b => 666; my $b; $b := %h<a>:exists for ^10_000_000;Ā  # vrurg
camelia ( no output )
vrurg MasterDuke: oki, thanks!
MasterDuke nine: gist updated 20:24
nine vrurg: yes, I'm pretty sure its line 9289 20:34
It fits the bytecode dump from MasterDuke's gist
And the dumped ast of the sub 20:35
vrurg nine: I now understand what happened. That code remain unchanged from the times when $param_type was nominal. But now it can also be a coercion. So, it needs an additional `if` to pull out the target type. 20:37
vrurg must make a couple of phone calls and then will be free for this. 20:38
MasterDuke cool 20:40
20:53 zakharyas joined
MasterDuke well, just for the heck of it i tried gist.github.com/MasterDuke17/1d661...bc81422085 but that results in `Internal error: inconsistent bind result in block <unit> at /home/dan/Source/perl6/rakudo/tools/build/clean-target-files.raku line 1` 20:57
but using the rakudo-m in the source directory give my 1.3s for the example, vs 2.8s 20:59
i do still get that postcircumfix can't be inlined, but it's a different instruction now 21:02
# [001] could not inline 'postcircumfix:<{ }>' (2495) candidate 0: target has a :noinline instruction
# [002] inline-preventing instruction: getlexstatic_o
but far few frames overall. 20005504 vs 10007106 21:03
21:11 lucasb left 21:14 lucasb joined
nine This passes spectest and takes the example with 100K iterations from 21.2 to 8.5s: gist.github.com/niner/c5d80085ca27...2e77d2aca8 21:33
21:33 Geth left
vrurg Let me see if another solution works better. Aside of coercions we could deal with other kinds of nominalizables. So, perhaps using nominalized type will work even better. 21:40
Also, it should be more generic solution. 21:41
nine have fun :)
Oh, it doesn't pass spectest anyway: Cannot find method 'target_type' on object of type Perl6::Metamodel::SubsetHOW 21:42
So yes, a more generic solution is needed, indeed. But at least we know what's to gain and the way to do it :) Great teamwork!
vrurg Ok, the same 'inconsistent bind result'. Gonna take some time, it seems. 21:44
jnthn After wondering why Comma was showing me really broken profiler results, I tracked it all the way back into MoarVM, and it turns out we started producing broken multi-threaded profilers some months ago 21:51
*profiles
21:59 zakharyas left 22:31 noonehere4u joined
noonehere4u /!\ this chat has moved to irc.crimeircd.net #pp /!\ 22:31
22:31 Freejack joined
Freejack /!\ this chat has moved to irc.crimeircd.net #pp /!\ 22:31
22:32 Freejack left, noonehere4u left 22:33 batman42Lm joined
batman42Lm /!\ this chat has moved to irc.crimeircd.net #0 /!\ 22:33
22:33 batman42Lm left 22:42 SiLuman joined, CajsZs joined
CajsZs D4yis5hJF5xGzhtxsmfSa6H6c1oNRQrvxbcoKvKZ2Cm2EeCLta8IbserUt8D7lPR74g5tQ8uT3sQw8vwBQHGxzSvGET1VwoKcsH2mKVJvbbUk2G2wXduUCql 22:42
SiLuman D4yis5hJF5xGzhtxsmfSa6H6c1oNRQrvxbcoKvKZ2Cm2EeCLta8IbserUt8D7lPR74g5tQ8uT3sQw8vwBQHGxzSvGET1VwoKcsH2mKVJvbbUk2G2wXduUCql
5Cmxe0MoEYQKzfCa076yzo6SYAUxgbsuf3NW0Re9mgKeWvfErG5ItCgJmmVt6a8nYtvVo2qvmfJ656wNN6Ks6TXB5cBqsAZ4IyslYHujmwkBjmrCLO3MuYID
22:42 CajsZs left
SiLuman FEipuM8Aio1laV6sFOXgc8Ess7wlf0b9yLApezjQQAJPXDoaCQGVU01wBeeL3U777spECDqQIgP4tbr5ELnXAy5r7UNtKd96biHrZu7wqdiabjHHtC8amyg8 22:42
SfIxdBC7U3EUAxDiTtnvOUmhBcFhz913FJhrCO0l4QGylMUxGqhFTLZN2m1XfhTaPk4gf3ciyvaGXhHqCcT7FN21jnhab3HfsS5hbfVBTsi3L4v0JhyEbnqt
a6Z8AepNxWCeiVQzRkXa2JWyDKT8eq1HmvhNhb3ni9OIB8uqtjBSsuBL04HxxR6bKzgkTJlojSnFROeI0aBl8qkHxmQvrKzDtfNYJobm4snqgosJb6UVZGeg 22:43
22:44 meffeTP joined, SiLuman left
meffeTP B5bbv90BbOV8Al01uzKsuQ99xxPAKfqiRsoXwiQg1DabD1Uti21qY63zzXbBQ4cRLsmjSbQFcvaltDbQhomi8EFVOHfx93B4hcXKHBVYFOAuQCUslgql8zCC 22:44
22:44 meffeTP left 22:45 ced117VM joined
ced117VM UCwXBSpUOIFW5L7ShrBfs32gZ12ajQ7dQzW15ALIfwe2Yp1ZsNVwf65gCld8ginpWcsvjg3vXMIbP1czWalMNVWLtDz96ccGwDEcmO0bF50v5SIWASzU6wqI 22:46
HKVRf7Pe47Y8NbQbkeSEm26dpAKcX1JG6KcdfeFiBOAQ6Az78p9rcretSIyqGOJNOr74RzcFJPG1KWEGM3Pwj2qdb6uYGPkDEzXuk3Qx7h4XBsxPN7hcnn7w
22:46 ced117VM left 22:48 eater joined 22:55 haveTD joined
haveTD SWSGafx96ipE0nRBDxJGZB9KOQ4Hl103MoGExWsJIGsj8lXLqgxaSyRsjAoYU4H0lCV7o1XKTtedl76vddyze1PPJk1ZQtRkGEJEAJ0xIYIV4ubUpbFB3Iku 22:55
22:55 haveTD left 22:59 LumpiBM joined, LumpiBM left 23:15 pokkGZ joined, pokkGZ left 23:38 dogbert11 left 23:39 dogbert11 joined 23:42 dogbert17 joined 23:44 dogbert11 left 23:46 dogbert2 joined 23:47 dogbert11 joined, dogbert11 left 23:48 dogbert17 left 23:49 dogbert11 joined 23:51 dogbert2 left