github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
01:00 Ven`` left 01:13 Ven`` joined 01:53 Ven`` left 01:54 Ven`` joined 02:02 Ven`` left 03:08 robertle left 03:10 robertle joined 05:26 lizmat left, robertle_ left
nine timotimo: the fact that we get wrong results only a single time during each run makes me think that the generated code is OK but something goes wrong while replacing the original code with the speshed one. Alas running with MVM_SPESH_OSR_DISABLE=1 does not fix the issue. 06:43
06:47 domidumont joined 06:53 domidumont left 06:54 domidumont joined 07:24 zakharyas joined
Geth MoarVM: fbc61e4911 | (Bart Wiegmans)++ | 2 files
Revert "Implement JIT templates for 10 ops"

This reverts commit 434e4950a77f488e6a03b151d91c69380b656e0f.
07:41
07:42 brrt joined
brrt \o 07:44
masak o/ 07:46
brrt ohai masak 07:47
the commit I just pushed probably, almost certainly, fixes our issues with MoarVM JIT on windows 07:48
not entirely sure why yet, but whatevs
08:01 travis-ci joined
travis-ci MoarVM build failed. Bart Wiegmans 'Revert "Implement JIT templates for 10 ops" 08:01
travis-ci.org/MoarVM/MoarVM/builds/409732094 github.com/MoarVM/MoarVM/compare/6...c61e491132
08:01 travis-ci left 08:55 lizmat joined 09:05 brrt left 09:38 stmuk_ joined 09:40 stmuk left 11:11 zakharyas left
Geth MoarVM: 936dab02b5 | (Ben Davies)++ (committed by Bart Wiegmans) | 2 files
Implement JIT templates for 10 ops

Adds JIT support for the following ops:
  - isinvokable
  - getlexreldyn
  - objprimunsigned
  - scgethandle
... (9 more lines)
11:39
MoarVM: 21ea40f68b | (Bart Wiegmans)++ | 2 files
[JIT] Remove captureposarg_n

