Monday, 2022-09-19

*** openpowerbot <openpowerbot!~openpower@94-226-188-34.access.telenet.be> has quit IRC02:39
*** toshywoshy <toshywoshy!~toshywosh@ptr-377wf33o3bnthuddmycb.18120a2.ip6.access.telenet.be> has quit IRC02:41
*** openpowerbot <openpowerbot!~openpower@94-226-188-34.access.telenet.be> has joined #libre-soc02:50
*** toshywoshy <toshywoshy!~toshywosh@ptr-377wf33o3bnthuddmycb.18120a2.ip6.access.telenet.be> has joined #libre-soc03:03
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has joined #libre-soc06:45
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has quit IRC07:25
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has joined #libre-soc08:38
lkclprogrammerjake, just occurred to me (duh) if you want some more EUR and can be quick about it there's always the video algorithms09:02
lkclpick one core function and put it into pure sv assembler09:02
lkclmarkos is doing VP909:02
lkclso not that one :)09:02
lkclhttps://bugs.libre-soc.org/show_bug.cgi?id=13709:03
lkclAV1 is EUR 4,000 (dang)09:03
lkclVP8 is 3,00009:03
lkcldon't make life difficult for yourself: ask markos for advice on a good *short* (useful) key function and thrash it out, fast.09:05
lkcladd it into the media/ directory but as i said yesterday to markos don't for goodness sake drop *any* raw binary test data from ffmpeg into any repositories.09:06
markoslkcl, actually, since vp8 are part of the same exact library (sharing the same common dsp code) I was thinking of asking to take that one myself09:07
markosno raw binaries, don't worry09:07
markosthe test cases are self-contained, eg. a function that does some linalg math on a constructed matrix using a ref C function and then compairing those results to the optimised function (NEON,SSE,SVP64, etc)09:08
markosAV1 library is similar, based heavily on libvpx09:09
markoswhen I'm done with calling pypowersim from inside C, progress should be much faster09:10
markosI'm calling python code now with no problems, I just need to finish that function you said and create the call conversions09:11
lkclmarkos, yep go for it, no problem at all09:11
markosin fact I think that could be done faster by someone else more proficient in python, and perhaps you could reallocate funds to that task?09:11
lkcl1 sec09:11
markosthe end goal being I can call a wrapper C function that calls pypowersim that calls the SVP64 function and returns the results to the wrapper function09:12
lkclmarkos, done https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=d568f70c757b54c95d2a2ceeafb92ab374785fc509:15
markosthat's it?09:16
markosI thought it would be more complicated... :)09:16
lkclok so you want the simulator as a return result09:16
lkclnnope09:16
lkclperhaps the memory to be written out to a file09:17
lkcl(the write_data)09:17
lkclwhich will be more args to the function09:17
lkclplease do make sure to "git push" every piece of intermediary work09:18
lkclplease - really - don't leave things "uncommitted"09:18
lkclwe have to coordinate on an extremely short timescale now09:18
markosthat's the point I don't want to write to a file,09:19
lkclif it's unused by anyone else it matters not one bit if it "doesn't work"09:19
markosif it was that I would just call pypowersim as a command09:19
lkclok then you'll need to get at the simulator.mem object and access it directly09:19
lkclor09:19
lkclsee the write_data function09:20
markosmarshalling/demarshalling the arguments/results is what will be done by the wrapper function09:20
lkcluse simulator.mem.ld(addr, bytelength)09:20
markosit's just that it will pass buffers and not files09:20
markosok, I'll commit what I have so far today09:21
lkclyou *can* pass an opened file object to the Program() instance09:22
markosfor example09:23
markosI have this starter function that takes a buffer of uint16_t numbers, and returns a int32 sum09:23
markoswith pypowersim I would have to save the uint16_t buffer to a file, and pass the file as an argument to pypowersim at a given address09:24
lkclok then i suggest modifying run_a_simulation to grab the information you need, perform the save (IOBytes would do) then pass that to Program()09:24
lkcland do the opposite for simulator.mem09:25
markosI need a generic way to do this09:25
markosone function returns a pointer, another returns an integer -or more, another is void09:25
markosall that special handling has to be done by the C wrapper function not the run_a_simulation python function09:26
lkclmake life easy for yourself.09:26
lkclanything complicated do it in the run_a_simulation function, in python09:26
lkclsorry09:26
markosthat's what I want to :)09:26
markos+do09:26
lkclanything that *would* be complicated in c, do it in python09:26
markosI can't avoid conversion of python objects in C, unfortunately09:27
lkclbut first look at Program() you'll see it can take instructions as bytes or as a filename09:28
lkclpain in the neck we haven't got elwidth overrides or saturation, but ew is a big job09:34
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has quit IRC11:45
*** tplaten <tplaten!~isengaara@55d45847.access.ecotel.net> has joined #libre-soc11:59
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc12:21
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has quit IRC13:07
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has quit IRC13:10
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.57.216> has joined #libre-soc13:10
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.57.216> has quit IRC13:31
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.162.152> has joined #libre-soc13:31
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.162.152> has quit IRC13:48
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has joined #libre-soc13:51
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.54.195> has joined #libre-soc14:01
*** tplaten <tplaten!~isengaara@55d45847.access.ecotel.net> has quit IRC14:04
*** zemaye <zemaye!~zemaye@31-209-215-224.dsl.dynamic.simnet.is> has joined #libre-soc14:22
lkclmarkos, btw, ya know i'll approve the task even if there's just one or two unit tests, right? :)14:42
lkclso if it's easier just chuck in some manual tests14:43
markoslkcl, if this works you can expect a whole lot more unit tests14:43
markosthe functions themselves are easy14:43
markosit's running them through the simulator that's going to be tricky14:44
markosin any case, I'll commit the files later today14:48
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.54.195> has quit IRC15:26
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.55.222> has joined #libre-soc15:26
lkclstar15:30
sadoon[m]Hey guys17:36
sadoon[m]apt-mirror has been giving me issues on 1987 files not being downloaded so I guess about 95% of the repos are with me now. Not a huge deal if I notice anything missing I'll add it to my local archive.17:37
sadoon[m]Copying the files now to a vdisk to use as a repo and build away17:37
sadoon[m]I totally underestimated the full repo size, with all the debug packages it comes out to 200gb for ppc and ppc6417:37
programmerjakesadoon:  do you have enough disk space?18:00
sadoon[m]Yes :D18:01
sadoon[m]24TB local server18:01
programmerjakeok, good!18:01
markosprogress! TypeError: run_a_simulation() missing 12 required positional arguments: 'bigendian', 'orig_filename', 'prog', 'qemu_cosim', 'initial_regs', 'initial_sprs', 'svstate', 'mmu', 'initial_cr', 'mem', 'initial_fprs', and 'initial_pc'18:55
lkclnice :)18:55
markosnow I just need to do the conversion, but the principle works18:56
lkclprogrammerjake, https://bugs.libre-soc.org/show_bug.cgi?id=222 sure go for it18:56
markos"just"18:56
lkcl:)18:58
lkclprogrammerjake, ooo frequency-counting. https://www.programiz.com/dsa/huffman-coding18:58
lkcland sorting18:59
lkclfuuun18:59
lkcli investigated sorting a few months back19:00
lkcli think it might be possible to do quicksort and bubblesort in only a few instructions, as long as you're happy to keep in-regs19:01
lkclwhich, pffh19:01
lkcldamn nuisance no elwidth overrides, sigh19:01
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.55.222> has quit IRC19:01
* lkcl doing a maaaajor rework of the loop-iteration in ISACaller19:06
lkclwhich holy cow might actually be working for basic (horizontal-first, non-subvector) already. dang19:06
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.196> has joined #libre-soc19:07
programmerjakeif we're doing an in-reg sort, radix sort is the stereotypical sort for vector cpus/gpus19:12
programmerjakethat said, i'd have to double check, but i don't think constructing a huffman tree is hot code in jpeg decode/encode, i'd expect there'd be a few huffman trees per whole image and most of the time would be spent on huffman decoding/encoding instead.19:16
programmerjakewhich doesn't need sorting.19:17
lkclthat'd greatly reduce the amount of work needed.19:17
lkclhave to be careful not to pick something that's going to be massive.19:17
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.196> has quit IRC19:33
lkcldaaang test_caller_svp64_predication.py still functional, that means twin-pred, re-entrancy, zeroing, whewww19:34
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.191> has joined #libre-soc19:34
lkclthis is some hair-raising code-morphing to get pack/unpack working in a sane way19:34
lkclokaaay remap's not having any of it19:41
lkclwhich isn't a surprise19:41
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.191> has quit IRC19:47
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.244> has joined #libre-soc19:47
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.244> has quit IRC19:56
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.80> has joined #libre-soc19:57
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.80> has quit IRC20:00
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.73> has joined #libre-soc20:03
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.73> has quit IRC20:09
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has joined #libre-soc20:11
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has quit IRC20:21
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has joined #libre-soc20:22
markosIT WORKS!20:23
markosGPR setitem 30 SelectableInt(value=0x0, bits=64)20:23
markosGPR setitem 31 SelectableInt(value=0x0, bits=64)20:23
markosTraceback (most recent call last):20:23
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation20:23
markos    initial_pc=initial_pc)20:23
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst20:23
markos    mmu=mmu)20:23
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/all.py", line 35, in __init__20:23
markos    super().__init__(*args, **kwargs)20:23
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 886, in __init__20:23
markos    self.spr = SPR(decoder2, initial_sprs)  # initialise SPRs before MMU20:23
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 172, in __init__20:23
markos    for key, v in initial_sprs.items():20:23
markosAttributeError: 'str' object has no attribute 'items'20:23
markosError invoking 'run_a_simulation'20:23
markosI get errors, sure20:23
lkclolee!20:27
markosthis is great20:27
lkclyou passed in a string as the initial_sprs argument20:27
lkclpass in None and that error will go walkies20:27
markosthis is what I passed:20:28
markoslst None20:28
markosbigendian False20:28
markosbinaryname variancefuncs_svp64.bin20:28
markosprog None20:28
markosqemu_cosim False20:28
markosinitial_regs None20:28
markosinitial_sprs LR: 0xfffffff20:28
markossvstate None20:28
markosmmu None20:28
markosinitial_cr None20:28
markosinitial_mem None20:28
markosinitial_fprs None20:28
markosinitial_pc 0x2000000020:28
markosbinary <_io.BytesIO object at 0x7fff7e3fba98>20:28
lkcl        elif opt in ['-s', '--sprs']:20:28
lkcl            initial_sprs = read_entries(arg, 32)20:28
lkclline 335 of pypowersim.py20:29
markosok, passed that, now for memory20:29
markosSim-Mem {} 8 320:29
markosMemory:20:29
markosSim-Mem ('0x20000000', [16, 0, 5405185, 21067780, 68635, 28, 24, 0, 172, 1343111680, 222364063, 17589023, 0, 2703818752, 2099840820, 2099906484, 2168389664, 2032734116, 3911122992, 2099792404, 2703818752, 2099840820, 2099840948, 2099923414, 2099840948, 2032730144, 2170486820, 2099923476, 2436825124, 2168389664, 958988289, 2436825120, 2168389664, 730398975, 1084096412, 2168389668, 2099465080, 943652944, 3957456888, 1317011488, 0, 0,20:29
markos16777600]) 4 220:29
markosTraceback (most recent call last):20:29
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation20:29
markos    initial_pc=initial_pc)20:29
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst20:29
markos    mmu=mmu)20:29
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/all.py", line 35, in __init__20:29
markos    super().__init__(*args, **kwargs)20:29
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 902, in __init__20:29
markos    self.imem = Mem(row_bytes=4, initial_mem=initial_insns)20:29
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/mem.py", line 64, in __init__20:29
markos    for addr, (val, width) in process_mem(initial_mem, row_bytes).items():20:29
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/mem.py", line 39, in process_mem20:29
markos    initial_mem[startaddr + row_bytes*i] = (val, row_bytes)20:29
markosTypeError: can only concatenate str (not "int") to str20:29
markosError invoking 'run_a_simulation'20:29
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has quit IRC20:31
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc20:32
markosin python, what does that syntax mean [0]*128? is it an array, all elements zero?20:40
markos(of 128 elements)20:40
programmerjake[0] * 128 is repeating the list [0] 128 times, giving a new 128-element list of zeros20:46
lkcla list containing the value 020:47
lkclmultiplied (replicated) 128 times20:47
lkcl[] is list20:48
lkcl() is tuple20:48
lkcl{} is dict (key-value)20:48
lkclthere is no such basic datatype as an "array" in python20:48
lkclalthough some people refer to strings as "array of bytes"20:48
markosok, trying to figure out how to create that as a PyList in C20:49
markosso mem is a dict? then?20:50
markosok nice, segfault :)20:52
lkclhttps://stackoverflow.com/questions/50668981/how-to-return-a-list-of-ints-in-python-c-api-extension-with-pylist20:53
markosyup, passed this20:54
lkcl<lkcl> you need to pass in a dictionary {'LR': 0xffffff}20:54
lkcl<lkcl> memory is again a dictionary20:54
programmerjakePyList_New(128), followed by for idx in 0..128: PyNewRef(item) and PyList_SetItem(list, idx, item)20:55
markosthx20:55
*** zemaye <zemaye!~zemaye@31-209-215-224.dsl.dynamic.simnet.is> has quit IRC20:57
programmerjakedon't forget that item will still have a refcount you own after all the setitem calls, because you did a newref for each one20:58
markoshm, PyNewRef is not found...21:00
markosmaybe it changed name21:00
markosactually no need, PyLong_FromLong(0) is enough21:00
markossince I'm just zeroing the elements anyway21:01
markosok, more progress:21:01
markosTraceback (most recent call last):21:01
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation21:01
markos    initial_pc=initial_pc)21:01
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst21:01
markos    mmu=mmu)21:01
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/all.py", line 35, in __init__21:01
markos    super().__init__(*args, **kwargs)21:01
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 923, in __init__21:01
markos    self.cr_fields = CRFields(initial_cr)21:01
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 273, in __init__21:01
markos    self.cr = SelectableInt(init, 64)  # underlying reg21:01
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/selectable_int.py", line 256, in __init__21:01
markos    raise ValueError(value)21:01
markosValueError: None21:01
markosError invoking 'run_a_simulation'21:01
lkclyou passed in None instead of zero.21:02
lkcl<markos> ValueError: None21:02
markosin initial_cr?21:02
markosyup21:02
lkcllook at line 37921:02
lkcl                            svstate=0, mmu=False,21:02
lkcl                            initial_cr=0, mem=initial_mem,21:02
lkcl                            initial_fprs=initial_fprs,21:02
lkcl                            initial_pc=initial_pc)21:02
markosyup that was it, moved further21:03
markossorry long paste, but getting there:21:18
markosis priv False 0x0 SelectableInt(value=0x0, bits=1)21:19
markos   post-processed name NONE NONE NONE21:19
markosTraceback (most recent call last):21:19
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation21:19
markos    initial_pc=initial_pc)21:19
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 256, in run_tst21:19
markos    sim.run()21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/core.py", line 165, in run21:19
markos    while self.advance():21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/core.py", line 156, in advance21:19
markos    return self._engine.advance()21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/pysim.py", line 319, in advance21:19
markos    self._step()21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/pysim.py", line 308, in _step21:19
markos    process.run()21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/_pycoro.py", line 123, in run21:19
markos    self.coroutine.throw(exn)21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/_pycoro.py", line 64, in run21:19
markos    command = self.coroutine.send(response)21:19
lkcldon't drop large pastes into IRC21:19
markos  File "/home/markos/src/nmigen/nmigen/sim/core.py", line 81, in wrapper21:19
markos    yield from process()21:19
markos  File "../../../src/openpower/decoder/isa/pypowersim.py", line 219, in process21:19
markos    yield from simulator.execute_one()21:19
lkclyou'll end up getting banned for flooding21:19
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 1286, in execute_one21:19
markos    yield from self.call(opname)         # execute the instruction21:19
markos  File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 1517, in call21:19
markos    info = self.instrs[ins_name]21:19
markosKeyError: 'NONE'21:19
markosError invoking 'run_a_simulation'21:19
markosah, yes I remember that, years ago :)21:20
lkclthat's an instruction which doesn't exist21:20
lkclanything called "NONE" is obviously not an instruction21:20
markosso it's from the source code?21:20
lkclyou'll need to keep this *real* simple.21:21
markosso, to save myself the conversion of the function, what I do is I objcopy the ELF .o to .bin format21:21
lkclwell, you've bypassed all the python code that does that automatically for you21:21
markoswhat the objcopy?21:22
lkclall of it21:22
lkcllook at Program()21:22
lkclit auto-calls powerpc64-linux-gnu-as21:22
lkcland objdump21:22
lkcland objcopy21:22
lkcleverything21:22
markosthat's the point, I don't want it to call the assembler21:23
markosI'm calling it from inside an executable21:23
markosI already have done those parts21:23
lkclProgram() supports that mode21:23
lkclbut you have to pass in an open file handle21:23
markosideally I would just copy the body of the function directly21:23
lkclor an IOBytes object (which amounts to the same thing, with the same API)21:23
markosis it possible to just pass a buffer?21:24
lkclan IOBytes *is* a buffer21:24
lkclwith a file-like API21:24
markosok then21:24
lkclhang on..21:25
lkcl    if binaryname:21:25
lkcl        with open(binaryname, "rb") as f:21:25
lkcl            lst = f.read()21:25
markosI don't want to use the "clever" parts of the simulator, that do things automatically, I just want to run the simulator on an actual buffer21:25
markosyup, already done that21:25
markosbut I would like to skip that part21:25
markosand just pass the buffer part directly21:25
lkclit tells you what type things must be in21:25
lkclignore the code because it's the code21:26
lkcllook at the type of the object that is passed in as the parameter21:26
markosso, I could just pass lst as IOBytes then21:26
lkcland the parameter is, "lst"21:26
lkclno, you need to look up what type f.read() returns21:26
lkclor21:26
lkclput "print("type of list", type(lst))"21:27
lkcland when you run it, it will tell you21:27
markosbytes21:28
lkclthere you go.21:28
markosok21:28
markosso I need to create a bytes object from the function body and just pass that21:29
markoscool21:29
lkclshould do the trick, yes.21:29
markosok, let's see21:29
lkclProgram() is reasonably smart, detects and adapts to what it gets passed21:29
ghostmansd[m]lkcl, with /els support I added, we only have branch modes left.21:35
lkclghostmansd[m], awesome21:35
ghostmansd[m]Should we do these now? I see some variables are not used there.21:35
ghostmansd[m]I can do something based on tables, though.21:36
lkcli'm in the middle of some complex rewrite of ISACaller21:36
ghostmansd[m]Yeah I know, just want to know your opinion on whether we should do it, or these are not ready yet.21:37
ghostmansd[m]If you say this is stable enough, I can do it.21:37
lkclthere's only one that might work21:37
lkclactually, have a look in test_caller_svp64_bc.py21:37
lkclthat will show you the syntax of what _should_ work21:38
lkclalthough i've only added sv.bc/all as a unit test21:38
ghostmansd[m]lol21:39
ghostmansd[m]Only all yes21:39
lkclcan you just go over sv/trans/svp64.py checking it with the spec table?21:39
ghostmansd[m]Ok, I think I can add these as flags21:39
ghostmansd[m]Looking at the spec21:39
lkclsvstep is *not* going to be added, ignore it21:39
*** ghostmansd <ghostmansd!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc21:40
ghostmansdhttps://libre-soc.org/openpower/sv/branches/21:40
ghostmansdI'll add missing fields from format and fields section21:40
ghostmansdand check that they set the expected bits in disassembly21:41
lkclvli+vsb bits have the four /xxx of vs vsi vsb vsbi21:41
lkclthose should all be good21:41
lkcland snz as well21:41
lkcland lu21:41
ghostmansdyeah21:41
ghostmansdall fields from the base branch RM class21:42
lkclit's just CTR-test mode and CTI that are missing21:42
lkcllong story21:42
ghostmansdplus cluss-specific21:42
lkcli was going to merge the functionality of svstep into sv.bc21:42
lkclbut it turned out (a) to need a shed-load more options (when there's 2^11 things to test as it is)21:42
lkcl(b) to become CISC-like.  like... *mentally* CISC-like21:42
lkclso i decided "screw it" and to keep svstep as a separate instruction21:43
lkcldespite it being essential inside a hot-loop21:43
lkclc'est la vie21:43
ghostmansdI'll drop these then, OK?21:44
ghostmansdelif encmode == 'st':  # svstep mode21:44
ghostmansd                    bc_step = 121:44
ghostmansd                elif encmode == 'sr':  # svstep BRc mode21:44
ghostmansd                    bc_step = 121:44
ghostmansd                    bc_brc = 121:44
lkclyep svstep/brc: baaaad21:45
lkclCTR-test/CTI: goooood21:45
ghostmansdHow about these: /all/snz/slu/lru/vs/vsi/vsb/vsbi/sl/cti21:48
markosok, it ran without crashing :)21:49
markosit chokes now on the receiving result object21:49
* lkcl oleee test_caller_svp64_parallel_reduce.py works21:51
lkcldaaang21:51
markosok, it returned NoneType, that's why it chokes21:51
lkclyou worked out by now you can dump a shed-ton of "print()" statements in python to see what the hell's going on?21:52
lkclif fft works i'm going to fall off my chair.21:53
lkclstool.21:53
lkclwell, it's only 10in off the ground21:53
lkclwark.21:53
lkclfial21:53
lkclfail21:54
markosyeah yeah it's working fine, I've written a simple counter function to see if it works and it works21:57
lkcldaaang21:57
markosonly problem is I don't know how to get the state of the resulting registers to find the result21:58
lkclreturn the sim object21:58
lkclfrom the function21:58
markosah21:58
lkclthen get sim.gpr object21:58
lkclwhich has dictionary methods21:58
lkcllikewise, sim.mem has dictionary methods21:59
markosis 'return sim' in the end of the python object fine?21:59
lkclyyup21:59
markospython function21:59
markoshooray! TypeError: expected bytes, ISA found22:01
lkclb'ludy'ellfire :)22:01
lkclahh the fft failures were down to svstep (Vertical-First Mode) which i've not yet added22:02
markosoh fuck, now I need to deserialize a python dict from bytes :D22:02
lkclyaaaay22:03
markosis ISA a dict?22:03
lkclVery Big Object22:03
lkcluse getattr on it22:03
lkcl1 sec22:04
lkclhttps://docs.python.org/3/c-api/object.html22:04
lkclPyObject_getattr22:04
lkclwith the name "gpr"22:05
lkclor "spr"22:05
lkclor "fpr"22:05
lkclor "mem"22:05
markosok, it works, but I'm getting all registers set to ffffffff :-/22:11
lkclprint them all out22:11
lkcl        print ("GPRs")22:11
lkcl        simulator.gpr.dump()22:11
markosthis is C :)22:11
lkclpypowersim.py line 38222:12
lkclprint them all out *from python*22:12
lkclthen you will know if they're actually supposed to be 0xfffffff or not22:12
markosgood poijnt22:12
markosok, dump reports all zeroes, but in C I'm getting all 0xffffffff22:14
markosweird22:14
markoshahaha ofc they're all zero,22:20
markosthe function was a loop and the one argument was the no of iterations22:20
markoswith all registers zero nothing was computed :)22:21
markosnow it works22:21
markosat least the python part22:21
markosstill getting 0xffffffff on the C part22:21
lkcl:)22:21
markosat least I'm getting the actual registers I'm messing with22:22
markosr3, r9, r1022:22
lkclyou're calling PyDict_getitem https://docs.python.org/3/c-api/dict.html22:23
lkclah hang on you'll be returned a SelectableInt object22:23
lkclso you'll have to do another PyObject_getattr(x, "value")22:23
lkclto get at the value22:24
lkclwhich will be of type int22:24
lkcldecoder/isa/caller.py22:25
lkclGPR.dump()22:25
markosso first getatrr("gpr") and then on *that* object, getattr(i)?22:25
markosfor the i-th register?22:25
lkclhttps://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/isa/caller.py;h=3ce81e907db35d909e47c35db4b9f02719c5f5e6;hb=49d28a8633262b0410456fb849f9aea329343492#l15722:25
lkclno22:25
lkclPyObject_getattr(sim, "gpr")22:26
lkclPyDict_getattr(gpr, {an_integer_object_with_the_key})22:26
lkclPyObject_getattr(reg, "value")22:26
markosok, gotcha22:26
lkcllook at the link i sent22:26
lkclit is doing exactly that22:27
lkclself[i].value22:27
markosyup22:27
lkcli = {an_integer_object_with_the_key}22:27
lkclself[i] --> PyDict_getattr(gpr, i)22:27
lkcl.value --> Pyobject_getattr(reg, "value")22:27
* lkcl afk22:28
markospython:22:33
markosGPRs22:33
markosreg  0 00000000 00000000 00000000 000000c8 00000000 00000000 00000000 0000000022:33
markosreg  8 00000000 000000c8 0000000a 00000000 00000000 00000000 00000000 0000000022:33
markosC:22:33
markosGPR[0]: 0 / 000000000000000022:33
markosGPR[1]: 0 / 000000000000000022:33
markosGPR[2]: 0 / 000000000000000022:33
markosGPR[3]: 200 / 00000000000000c822:33
markosGPR[4]: 0 / 000000000000000022:33
markosGPR[5]: 0 / 000000000000000022:33
markosGPR[6]: 0 / 000000000000000022:33
markosGPR[7]: 0 / 000000000000000022:33
markosGPR[8]: 0 / 000000000000000022:33
markosGPR[9]: 200 / 00000000000000c822:33
markosGPR[10]: 10 / 000000000000000a22:33
markosI call that success :)22:33
markosand that's the small function I tested:22:36
markosint test_function(int x) {22:36
markos    int result = 0;22:36
markos    for (int i=0; i < x; i++)22:36
markos        result += 2*x;22:36
markos    return result;22:36
markos}22:36
markoslol, should be += 2*i, but even so, it's correct :)22:39
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has quit IRC22:43
lkcldaang22:54
markosok, almost done with this, will commit this with the vp9 svp64 code tomorrow22:54
markosand vp8 is almost similar, I'll just pick different functions :)22:55
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has joined #libre-soc23:13
ghostmansdlkcl, we cannot use fields 17 and 18 in branches, they conflict with extra323:32
ghostmansdYou must've thought about smask when you filled this table, but bc is EXTRA323:34
lkclghostmansd, i probably knew what i was doing, but don't now :)23:34
ghostmansdAnd stuff from the last argument overrides these fields23:34
ghostmansdextra: Extra.remap(range(10, 19))23:35
ghostmansdextra2: Extra2.remap(range(10, 19))23:35
ghostmansdextra3: Extra3.remap(range(10, 19))23:35
ghostmansdclass BranchBaseRM(SZBaseRM, BaseRM):23:35
ghostmansd    SL: BaseRM[17]23:35
ghostmansd    SLu: BaseRM[18]23:35
lkclbc only has one register23:35
ghostmansdPerhaps, as another option...23:35
ghostmansdyou assumed the last argument is address23:36
ghostmansdand then it cannot be "extended", it's immediate23:36
ghostmansdbut the code fills the extras unconditionally23:36
lkclthere's only ever one register in bc*23:36
lkcltherefore the bits are free23:36
ghostmansdah wait23:38
ghostmansdhere they are in disassembly23:38
lkclopenpower/isatables/RM-2P-1S1D.csv:bc,BRANCH,,2P,EXTRA3,EN,d:BI,s:BI,0,0,SPR,0,0,SPR,BI,0,023:39
ghostmansdthis means we've just supported basic modes in disassembly23:39
ghostmansdyeah I just found it works23:39
ghostmansdall of a sudden23:40
ghostmansdbut23:40
lkclthere's a bug there, though.23:40
lkclbc is 1S23:40
lkclnot 1S1D23:40
ghostmansdtest_sv_branch_cond_all fails23:40
ghostmansdhm23:40
ghostmansdI'll recheck it23:40
lkcloh probably23:40
ghostmansdbecause local disassembly works as I expect23:41
lkclthat's new, though23:41
ghostmansdI'll also check the test now23:41
ghostmansd* dis test23:41
lkclyou mean this? https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=0aaebe60a59ecd3fc7a42662d84f2576776d94d123:42
ghostmansddis test is fine23:43
ghostmansdyep23:43
ghostmansdcf. last dis branch changes23:43
ghostmansdno idea what happens in src/openpower/decoder/isa/test_caller_svp64_bc.py23:43
lkclhttps://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/isa/test_caller_svp64_bc.py;h=1b814a65478694a29ec0f5e8a967359c2c08e378;hb=55364ba2f84a15c9292327d48ee850b797be35ca#l8023:44
lkclyep that doesn't surprise me23:44
lkcli've been working on ISACaller23:44
ghostmansdah so you mean this might be unrelated23:44
lkcl1 sec23:45
lkclgit stash for a mo23:45
lkclno it's fine23:45
lkclcommit 55364ba2f8423:45
lkclall fine23:45
ghostmansdOK then it's me who broke it :-)23:46
lkcl:)23:46

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