github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
timotimo stagestats uses MVM_bigint_from_num 00:40
most probably because literals in nqp are nums, and if you want to create a bigint, you can't just box_I, you have to fromnum_I
that seems to be all the invocations for MVM_bigint_from_num in stage compilation 00:41
MasterDuke ugh, i'd like to make progress on my default-nqp-to-int branch, but it's not easy 00:49
timotimo yeah, i totally agree that it's hard 00:50
MasterDuke changing topics, what do you think about my suggestion to make the parameter to --profile be the filename instead of the kind, and then change --profile-filename to --profile-kind? 00:54
timotimo actually i started - long ago - on a branch that lets you put more parameters in the --profile argument 01:07
i wanted that for the heap snapshot profiler so that it could be told to only take snapshots when there is a major collection
since sometimes there are hundreds of minor collections in a row, and that leads to extremely big files 01:08
would you say that should go into --profile-kind as well, then? 01:09
i.e. switch them completely?
MasterDuke yeah, i'd say switch them 01:16
MasterDuke at least personally, i've created maybe 3 heap profiles ever 01:17
and maybe 300 profiles that i had to use --profile-filename for
not very huffmanized for my use 01:18
timotimo that does make sense 01:22
it'd be good to have a transition period where both styles are allowed
MasterDuke you think there are that many people creating heap profiles? 01:25
timotimo hm 01:30
timotimo with an example like .words() where the default is Inf, spesh might be able to turn the "while $count < $limit" into essentially "loop" 02:41
no, i mean "repeat"
timotimo goes to bed 02:42
brrt \o 08:42
timotimo: I have a *very* similar branch I was working on :-) 08:43
lizmat Q: what *is* the difference between nqp::assign and nqp::p6assign? 08:59
brrt (no idea)
lizmat apparently, according to commit message, the p6 version is using a spesh plugin 09:00
we have 4 cases of nqp::assign in core: I wonder if those should be changed as well ? 09:01
timotimo don't we also have something better than assign + scalarfromdesc? 09:04
lizmat I believe so: that piece of code hasn't been touched in 2 years 09:06
jnthn nqp::p6assign uses the spesh plugin (on MoarVM, equivalent to assign otherwise)
brrt is about to remove the jit log file altogether
jnthn I think all cases can be updated, *but* as timotimo mentioned some cases have better options than a direct replacement 09:07
lizmat jnthn: so it is safe to just s/assign/p6assign/ ? 09:07
jnthn Safe but it's worth looking at each one 09:07
lizmat or maybe just rewrite it using = ?
jnthn Because there's a scalarwithvalue op that combines creation and initialization and skips the whole handling of default value, because we know it'll never be read 09:08
Which is a nice saving
lizmat and if the descriptor is nqp::null ? 09:09
jnthn Then assign will always fail?
lizmat "nqp::assign(nqp::p6scalarfromdesc(nqp::null),iterable)"
been sitting in the code for 2 years without any spectest fails :-( 09:10
jnthn Oh, right, that depends on using the default descriptor...I think I found a better way of handling that in most cases.
Since it means a null check and conditional every time
jnthn Anyway, the reason I didn't just blanket change them is so they could be each carefully audited for the optimal change. 09:11
lizmat right
lemme see if I can do such an audit 09:12
jnthn See in Actions.nqp for the various desugars available
lizmat I was looking at Array::ASSIGN-POS 09:13
jnthn I'm very sure that's one I audited... 09:14
Yes, looks like that's been carefully crafted indeed :) 09:15
To be just under the inline size limit :) 09:16
Geth MoarVM/jit-comment-on-spesh-log: 11 commits pushed by (Timo Paulssen)++, (Bart Wiegmans)++
review: github.com/MoarVM/MoarVM/compare/2...815677f827
09:41
timotimo btw, in theory we could collect spesh logs for spec test runs and see if any frames switch between "can be inlined" and "cannot be inlined" and automatically report that 09:42
brrt aye. 09:45
timotimo: I took your branch a bit further, there's no more jit log now; I wonder if we can get away with getting rid of the bytecode directory entirely 09:46
timotimo how do you reckon? 09:53
brrt well, I mean, i don't want to have to specify it
timotimo so, always have it if the spesh log is turned on? 09:54
brrt I want something like MVM_JIT_DUMP_BYTECODE=1 and have it dump the bytecode to /tmp
no
timotimo ah
brrt well, a subdirectory of /tmp
timotimo would it go into /tmp/moarjit.PID/ or something?
brrt I can us uv_os_tmpdir
something pretty much exactly like htat
anyway, lunch & 09:55
lizmat jnthn: I'm confused: should this work or not: 10:15
m: use nqp; my $a := nqp::p6bindattrinvres(nqp::create(Scalar),Scalar,q/$!value/,42); say $a; $a = 666; say $a
camelia 42
Cannot assign to a readonly variable or a value
in block <unit> at <tmp> line 1
jnthn No.
Because no descriptor means readonly
lizmat aha
lizmat but, I don't have a descriptor there, so what should I put in the $!descriptor then ? 10:16
jnthn That's what I was saying early. The scalarfromdesc op has to do a null check inside of its desugar to check if the descriptor provided is null, and if so then it uses the default one instead
*earlier
lizmat so I should still be using scalarfromdesc ?
jnthn Well, you could, but perhaps better is to just obtain the default descriptor 10:17
lizmat I'm looking at [foo], there is no Array, and no descriptor yet
jnthn nqp::getcurhllsym('default_cont_spec') or some such 10:18
lizmat ack
jnthn Maybe shove a BEGIN before it so that at runtime you just have a QAST::WVal which is cheap :) 10:20
lizmat ah, I guess that can be done at some more places then 10:20
lizmat afk for a few hours& 10:28
dogbert2 jnthn: will there be an 'opt of the day' ? 10:30
brrt oh, good news folks 12:44
I'm looking at the libuv test suite
I think we can actually call the synchronous FS files without a loop instance
because, tests/test-fs.c does that all the time 12:45
timotimo that ought to also let us create more threads before the number of open files hits the limit
right?
brrt I'm not sure I follow
timotimo creating an uv loop costs, i believe, two file handles
brrt seriously?
timotimo i'm not 100% sure 12:46
jnthn I think timotimo is right 12:49
brrt okay, that's good news actually 12:50
I checked, and we can call all the synchronous fs stuff without a uv loop 12:51
'the tests do it so it must be OK'
brrt btw, samcv++ # nice post 13:21
jnthn dogbert2: There may be an opt of the day. Currently looking into the sub-optimal handling I'm seeing with spesh of array assignment... 13:27
And noticing I maybe misread... 13:28
Yeah, I did; something's maybe still wrong but not what I thought. 13:30
And ASSIGN-POS doesn't inline yet after all
dogbert2 is ASSIGN-POS too large? 13:34
jnthn Yeah
I'm wondering if I can split it
dogbert2 do you think it will be a big win if you can inline it? 13:35
Zoffix I just got "MoarVM oops: Spesh: instruction box_i missing from define-use chain" 13:36
jnthn Yes :)
Zoffix: umm...congrats... 13:37
Zoffix: Did you have the DU-chain checking mode turned on?
Zoffix I've no idea what that is, so unless it's on by default, I'm gonna say no
jnthn No, you'd have to have turned it on, but I just checked and that's the error that can be raised in normal operation. 13:38
Zoffix It's with this piece of code, when trying to run it with --profile --profile-filename=out.html gist.github.com/zoffixznet/c4fd06a...6cfd2d28db
jnthn Ah, it only happens when profiling?
Zoffix Yeah
jnthn breathes a half sigh of relief :)
Zoffix :D
jnthn I think timotimo++ already encountered this and was looking at it... 13:39
Zoffix Ah, ok
jnthn Please could you make a ticket though, so we don't lose it? 13:40
Zoffix yeah 13:41
jnthn Thanks
Zoffix M#971 13:46
synopsebot M#971 [open]: github.com/MoarVM/MoarVM/issues/971 Profiling a code gives MoarVM oops: Spesh: instruction box_i missing from define-use chain
Geth MoarVM/jit-comment-on-spesh-log: fe7ea0c35f | (Bart Wiegmans)++ | 2 files
[JIT] Dump bytecode in /tmp