MVM_args_get_pos_num returns a MVMArgInfo struct as a value, and the ABI of doing so is underdocumented and inconsistent between POSIX and Win64. So what worked on POSIX didn't work on windows. These functions need to be cleaned up for the benefit of the JIT.
12:25 Ven`` joined 12:26 Ven` joined 12:30 Ven`` left 12:33 diakopter joined 12:59 zakharyas joined 13:00 Ven` left
dogbert2 o/ 14:05
does anyone know if the code activated when setting the MVM_SPESH_CHECK_PRESELECTION flag has bitrotted? 14:06
i.e. github.com/MoarVM/MoarVM/blob/mast...frame.c#L6 14:07
enabling it sometimes generates stack dumps starting with - Inconsistent spesh preselection of 'parse' (141): got 0, not -1 14:08
at src/Perl6/World.nqp:5168 (blib/Perl6/World.moarvm:canonicalize_pair)
14:42 diakopter left 15:00 diakopter joined 15:40 domidumont left
timotimo i wonder what the right way would be to make spesh understand p6bool, given it's an extop 15:51
[Coke] kill the extops with fire?
timotimo well, yeah, but still ... 15:52
diakopter aw, why hating on extops
(I missed a year or few of this..)
timotimo turning it into a desugar will give us three BBs where we used to not have 'em
japhb diakopter: Because opaque to more advanced optimizations.
15:53 zakharyas left
diakopter japhb: ah, unless the extops also could provide several expression forms of themselves 15:53
timotimo and i think turning it into a ?? !! like construct at the bytecode level will not allow us to simply say "oh we can just take the truth value of what was originally passed"
japhb diakopter: Once they are providing that information, why not just go the desugar route?
timotimo what i'm worried about happens long before the expr jit happens, though
well, at least p6bool isn't expensive, it literally just assigns a pointer into a register after comparing an int64 against 0 15:54
unbox_i on it, however, that could be improved
japhb And a decont? 15:55
diakopter aww, it's almost as if programmers need some way of writing computation expressions in some universally unambiguous way
timotimo an extremely hacky special-case would be if we absolutely know that the type is exactly Bool, and it's definite, we can compare against one of the two bool values we know about
i don't think decont applies here
japhb diakopter: šŸ™„ 15:56
diakopter japhb: uh huh :D 15:57
but seriously though, that is the root problem here; the various compilers can't coordinate semantically, whereas they could if they had a common language to express (pure, closed) computations unambiguously 15:59
note I'm just saying pure & closed computations... you know, the easy ones.
timotimo: what about giving an extop a hook to send spesh some facts 16:05
timotimo that already exists :) 16:06
diakopter oh rotfl
timotimo we also ask reprs to spesh reprops called on them, if the type is known etc 16:07
diakopter neat
if only spesh could partially evaluate, formally, that is
timotimo i wonder why exactly the unbox_i doesn't turn into a sp_p6oget_i
oh, huh, the boolification mode for Int is, of course, "bigint" 16:08
but the boolification mode for Bool is "unbox_int" 16:09
that should be visible to our code already
hum. 16:11
so every Bool has both an int $!value from Bool and a bigint $!value from Int
16:11 domidumont joined
timotimo BBL 16:15
16:16 Ven`` joined 16:22 robertle left 16:38 Ven`` left 16:40 Ven`` joined
timotimo hm, so i'm looking at a speshlog of my int $a; for ^10_000_000 { $a = rand < 0.5e0 } 17:24
it's using decont_i on the return value of the < call
what decont_i does is check if there's a container spec, and since there isn't one, it resorts to MVM_repr_get_int 17:25
at the very, very least spesh can see that there's no container spec and emit an unbox_i instead 17:29
that'll be a tiny bit faster
but really, i want to get the unbox_int_slot, turn it into an integer offset, and generate a sp_p6oget_o
sorry, sp_p6oget_i 17:31
in theory escape analysis/allocation sinking could cooperate with this optimization, but that means p6bool would have to turn into "clamp this int to 0 or 1, allocate a Bool, box the integer value"
which means if the optimization doesn't fully go through, it'll become an allocation 17:32
17:39 lizmat left 17:42 Ven`` left 17:44 lizmat joined 17:48 Ven`` joined 17:57 lucasb joined
lucasb As a data point, I tried to reproduce R#2147 in my 32bit x86 machine, but was not able to, no segfault here 18:00
synopsebot R#2147 [open]: github.com/rakudo/rakudo/issues/2147 [SEGV] segfaults raised when trying with this code.
18:04 Ven`` left 18:37 buggable left, buggable joined 18:38 buggable left, buggable joined 19:01 domidumont left
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2018/07/30/...t-garbage/ 19:09
timotimo lizmat++ 19:19
(the weekly)
(that somehow didn't make it into this channel :P)
actually, it did. my terminal was just messing with me 20:48
20:59 Ven`` joined
samcv good * 21:24
timotimo heyo samcv 21:25
samcv hey hey 21:27
timotimo trying to make unbox_i on p6bool a little bit faster 21:36
stumbled over the fact that our Bool objects have the value in themselves twice, once as a bigint, once as a 64bit int
this'll also allow us to make unbox_i and decont_i faster on all P6bigint and P6opaque that has P6bigint inside it 21:51
that's the hope anyway 21:52
samcv nice 21:56
timotimo now i "just" need to jit the new op i had to make up for this purpose :)
the exprjit doesn't reach the op in my example code, so i at least know i only have to build it in the ole jit 21:58
22:07 Voldenet left 22:09 lucasb left 22:30 Ven`` left 22:36 Ven`` joined
timotimo aaw, it seems to be within noise for this particular test 22:40
m) m) m) m) 22:42
hllboxtype_i, box_i, sp_p6ogetbigint_i (my new optimized op!!), hllboxtype_i, box_i, ... return_o
it's really doing that
that's incredible
sp_p6ogetbigint_i gets used in the code nativecall generates for c function calling, cool. 22:49
m) in one of the instances it uses sp_getarg_i, boxes it, just to unbox it later on 22:50
beautiful
22:55 Ven`` left, Ven` joined 23:02 Ven` left
timotimo that's pretty nice, though. in the "particles.p6" example script from SDL2::Raw, the "render" method actually inlines: SDL_SetRenderDrawColor, Mu's sink, SDL_RenderClear, Mu's sink (again), SDL_SetRenderDrawColor, Mu's sink (again), SDL_RenderDrawPoints, Mu's sink (again), SDL_RenderPresent, and "identity" 23:12
MasterDuke has that example script gotten any noticeably faster? 23:24
timotimo it's very very noisy at the best of times 23:25
MasterDuke ah 23:27
timotimo i see the optimization triggered a few times during "zef list" 23:28
hum, when is it actually safe to turn an unbox_i into the value at spesh time when we have a "known value"? 23:29
i see a few cases where unbox_i is called on a wval; that could become a const_i64 (and maybe _16)
MasterDuke when wouldn't it be safe? 23:30
timotimo any time we have classes that allow their box slot to change values over the course of its lifetime
i'm not sure if that's possible?
p6bigint has a set_int function, which is what's used to initialize it 23:31
i.e. box_int is more or less just allocate + set_int
but i don't think we do anything to prevent it from being set again later on
MasterDuke is that the sort of thing a guard could be created for? 23:33
btw, any idea why my default-to-int nqp would cause `Stage optimize : Unhandled exception: This type (Scalar) does not support associative operations at SETTING::src/core/Rakudo/Internals.pm6:735`. 23:35
that's in the PERLIFY-STR method
timotimo perhaps some op should have a :decont annotation in the QASTOperations? 23:37
try "call MVM_dump_bytecode(tc)" if you have a breakpoint where it explodes 23:38
you may be able to see what does it 23:39
MasterDuke heh, there is a stacktrace, but i didn't even think to look down for where in nqp code it was 23:41
timotimo++
hm, not immediately obvious though... 23:49
timotimo say
(1 + 0.123 / n) ** n, right?
MasterDuke ? 23:50
timotimo can we figure out that the end result can't be expressed properly in Rat, and change to Num calculations earlier? 23:51
MasterDuke gist.github.com/MasterDuke17/f0a3e...cee4128971 if you're interested in the stacktrace
why could it be expressed in Rat? 23:52
timotimo you mean "couldn't"?
MasterDuke yep
timotimo that's the question, really
i mean, exponentiating the Rat by n means exponentiating both the numerator and denominator by n
and to get a proper Rat back, we have to find the GCD
the crux is that the decision whether to result in Rat or Num is done after getting the right denominator 23:53
japhb timotimo: I see you use the emoticon 'm)' a lot. What does it mean?
timotimo it's a facepalm emoticon 23:54
interpret the legs of the m as fingers
japhb Ah. 23:55
timotimo how's your number theory, japhb? :)
japhb Not as good as masak's, why?
MasterDuke there's a relevant rakudo issue 23:57
timotimo knowing A and B for A gcd B, can we easily figure out if the result has to be above a certain number X?
japhb I mean, to your question above, if you exponentiate a Rat, I'd think you'd want to first get it into lowest terms, and then you know that numerator and denominator have no common factors, thus relatively prime, thus the entire question comes down to how big the denominator will exponentiate to -- because it won't cancel after exponentionation if it didn't before.
timotimo oh, really?
japhb Well, that's the definition of lowest terms, yes?
timotimo i ... think so? 23:58
hm, right 23:59
you'll end up with a row of x * x * ... * x at the top and y * y * ... * y at the bottom
japhb right
timotimo if the Rat was already sane before, which i do believe we try to enforce?, then we won't make any headway after exponentiation