Wednesday, 2021-08-25

ghostmansd-pc4) we also quite often use another pattern -- XLEN*2 and XLEN*2-1 respectively (making up a 128-bit variable and filling it)06:46
ghostmansdIt seems some of my messages were dropped, re-sending07:53
ghostmansd-pc> so far most of pseudocode I've seen needs three types of adjustments wrt XLEN07:54
ghostmansd-pc> 1) get the first half of the register/variable (0:31)07:54
ghostmansd-pc> 2) get the second half of the register/variable (32:63)07:54
ghostmansd-pc> 3) get the sign (usually EXTS64)07:54
ghostmansd-pc> I assume there's a way to get these from a selectable int; what do you think if we establish three helpers?07:54
ghostmansd-pc> yes, we have .value/.bits in selectable int07:54
ghostmansd-pc> Hm. We have EXTZ function in pseudo-code, but there's none in helpers or isa/functions. Is there some dark magic behind it, or it's not tested?07:54
ghostmansd-pc> 4) we also quite often use another pattern -- XLEN*2 and XLEN*2-1 respectively (making up a 128-bit variable and filling it)07:55
programmerjakeadding helpers sounds good07:56
programmerjakeI'll let lkcl comment since I'm going to sleep07:59
ghostmansd-pcI'm also not sure about division, cf. divw et al. These are explicitly mentioned as ones that operate on specific width. The dividend checks are explicit (0x8000_0000, 0x8000_0000_0000_0000 and so on).10:16
ghostmansd-pcThis doesn't seem to apply to an unsigned divisions, though.10:20
ghostmansd-pcprogrammerjake: I assume it's not OK to have MemoryError in test_pipe_caller_long.py, like one I have? https://pastebin.com/GU0Mgkiq10:35
lkclwe eeed to be extra careful about how much in the way of helpers is added11:01
lkclthe "second phase" of the elwidth changes is to *override* the behaviour of every (existing) helper function11:02
lkclby first adding every single helper function to a *class* - rather than as globals11:02
lkcland thus allowing the helper function(s) - all of them - to also gain access to XLEN11:03
lkclthe pseudocode compiler would then be responsible for identifying that a helper was used and output "self.{INSERTHELPERNAME}" instead of just {INSERTHELPERNAME} as is done right now11:03
lkclevery new helper added will be required to have *full documentation* with a corresponding Request for Change to be submitted to the OpenPOWER ISA Working Group11:05
lkclit should not be done blithely, lightly, or arbitrarily "because we feel like it"11:06
lkcloccurrences of "0x8000_0000_0000_0000" (etc) i believe can be replaced with "0b1 | [0b0]*(XLEN-1)"11:07
lkcland the 0x7fff_ffff_ffff with the inverse11:08
lkclthe general practice of the spec has always been to spell things out explicitly, except where it's clearly going to be a royal nuisance. EXTS, EXTZ etc.11:15
lkclthere is no hard reason why the EXTZ (etc.) helper functions aren't used in the isafunctions (pyfnwriter). it will simply be down to the fact that nobody who has contributed to the spec has made use of any of them... yet11:17
lkclmy main point about the aversion to adding new helpers is that we need to think less like programmers and more like specification writers11:18
lkclin other words: think it through from two perspectives11:46
lkcl1) how much effort do we have to put into formally submitting Requests for Change to the spec (through the ISA WG, who have to vote on all and any proposed updates)11:47
lkcl2) when someone is smacked between the eyes like a 2x4 with a whopping 1,300 page document, what are the odds they'll read all of it?11:47
lkclpretty much zero11:47
lkclthey'll jump in, read a page, jump out.11:47
lkclthe spec is *already* obtuse as hell11:48
lkclif there's references to things that have to be looked up on another page, that makes it even more hostile to use (and thus risks them making mistakes)11:48
lkcltherefore11:48
lkclwhat i am saying is11:48
lkcldespite it being "inconvenient" (and exactly the kind of thing that drives a programmer nuts), *less* helpers and more *explicit expansion* is actually better11:49
lkclif it's explicitly spelled out, everything is right there, on the (one) page right in front of the person who's trying desperately to get to grips with an overwhelmingly-large document11:50
ghostmansd-pcok, fair enough13:41
ghostmansd-pcI'm not adding the helpers now, anyway :-)13:41
ghostmansd-pcHas anyone met the error I have in test_pipe_caller_long.py? https://pastebin.com/GU0Mgkiq13:42
ghostmansd-pcI'd like to test what I changed so far, but these are mostly mul/mod/unsigned-div instructions, and these are checked by test_pipe_caller_long.py.13:45
ghostmansd-pcprogrammerjake, please, correct me if I'm wrong. :-)13:46
ghostmansd-pcHm. What's the sign position in Power?14:01
ghostmansd-pcIsn't it the last bit?14:01
ghostmansd-pcI'm looking at extsb. I'd have expected 63 instead of 56 as sign bit.14:02
ghostmansd-pcFor things like cmpb, 7 in the loop must be changed to (XLEN/8)-1 (there are other loops which depend on XLEN). I've taught the parser to support expressions instead of constants, since it seemed to be the simplest way. That said, the simplest is not necessarily the best.15:43
ghostmansd-pcBasically it boils down to calling a custom RANGE instead of range. The RANGE (a name is really appreciated) checks start/end mismatch (previously done in parser.py), and returns a range.15:50
ghostmansd-pcHm. Here's what we have in specs:15:55
ghostmansd-pcs ⊕ (RS)i%8+715:55
ghostmansd-pcand that's what we have in code:15:56
ghostmansd-pcs <- s ^ (RS)[i*8+7]15:56
ghostmansd-pcprty instruction15:56
ghostmansd-pcsorry, prtyd16:02
programmerjakeghostmansd-pc for the MemoryError, are you using a 32-bit python, since on 64-bit linux that will basically never happen, it'll get killed first. if you made a powerpc vm, it should be a powerpc64le vm16:24
programmerjakeassuming you have 32-bit linux, it got killed because it is using more than 2-4GB of memory for error messages or other junk...16:27
programmerjakeeither that or some native extension has a memory leak16:28
programmerjakeyou can try running test_pipe_caller_long.py with the -f flag, it'll make it stop at the first error16:34
ghostmansdI'm using a 64-bit x86 Debian inside VM16:43
programmerjakethe sign position is the msb of whatever size thing your dealing with, so a 64-bit signed integer in a 64-bit register has the sign bit at bit 0, a 32-bit in a 64-bit has the sign at bit 32, an 8-bit in a 64-bit has the sign at bit 56, etc.16:43
programmerjakethat should work then...16:43
programmerjakehmm....16:43
ghostmansdPerhaps I gave too little RAM: 2048 MiB16:44
programmerjakeI'll try it myself later today16:44
ghostmansdabout the sign: a series of deep sighs16:44
programmerjakeyes...msb0 is a pain16:44
programmerjakeassuming you'll want to compile llvm or gcc or run coriolis2 at some point, you'll definitely want more than 2GB, i'd give it as much as you can without leaving your host system memory starved16:46
programmerjakeit might be better to install linux along-side your other os rather than running in a vm16:47
programmerjakeso, if you have 8GB ram, try giving the VM 6GB or so16:48
lkclwhere there are for-loops 0 to 7 we have to think, on a case-by-case basis, is it:17:51
lkcl(a) more sensible to do 8/4/2/1 things of always 8-bit wide17:51
lkcl(b) more sensible to do 8 things of 8/4/2/1-bit wide17:51
lkcl(c) panic17:51
lkcl(d) run away screaming and join a tibetan monastory17:52
programmerjakelkcl, for budget-sync, do you *need* all the print() outputs? they obscure the errors that *should* be corrected...17:54
ghostmansdlkcl: the last one is also the one I've never met in programming before, I choose that one17:56
ghostmansddef tibetan_handler(gprs, fprs, mem):17:57
ghostmansd    pass17:57
programmerjakeembrace the typos! :) def join_monastory(): print("you meant monastery, right?")17:59
ghostmansd-pclol :-D18:09
ghostmansd-pcit'd have been even more amazing if they sent us to monastery without writing a single function18:09
programmerjakethat'd be relying on default arguments too much...18:10
ghostmansd-pc:-D18:10
* jn sends ghostmansd-pc into a monad story18:26
jna story of monads18:26
jnthe ideal conditions for functional programming ;)18:27
programmerjakehaving fun with monads in Rust :)18:28
lkclprogrammerjake, while i was writing it, yes. otherwise i am completely unable to follow the code and link "what is written" to "what it does"19:04
programmerjakeso, it's ok to comment them out now?19:06
lkclprogrammerjake, yehyeh go for it19:19

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