Friday, 2023-09-15

*** gnucode <gnucode!~gnucode@user/jab> has quit IRC00:25
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc00:25
*** psydroid <psydroid!~psydroid@user/psydroid> has quit IRC01:00
*** psydroid <psydroid!~psydroid@user/psydroid> has joined #libre-soc01:02
*** yambo <yambo!~yambo@184-167-135-012.res.spectrum.com> has quit IRC01:19
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC02:37
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc02:37
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC03:03
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc03:04
*** yambo <yambo!~yambo@184-167-135-012.res.spectrum.com> has joined #libre-soc03:32
*** psydroid <psydroid!~psydroid@user/psydroid> has quit IRC04:38
*** sauce <sauce!~sauce@free.and.open.sauce.icu> has quit IRC05:53
*** sauce <sauce!~sauce@free.and.open.sauce.icu> has joined #libre-soc06:07
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC09:51
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc09:52
*** Lucretia <Lucretia!~laguest@user/lucretia> has quit IRC11:07
*** Lucretia <Lucretia!~laguest@user/lucretia> has joined #libre-soc11:17
*** Lucretia <Lucretia!~laguest@user/lucretia> has quit IRC11:22
*** Lucretia <Lucretia!~laguest@user/lucretia> has joined #libre-soc11:30
*** Lucretia <Lucretia!~laguest@user/lucretia> has quit IRC11:37
*** Lucretia <Lucretia!~laguest@user/lucretia> has joined #libre-soc12:09
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC12:15
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc12:15
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC12:25
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc12:25
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC12:35
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc12:35
*** psydroid <psydroid!~psydroid@user/psydroid> has joined #libre-soc12:40
markos_any ideas what's the deal with the mou? are there any changes needed yet? has it been sent and we are just waiting for nlnet?12:43
markos_s/any ideas/any updates on/12:44
openpowerbot[irc] <sadoon[m]1> alright catching up today, vroom vroom poly130513:02
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC13:41
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc13:41
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC15:39
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc15:40
openpowerbot[irc] <sadoon[m]1> Toying around with power asm (inline in C) just to get a grasp on things, haven't dealt with assembly since 2018 heh15:59
openpowerbot[irc] <sadoon[m]1> Also ran the chacha20 tests, will look into the code now15:59
openpowerbot[irc] <sadoon[m]1> It looks.. intuitive enough I can say16:02
jnone of the weird quirks of POWER asm is that it doesn't seem to (natively) distinguish between register numbers and numbers which are meant as numbers themselves, so if you use a register in place of a number or vice versa, bad luck, it will be misinterpreted rather than throwing an error16:11
jn(unlike, say, arm32, where you have a clear distinction between r5 (register) and #5 (immediate number))16:13
openpowerbot[irc] <programmerjake> but that also means you can do arithmetic on register numbers16:13
jni guess that can be useful sometimes16:13
openpowerbot[irc] <sadoon[m]1> was about to ask what setvl does, the wiki sure is great :D https://libre-soc.org/openpower/sv/setvl/16:31
markos_jn, mind you there is also -mregnames to the assembler, though they're just aliases16:32
openpowerbot[irc] <sadoon[m]1> markos_ IIUC, quarterround_const basically sets all the constants used for chacha20 correct?16:35
markos_these are actually the constants used in the SVSHAPE instructions16:37
markos_read the wiki for chacha2016:37
markos_https://libre-soc.org/openpower/sv/cookbook/chacha20/16:37
openpowerbot[irc] <sadoon[m]1> awesome, that's a good start thanks16:37
openpowerbot[irc] <sadoon[m]1> Time to pull out the eink tablet16:38
openpowerbot[irc] <sadoon[m]1> Just finished reading it... WOW.17:17
openpowerbot[irc] <sadoon[m]1> I knew svp64 was awesome but it felt like an enigma for so long17:18
markos_it is beyond awesome17:18
markos_try doing that in any other SIMD architecture17:18
openpowerbot[irc] <sadoon[m]1> Helped me appreciate what it is17:19
openpowerbot[irc] <sadoon[m]1> Yeah17:19
markos_it is not easy to understand17:19
openpowerbot[irc] <sadoon[m]1> No but the wiki helps a lot, thanks for writing it btw17:20
markos_not at first at least, because we all are too accustomed to thinking with packed vectors17:20
markos_it also helped me understand it better17:20
openpowerbot[irc] <sadoon[m]1> Well17:20
markos_I hope to write more stuff like that in the future17:20
openpowerbot[irc] <sadoon[m]1> I'm fresh to vectors to start so I'm not delearning anything which helps17:20
openpowerbot[irc] <sadoon[m]1> :D17:20
markos_indeed it helps17:21
markos_I had to unlearn many things after programming in SIMD for ~19 years (since 2004)17:21
openpowerbot[irc] <sadoon[m]1> Wow yeah17:26
openpowerbot[irc] <sadoon[m]1> I'll sum up my notes here and attach them to the bugreport as well:17:26
openpowerbot[irc] <sadoon[m]1> We have a max element size of 64-bit which is absolutely perfect because a- the poly1305-donna implementation supports 8,16,32, and 64 bits, and b- my HDL project specifically targetted 64-bits (could have gone up to 128 or even 256 in some cases but was short on time)17:28
openpowerbot[irc] <sadoon[m]1> poly1305 is also a bit simpler on the mathematical side, only adds and muls, some shift-rights and shift-lefts17:31
openpowerbot[irc] <sadoon[m]1> if we had bigger element sizes some things can be shortcut, but it's really not necessary17:32
openpowerbot[irc] <programmerjake> well, with the bigint instructions and some hw optimizations, we can get effectively 256-bit integer add/sub/and/or/xor and 256x64->320-bit integer mul17:34
openpowerbot[irc] <sadoon[m]1> Is bigint already implemented?17:34
openpowerbot[irc] <sadoon[m]1> That would be sick17:34
openpowerbot[irc] <programmerjake> yes, the instructions are, in the simulator.17:34
openpowerbot[irc] <sadoon[m]1> fucking amazing17:35
openpowerbot[irc] <sadoon[m]1> mind my French17:35
openpowerbot[irc] <sadoon[m]1> for example we have h = h*r, where h is 3 64-bit variables and MANY instructions are needed to get it right17:35
openpowerbot[irc] <sadoon[m]1> It's basically grade 3 maths of mul and add just to get it right17:35
openpowerbot[irc] <sadoon[m]1> With bigint 256-bit size, it's literally one instruction17:36
openpowerbot[irc] <sadoon[m]1> MUL(d0, h0, r0); MUL(d, h1, s2); ADD(d0, d); MUL(d, h2, s1); ADD(d0, d);17:36
openpowerbot[irc] <sadoon[m]1> MUL(d1, h0, r1); MUL(d, h1, r0); ADD(d1, d); MUL(d, h2, s2); ADD(d1, d);17:37
openpowerbot[irc] <sadoon[m]1> MUL(d2, h0, r2); MUL(d, h1, r1); ADD(d2, d); MUL(d, h2, r0); ADD(d2, d);17:37
openpowerbot[irc] <sadoon[m]1> This is the most computationally expensive part of the loop17:37
markos_programmerjake, mind listing the 256-bit arithmetic instructions as I'm going to need them as well, or the wiki page listing them if there is one17:37
openpowerbot[irc] <sadoon[m]1> Also17:37
openpowerbot[irc] <sadoon[m]1> h0 += (( t0                    ) & 0xfffffffffff);17:38
openpowerbot[irc] <sadoon[m]1> h1 += (((t0 >> 44) | (t1 << 20)) & 0xfffffffffff);17:38
openpowerbot[irc] <sadoon[m]1> h2 += (((t1 >> 24)             ) & 0x3ffffffffff) | hibit;17:38
openpowerbot[irc] <sadoon[m]1> This one I already did in hardware in one FSM state17:38
openpowerbot[irc] <sadoon[m]1> Also doable the same way in bigint17:38
openpowerbot[irc] <sadoon[m]1> Because h is now one 256-bit unsigned int17:38
openpowerbot[irc] <programmerjake> bigint isn't quite 256-bit, but instead a sv loop chains a sequence of 64-bit ops together to get a N*64-bit add or a 64 by N*64-bit mul17:38
openpowerbot[irc] <programmerjake> https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/test/bigint/bigint_cases.py;h=38ad4e084682dc342c9dbc1c412c415cef3eda33;hb=ca22d9687c91e764bb463ee776fb2f6efbf6eae9#l23617:39
openpowerbot[irc] <sadoon[m]1> Still means we don't have to do carry rollover our selves17:39
openpowerbot[irc] <programmerjake> a 256x256->512-bit mul: https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/test/bigint/powmod.py;h=fa43ede5bbb2639431dfa2092ac702988e5b5e7b;hb=ca22d9687c91e764bb463ee776fb2f6efbf6eae9#l2017:39
markos_yeah, I meant those, thanks17:40
openpowerbot[irc] <programmerjake> for the full list of new bigint insns, see: https://libre-soc.org/openpower/sv/rfc/ls003.bignum/17:42
openpowerbot[irc] <programmerjake> some bigint ops don't need new insns, e.g. add is just sv.adde17:42
openpowerbot[irc] <sadoon[m]1> sadoon[m]1: Oh now I remember, this is just masking off some bits, so I did it in HW by truncating the register, fun17:42
*** choozy <choozy!~choozy@80-62-174-82.ftth.glasoperator.nl> has joined #libre-soc17:45
markos_perfect thanks17:45
openpowerbot[irc] <sadoon[m]1> For fun, here is my poly1305 hw implementation from almost two years ago17:49
openpowerbot[irc] <sadoon[m]1> https://albader.co/poly1305.sv17:49
openpowerbot[irc] <sadoon[m]1> You can tell it was done in a hurry but hopefully it's slightly more readable than the C implementation17:50
openpowerbot[irc] <sadoon[m]1> The data bits are hardcoded of course17:51
openpowerbot[irc] <sadoon[m]1> (the message to authenticate)17:51
markos_looks like C17:52
openpowerbot[irc] <sadoon[m]1> Line 246 (S_BLOCKS_2) is where the multiplication happens, here reduced to one state again17:52
markos_but not quite17:52
markos_what is it, HDL?17:52
openpowerbot[irc] <sadoon[m]1> Yep, that's verilog/systemverilog17:52
openpowerbot[irc] <sadoon[m]1> Yep17:52
markos_ah17:52
markos_the tabs are funny, vim has messed up17:53
openpowerbot[irc] <sadoon[m]1> heheh would you beleive I used vim to write this17:53
markos_of course I would why would you use something else? :D17:53
openpowerbot[irc] <sadoon[m]1> Agree17:54
openpowerbot[irc] <sadoon[m]1> :)17:54
openpowerbot[irc] <sadoon[m]1> The reason I'm mentioning this implementation is because the real bummer was having to use 4 states just to put the numbers back together (BLOCKS_5-8), this is entirely gone with bigint17:54
openpowerbot[irc] <sadoon[m]1> If anyone wants the testbench simulation of this I can also send it for your enjoyment, keep in mind I used modelsim back then but as long as you use sv2v and iverilog/verilator it can work fine I think17:55
markos_too much of a newbie in this stuff yet17:56
openpowerbot[irc] <programmerjake> i had to pipe through expand -t2 ...17:56
openpowerbot[irc] <sadoon[m]1> Yeah.. my silly uni days formatting17:56
openpowerbot[irc] <sadoon[m]1> The FPGA did manage to run at 90MHz with these though, and 75MHz with 7 of them running in parallel17:57
openpowerbot[irc] <programmerjake> reminds me of when i was learning C and the book i had recommended everyone come up with their own formatting style, now i think it best to just use an autoformatter and use a comm9n17:58
openpowerbot[irc] <programmerjake> common style17:58
openpowerbot[irc] <sadoon[m]1> Needless to say got an A on that project :D17:58
openpowerbot[irc] <sadoon[m]1> programmerjake: Couldn't agree more, it just gets in the way when you use your own style17:58
markos_don't forget this was back at the time where formatting was absolutely required in eg Fortran, this was considered a big FU to the Fortran coders' strict formatting rules :)18:00
markos_so being able to have relaxed and personalized formatting was such a big relief18:01
openpowerbot[irc] <programmerjake> yeah, though in hind sight having stricter formatting would have been nice, much easier to read any C code if everything is formatted the same18:02
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC18:02
markos_agreed there18:02
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc18:02
openpowerbot[irc] <programmerjake> though, if you haven't seen it yet, you should see the bourne shell's source, it's C with enough macros to make it a wannabe ALGOL18:03
openpowerbot[irc] <programmerjake> 🤮18:03
openpowerbot[irc] <programmerjake> e.g. https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/args.c18:06
openpowerbot[irc] <programmerjake> all the macros: https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h18:06
openpowerbot[irc] <sadoon[m]1> That's nuts18:13
openpowerbot[irc] <sadoon[m]1> Wow they literally macro'd curly braces and logical ops18:14
openpowerbot[irc] <sadoon[m]1> Cursed18:14
openpowerbot[irc] <sadoon[m]1> Cursed and *bourne* again eh? ;P18:15
Lucretiathat's called, realising the language you're using is shit.18:16
Lucretia...and is going to cause you problems.18:16
openpowerbot[irc] <sadoon[m]1> I mean C's syntax isn't its worst point all things considered18:18
openpowerbot[irc] <programmerjake> ALGOL was just popular at that time...18:18
openpowerbot[irc] <sadoon[m]1> I remember a professor talking about a competition of the most ambiguous C code18:19
openpowerbot[irc] <sadoon[m]1> It's hilarious18:19
openpowerbot[irc] <sadoon[m]1> You basically #define everything to have no discernable meaning18:19
openpowerbot[irc] <sadoon[m]1> And typedef etc18:19
openpowerbot[irc] <sadoon[m]1> Let's see if I can find the video18:20
openpowerbot[irc] <programmerjake> https://www.ioccc.org/2012/endoh2/endoh2.c18:24
openpowerbot[irc] <programmerjake> https://www.ioccc.org/2012/endoh2/hint.html18:24
openpowerbot[irc] <programmerjake> program that reformats itself in the shape of the digits of pi/e18:24
openpowerbot[irc] <programmerjake> c compiler for i386 that can compile itself: https://www.ioccc.org/2001/bellard.hint18:30
openpowerbot[irc] <programmerjake> https://www.ioccc.org/2001/bellard.c18:30
openpowerbot[irc] <programmerjake> more on that https://bellard.org/otcc/18:31
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC19:19
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc19:19
*** gnucode <gnucode!~gnucode@user/jab> has quit IRC19:58
*** gnucode <gnucode!~gnucode@user/jab> has joined #libre-soc19:58
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has quit IRC20:47
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has joined #libre-soc21:01
*** choozy <choozy!~choozy@80-62-174-82.ftth.glasoperator.nl> has quit IRC22:30
openpowerbot[irc] <programmerjake> I fixed the scalar EXTRA2 encoding (bug #1161), if someone can double-check my changes to the reference algorithms on the wiki, that'd be greatly appreciated! https://git.libre-soc.org/?p=libreriscv.git;a=commitdiff;h=24576f370d5b0b0282b821062c66e1ff39ab801922:57
openpowerbot[irc] <programmerjake> I did check insndb and afaict it's correct22:58
openpowerbot[irc] <programmerjake> for whoever is double-checking, please leave a comment on the bug and close it if you think it's fine: https://bugs.libre-soc.org/show_bug.cgi?id=116123:00
openpowerbot[irc] <programmerjake> maybe ghostmansd or lkcl can check it? since you've both worked on the EXTRA2/3 encodings before...23:01
*** Gooberpatrol66 <Gooberpatrol66!~Gooberpat@user/gooberpatrol66> has quit IRC23:15
*** Gooberpatrol66 <Gooberpatrol66!~Gooberpat@user/gooberpatrol66> has joined #libre-soc23:24

Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!