No need to specify the exact bytecode directory, if we can put it in a consistent place anyway.
14:14
Geth MoarVM: a5dd7652d4 | (Bart Wiegmans)++ | 7 files
[threadcontext] Remove per-thread libuv loop object

According to the libuv tests, we don't actually need a libuv loop object for the synchronous FS operations. Which means that we can use libuv for cross-platform portability, but we don't have to create and maintain a libuv loop structure, other than the one for the actual event loop.
14:37
jnthn brrt++ 14:43
Geth MoarVM: bdw++ created pull request #972:
Remove JIT log file
brrt ok, dinner & 14:45
Geth MoarVM: 1500090a38 | (Jonathan Worthington)++ | src/spesh/optimize.c
Optimize ifnonnull branches out

If we can determine which way they would branch, then eliminate them.
14:56
MoarVM: 597ccb09e3 | (Jonathan Worthington)++ | 5 files
Pass on type tuple when inlining unspecialized

In the case of a speculative inline where we have a stable type tuple, this means that we can use the argument types inside the specialization
  (previously we could only do that when we have all of the information
in facts).
jnthn m: say 2.051 / 955 15:35
camelia 0.0021476
jnthn m: say 2.051 / 0.955
camelia 2.147644
lizmat so what just got 2x as fast ? 15:39
yoleaux 12:11Z <El_Che> lizmat: "Elizabeth Mattijsen has been programming for a living since 1978 in various (mostly now defunct) programming languages." <-- I think the "dead languages" introduction will be associated with Perl 5 and 6 by casual readers. I would drop that part.
12:31Z <Zoffix> lizmat: would NQP benefit from the same BUILDALL gen you did in Rakudo? I imagine we create a ton of QAST objects. A plain `nqp::create(QAST::Op)` is 4.14x as fast as `QAST::Op.new`. I don't know if it could be genned when attributes are present, but it smells like there could be a nice win for compilation time (at least of Rakudo)
jnthn lizmat: the following: 15:40
for ^10_000 {
my @arr;
for ^1_000 {
@arr[$_] = 42;
}
}
lizmat cool
jnthn Alas, Perl 5 is still 1.78x as fast at it On My Machine (yes, I know, it gets to not have Int allocations, but still, this is what the typical user would compare) 15:41
So still some improvement to find yet :) 15:42
lizmat yeah, but I've heard plenty of people say that even if Perl 6 would be 2x as slow as Perl 5, they would go for it
so, in this benchmark, we're already there
jnthn
.oO( Yeah, but I want to win the benchmark :P :P )
Geth MoarVM: 3ea4a81a21 | (Jonathan Worthington)++ | src/spesh/plan.c
Fix poor inlining due to wrong plan sorting

We sorted the plan by stack depth, which is a decent approximation, but sometimes we could have a situation where a caller and callee planned for specialization would end up with the caller having a greater maximum observed stack depth than the callee.
If we detect such a case, give the callee one a boost, so that we'll do them in a more sensible order, leading to more inlining chances.
15:50
timotimo i want moar to get a --developer mode where instead of MVM_SPESH_LOG i can just put MSL in the environment ...
lizmat .tell El_Che adapted the "about me" to prevent possibly perceived association 15:52
yoleaux lizmat: I'll pass your message to El_Che.
lizmat .ask Zoffix But then how would one set the attributes? nqp::bindattr's everywhere ? 15:55
yoleaux lizmat: I'll pass your message to Zoffix.
Zoffix lizmat: no, the enduser code would not change. 15:56
timotimo excuse me, but what was the context for this? 15:57
Zoffix lizmat: basically yesterday I had `Foo.new: :42x, :70bar` that was way faster in Rakudo than it was in nqp and jnthn said it's cause nqp's BUILDALL is not codegenned, so the natural thought is what if it were: would that benefit the compilation
timotimo: this: colabti.org/irclogger/irclogger_log...09-26#l690 15:58
and "<Zoffix> Aye, this version runs in 0.243s on HEAD: gist.github.com/zoffixznet/90c3c48...4d1a3e6c49 vs 4s for the other one"
m: say 4/.243
camelia 16.460905
lizmat jnthn: is there a reason why you didn't do the same opt for the "int $pos" candidate ? 16:00
lizmat if not, I'll do that :-) 16:00
jnthn lizmat: um, no, just forgot :) 16:01
lizmat ok, will take care of it then :-) 16:02
Zoffix $ time ./nqp -e 'class Foo { has $!x; has $!y }; my int $x; while $x++ < 1_000_000 { Foo.new: x => 42, y => 70 }' 16:02
real 0m4.522s
$ time ./perl6 -e 'class Foo { has $.x; has $.y }; my int $x; while $x++ < 1_000_000 { Foo.new: x => 42, y => 70 }'
real 0m1.056s
lizmat but after dinner&
Zoffix lizmat: ^ that's what I meant.
Perl 6 is way faster than NQP, so my assumption is that we can make NQP at least the same speed as Perl 6 16:03
to improve compilation speed
timotimo does the buildplan executor show up in profiles, i wonder? 16:04
or for that matter the constructors of QAST nodes
well, those are already partially hand-optimized
Zoffix didn't try 16:05
Geth MoarVM: 51610604c1 | (Jonathan Worthington)++ | src/spesh/log.c
Correct "should we log parameters" check

Fixes a regression when the parameter logging was refactored recently. We can't use the standard way to check at this point, because we're doing it during invocation, and so haven't set everything up yet. All we really need to check is that there's a log to write into.
16:42
timotimo my blind working hypothesis for the define-use-chain problem in the profiler: perhaps we're deleting an instruction twice and that's what blows it up 20:51
can't check immediately, though
timotimo yeah, it's kind of being deleted twice 22:47
delete ins 137 0x7f21f8099b98 prof_allocated
delete ins 137 0x7f21f8099b58 box_i
[...]
delete ins 137 0x7f21f8099b58 box_i
MoarVM oops: Spesh: instruction box_i missing from define-use chain
MasterDuke timotimo: easy fix? 22:52
timotimo i believe so 22:53
MasterDuke nice
Geth MoarVM: 67f85dc711 | (Timo Paulssen)++ | src/spesh/optimize.c
optimize_prof_allocated shouldn't try to mess with writers.
22:56
timotimo this ought to do it.