*** openpowerbot <openpowerbot!~openpower@94-226-188-34.access.telenet.be> has quit IRC | 02:39 | |
*** toshywoshy <toshywoshy!~toshywosh@ptr-377wf33o3bnthuddmycb.18120a2.ip6.access.telenet.be> has quit IRC | 02:41 | |
*** openpowerbot <openpowerbot!~openpower@94-226-188-34.access.telenet.be> has joined #libre-soc | 02:50 | |
*** toshywoshy <toshywoshy!~toshywosh@ptr-377wf33o3bnthuddmycb.18120a2.ip6.access.telenet.be> has joined #libre-soc | 03:03 | |
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has joined #libre-soc | 06:45 | |
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has quit IRC | 07:25 | |
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has joined #libre-soc | 08:38 | |
lkcl | programmerjake, just occurred to me (duh) if you want some more EUR and can be quick about it there's always the video algorithms | 09:02 |
---|---|---|
lkcl | pick one core function and put it into pure sv assembler | 09:02 |
lkcl | markos is doing VP9 | 09:02 |
lkcl | so not that one :) | 09:02 |
lkcl | https://bugs.libre-soc.org/show_bug.cgi?id=137 | 09:03 |
lkcl | AV1 is EUR 4,000 (dang) | 09:03 |
lkcl | VP8 is 3,000 | 09:03 |
lkcl | don't make life difficult for yourself: ask markos for advice on a good *short* (useful) key function and thrash it out, fast. | 09:05 |
lkcl | add 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 |
markos | lkcl, 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 myself | 09:07 |
markos | no raw binaries, don't worry | 09:07 |
markos | the 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 |
markos | AV1 library is similar, based heavily on libvpx | 09:09 |
markos | when I'm done with calling pypowersim from inside C, progress should be much faster | 09:10 |
markos | I'm calling python code now with no problems, I just need to finish that function you said and create the call conversions | 09:11 |
lkcl | markos, yep go for it, no problem at all | 09:11 |
markos | in 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 |
lkcl | 1 sec | 09:11 |
markos | the 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 function | 09:12 |
lkcl | markos, done https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=d568f70c757b54c95d2a2ceeafb92ab374785fc5 | 09:15 |
markos | that's it? | 09:16 |
markos | I thought it would be more complicated... :) | 09:16 |
lkcl | ok so you want the simulator as a return result | 09:16 |
lkcl | nnope | 09:16 |
lkcl | perhaps the memory to be written out to a file | 09:17 |
lkcl | (the write_data) | 09:17 |
lkcl | which will be more args to the function | 09:17 |
lkcl | please do make sure to "git push" every piece of intermediary work | 09:18 |
lkcl | please - really - don't leave things "uncommitted" | 09:18 |
lkcl | we have to coordinate on an extremely short timescale now | 09:18 |
markos | that's the point I don't want to write to a file, | 09:19 |
lkcl | if it's unused by anyone else it matters not one bit if it "doesn't work" | 09:19 |
markos | if it was that I would just call pypowersim as a command | 09:19 |
lkcl | ok then you'll need to get at the simulator.mem object and access it directly | 09:19 |
lkcl | or | 09:19 |
lkcl | see the write_data function | 09:20 |
markos | marshalling/demarshalling the arguments/results is what will be done by the wrapper function | 09:20 |
lkcl | use simulator.mem.ld(addr, bytelength) | 09:20 |
markos | it's just that it will pass buffers and not files | 09:20 |
markos | ok, I'll commit what I have so far today | 09:21 |
lkcl | you *can* pass an opened file object to the Program() instance | 09:22 |
markos | for example | 09:23 |
markos | I have this starter function that takes a buffer of uint16_t numbers, and returns a int32 sum | 09:23 |
markos | with 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 address | 09:24 |
lkcl | ok 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 |
lkcl | and do the opposite for simulator.mem | 09:25 |
markos | I need a generic way to do this | 09:25 |
markos | one function returns a pointer, another returns an integer -or more, another is void | 09:25 |
markos | all that special handling has to be done by the C wrapper function not the run_a_simulation python function | 09:26 |
lkcl | make life easy for yourself. | 09:26 |
lkcl | anything complicated do it in the run_a_simulation function, in python | 09:26 |
lkcl | sorry | 09:26 |
markos | that's what I want to :) | 09:26 |
markos | +do | 09:26 |
lkcl | anything that *would* be complicated in c, do it in python | 09:26 |
markos | I can't avoid conversion of python objects in C, unfortunately | 09:27 |
lkcl | but first look at Program() you'll see it can take instructions as bytes or as a filename | 09:28 |
lkcl | pain in the neck we haven't got elwidth overrides or saturation, but ew is a big job | 09:34 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has quit IRC | 11:45 | |
*** tplaten <tplaten!~isengaara@55d45847.access.ecotel.net> has joined #libre-soc | 11:59 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc | 12:21 | |
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has quit IRC | 13:07 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has quit IRC | 13:10 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.57.216> has joined #libre-soc | 13:10 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.57.216> has quit IRC | 13:31 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.162.152> has joined #libre-soc | 13:31 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.162.152> has quit IRC | 13:48 | |
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has joined #libre-soc | 13:51 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.54.195> has joined #libre-soc | 14:01 | |
*** tplaten <tplaten!~isengaara@55d45847.access.ecotel.net> has quit IRC | 14:04 | |
*** zemaye <zemaye!~zemaye@31-209-215-224.dsl.dynamic.simnet.is> has joined #libre-soc | 14:22 | |
lkcl | markos, btw, ya know i'll approve the task even if there's just one or two unit tests, right? :) | 14:42 |
lkcl | so if it's easier just chuck in some manual tests | 14:43 |
markos | lkcl, if this works you can expect a whole lot more unit tests | 14:43 |
markos | the functions themselves are easy | 14:43 |
markos | it's running them through the simulator that's going to be tricky | 14:44 |
markos | in any case, I'll commit the files later today | 14:48 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.54.195> has quit IRC | 15:26 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.55.222> has joined #libre-soc | 15:26 | |
lkcl | star | 15:30 |
sadoon[m] | Hey guys | 17: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 away | 17:37 |
sadoon[m] | I totally underestimated the full repo size, with all the debug packages it comes out to 200gb for ppc and ppc64 | 17:37 |
programmerjake | sadoon: do you have enough disk space? | 18:00 |
sadoon[m] | Yes :D | 18:01 |
sadoon[m] | 24TB local server | 18:01 |
programmerjake | ok, good! | 18:01 |
markos | progress! 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 |
lkcl | nice :) | 18:55 |
markos | now I just need to do the conversion, but the principle works | 18:56 |
lkcl | programmerjake, https://bugs.libre-soc.org/show_bug.cgi?id=222 sure go for it | 18:56 |
markos | "just" | 18:56 |
lkcl | :) | 18:58 |
lkcl | programmerjake, ooo frequency-counting. https://www.programiz.com/dsa/huffman-coding | 18:58 |
lkcl | and sorting | 18:59 |
lkcl | fuuun | 18:59 |
lkcl | i investigated sorting a few months back | 19:00 |
lkcl | i think it might be possible to do quicksort and bubblesort in only a few instructions, as long as you're happy to keep in-regs | 19:01 |
lkcl | which, pffh | 19:01 |
lkcl | damn nuisance no elwidth overrides, sigh | 19:01 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.55.222> has quit IRC | 19:01 | |
* lkcl doing a maaaajor rework of the loop-iteration in ISACaller | 19:06 | |
lkcl | which holy cow might actually be working for basic (horizontal-first, non-subvector) already. dang | 19:06 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.196> has joined #libre-soc | 19:07 | |
programmerjake | if we're doing an in-reg sort, radix sort is the stereotypical sort for vector cpus/gpus | 19:12 |
programmerjake | that 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 |
programmerjake | which doesn't need sorting. | 19:17 |
lkcl | that'd greatly reduce the amount of work needed. | 19:17 |
lkcl | have 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 IRC | 19:33 | |
lkcl | daaang test_caller_svp64_predication.py still functional, that means twin-pred, re-entrancy, zeroing, whewww | 19:34 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.191> has joined #libre-soc | 19:34 | |
lkcl | this is some hair-raising code-morphing to get pack/unpack working in a sane way | 19:34 |
lkcl | okaaay remap's not having any of it | 19:41 |
lkcl | which isn't a surprise | 19:41 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.191> has quit IRC | 19:47 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.244> has joined #libre-soc | 19:47 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.244> has quit IRC | 19:56 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.80> has joined #libre-soc | 19:57 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.80> has quit IRC | 20:00 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.73> has joined #libre-soc | 20:03 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@185.79.101.73> has quit IRC | 20:09 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has joined #libre-soc | 20:11 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has quit IRC | 20:21 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has joined #libre-soc | 20:22 | |
markos | IT WORKS! | 20:23 |
markos | GPR setitem 30 SelectableInt(value=0x0, bits=64) | 20:23 |
markos | GPR setitem 31 SelectableInt(value=0x0, bits=64) | 20:23 |
markos | Traceback (most recent call last): | 20:23 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation | 20:23 |
markos | initial_pc=initial_pc) | 20:23 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst | 20: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 MMU | 20: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 |
markos | AttributeError: 'str' object has no attribute 'items' | 20:23 |
markos | Error invoking 'run_a_simulation' | 20:23 |
markos | I get errors, sure | 20:23 |
lkcl | olee! | 20:27 |
markos | this is great | 20:27 |
lkcl | you passed in a string as the initial_sprs argument | 20:27 |
lkcl | pass in None and that error will go walkies | 20:27 |
markos | this is what I passed: | 20:28 |
markos | lst None | 20:28 |
markos | bigendian False | 20:28 |
markos | binaryname variancefuncs_svp64.bin | 20:28 |
markos | prog None | 20:28 |
markos | qemu_cosim False | 20:28 |
markos | initial_regs None | 20:28 |
markos | initial_sprs LR: 0xfffffff | 20:28 |
markos | svstate None | 20:28 |
markos | mmu None | 20:28 |
markos | initial_cr None | 20:28 |
markos | initial_mem None | 20:28 |
markos | initial_fprs None | 20:28 |
markos | initial_pc 0x20000000 | 20:28 |
markos | binary <_io.BytesIO object at 0x7fff7e3fba98> | 20:28 |
lkcl | elif opt in ['-s', '--sprs']: | 20:28 |
lkcl | initial_sprs = read_entries(arg, 32) | 20:28 |
lkcl | line 335 of pypowersim.py | 20:29 |
markos | ok, passed that, now for memory | 20:29 |
markos | Sim-Mem {} 8 3 | 20:29 |
markos | Memory: | 20:29 |
markos | Sim-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 |
markos | 16777600]) 4 2 | 20:29 |
markos | Traceback (most recent call last): | 20:29 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation | 20:29 |
markos | initial_pc=initial_pc) | 20:29 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst | 20: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_mem | 20:29 |
markos | initial_mem[startaddr + row_bytes*i] = (val, row_bytes) | 20:29 |
markos | TypeError: can only concatenate str (not "int") to str | 20:29 |
markos | Error invoking 'run_a_simulation' | 20:29 |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@176.59.42.105> has quit IRC | 20:31 | |
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc | 20:32 | |
markos | in 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 zeros | 20:46 |
lkcl | a list containing the value 0 | 20:47 |
lkcl | multiplied (replicated) 128 times | 20:47 |
lkcl | [] is list | 20:48 |
lkcl | () is tuple | 20:48 |
lkcl | {} is dict (key-value) | 20:48 |
lkcl | there is no such basic datatype as an "array" in python | 20:48 |
lkcl | although some people refer to strings as "array of bytes" | 20:48 |
markos | ok, trying to figure out how to create that as a PyList in C | 20:49 |
markos | so mem is a dict? then? | 20:50 |
markos | ok nice, segfault :) | 20:52 |
lkcl | https://stackoverflow.com/questions/50668981/how-to-return-a-list-of-ints-in-python-c-api-extension-with-pylist | 20:53 |
markos | yup, passed this | 20:54 |
lkcl | <lkcl> you need to pass in a dictionary {'LR': 0xffffff} | 20:54 |
lkcl | <lkcl> memory is again a dictionary | 20:54 |
programmerjake | PyList_New(128), followed by for idx in 0..128: PyNewRef(item) and PyList_SetItem(list, idx, item) | 20:55 |
markos | thx | 20:55 |
*** zemaye <zemaye!~zemaye@31-209-215-224.dsl.dynamic.simnet.is> has quit IRC | 20:57 | |
programmerjake | don't forget that item will still have a refcount you own after all the setitem calls, because you did a newref for each one | 20:58 |
markos | hm, PyNewRef is not found... | 21:00 |
markos | maybe it changed name | 21:00 |
markos | actually no need, PyLong_FromLong(0) is enough | 21:00 |
markos | since I'm just zeroing the elements anyway | 21:01 |
markos | ok, more progress: | 21:01 |
markos | Traceback (most recent call last): | 21:01 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation | 21:01 |
markos | initial_pc=initial_pc) | 21:01 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 184, in run_tst | 21: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 reg | 21: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 |
markos | ValueError: None | 21:01 |
markos | Error invoking 'run_a_simulation' | 21:01 |
lkcl | you passed in None instead of zero. | 21:02 |
lkcl | <markos> ValueError: None | 21:02 |
markos | in initial_cr? | 21:02 |
markos | yup | 21:02 |
lkcl | look at line 379 | 21: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 |
markos | yup that was it, moved further | 21:03 |
markos | sorry long paste, but getting there: | 21:18 |
markos | is priv False 0x0 SelectableInt(value=0x0, bits=1) | 21:19 |
markos | post-processed name NONE NONE NONE | 21:19 |
markos | Traceback (most recent call last): | 21:19 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 315, in run_a_simulation | 21:19 |
markos | initial_pc=initial_pc) | 21:19 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 256, in run_tst | 21:19 |
markos | sim.run() | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/core.py", line 165, in run | 21:19 |
markos | while self.advance(): | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/core.py", line 156, in advance | 21:19 |
markos | return self._engine.advance() | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/pysim.py", line 319, in advance | 21:19 |
markos | self._step() | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/pysim.py", line 308, in _step | 21:19 |
markos | process.run() | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/_pycoro.py", line 123, in run | 21:19 |
markos | self.coroutine.throw(exn) | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/_pycoro.py", line 64, in run | 21:19 |
markos | command = self.coroutine.send(response) | 21:19 |
lkcl | don't drop large pastes into IRC | 21:19 |
markos | File "/home/markos/src/nmigen/nmigen/sim/core.py", line 81, in wrapper | 21:19 |
markos | yield from process() | 21:19 |
markos | File "../../../src/openpower/decoder/isa/pypowersim.py", line 219, in process | 21:19 |
markos | yield from simulator.execute_one() | 21:19 |
lkcl | you'll end up getting banned for flooding | 21:19 |
markos | File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 1286, in execute_one | 21:19 |
markos | yield from self.call(opname) # execute the instruction | 21:19 |
markos | File "/home/markos/src/openpower-isa/src/openpower/decoder/isa/caller.py", line 1517, in call | 21:19 |
markos | info = self.instrs[ins_name] | 21:19 |
markos | KeyError: 'NONE' | 21:19 |
markos | Error invoking 'run_a_simulation' | 21:19 |
markos | ah, yes I remember that, years ago :) | 21:20 |
lkcl | that's an instruction which doesn't exist | 21:20 |
lkcl | anything called "NONE" is obviously not an instruction | 21:20 |
markos | so it's from the source code? | 21:20 |
lkcl | you'll need to keep this *real* simple. | 21:21 |
markos | so, to save myself the conversion of the function, what I do is I objcopy the ELF .o to .bin format | 21:21 |
lkcl | well, you've bypassed all the python code that does that automatically for you | 21:21 |
markos | what the objcopy? | 21:22 |
lkcl | all of it | 21:22 |
lkcl | look at Program() | 21:22 |
lkcl | it auto-calls powerpc64-linux-gnu-as | 21:22 |
lkcl | and objdump | 21:22 |
lkcl | and objcopy | 21:22 |
lkcl | everything | 21:22 |
markos | that's the point, I don't want it to call the assembler | 21:23 |
markos | I'm calling it from inside an executable | 21:23 |
markos | I already have done those parts | 21:23 |
lkcl | Program() supports that mode | 21:23 |
lkcl | but you have to pass in an open file handle | 21:23 |
markos | ideally I would just copy the body of the function directly | 21:23 |
lkcl | or an IOBytes object (which amounts to the same thing, with the same API) | 21:23 |
markos | is it possible to just pass a buffer? | 21:24 |
lkcl | an IOBytes *is* a buffer | 21:24 |
lkcl | with a file-like API | 21:24 |
markos | ok then | 21:24 |
lkcl | hang on.. | 21:25 |
lkcl | if binaryname: | 21:25 |
lkcl | with open(binaryname, "rb") as f: | 21:25 |
lkcl | lst = f.read() | 21:25 |
markos | I 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 buffer | 21:25 |
markos | yup, already done that | 21:25 |
markos | but I would like to skip that part | 21:25 |
markos | and just pass the buffer part directly | 21:25 |
lkcl | it tells you what type things must be in | 21:25 |
lkcl | ignore the code because it's the code | 21:26 |
lkcl | look at the type of the object that is passed in as the parameter | 21:26 |
markos | so, I could just pass lst as IOBytes then | 21:26 |
lkcl | and the parameter is, "lst" | 21:26 |
lkcl | no, you need to look up what type f.read() returns | 21:26 |
lkcl | or | 21:26 |
lkcl | put "print("type of list", type(lst))" | 21:27 |
lkcl | and when you run it, it will tell you | 21:27 |
markos | bytes | 21:28 |
lkcl | there you go. | 21:28 |
markos | ok | 21:28 |
markos | so I need to create a bytes object from the function body and just pass that | 21:29 |
markos | cool | 21:29 |
lkcl | should do the trick, yes. | 21:29 |
markos | ok, let's see | 21:29 |
lkcl | Program() is reasonably smart, detects and adapts to what it gets passed | 21:29 |
ghostmansd[m] | lkcl, with /els support I added, we only have branch modes left. | 21:35 |
lkcl | ghostmansd[m], awesome | 21: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 |
lkcl | i'm in the middle of some complex rewrite of ISACaller | 21: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 |
lkcl | there's only one that might work | 21:37 |
lkcl | actually, have a look in test_caller_svp64_bc.py | 21:37 |
lkcl | that will show you the syntax of what _should_ work | 21:38 |
lkcl | although i've only added sv.bc/all as a unit test | 21:38 |
ghostmansd[m] | lol | 21:39 |
ghostmansd[m] | Only all yes | 21:39 |
lkcl | can 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 flags | 21:39 |
ghostmansd[m] | Looking at the spec | 21:39 |
lkcl | svstep is *not* going to be added, ignore it | 21:39 |
*** ghostmansd <ghostmansd!~ghostmans@broadband-188-32-220-156.ip.moscow.rt.ru> has joined #libre-soc | 21:40 | |
ghostmansd | https://libre-soc.org/openpower/sv/branches/ | 21:40 |
ghostmansd | I'll add missing fields from format and fields section | 21:40 |
ghostmansd | and check that they set the expected bits in disassembly | 21:41 |
lkcl | vli+vsb bits have the four /xxx of vs vsi vsb vsbi | 21:41 |
lkcl | those should all be good | 21:41 |
lkcl | and snz as well | 21:41 |
lkcl | and lu | 21:41 |
ghostmansd | yeah | 21:41 |
ghostmansd | all fields from the base branch RM class | 21:42 |
lkcl | it's just CTR-test mode and CTI that are missing | 21:42 |
lkcl | long story | 21:42 |
ghostmansd | plus cluss-specific | 21:42 |
lkcl | i was going to merge the functionality of svstep into sv.bc | 21:42 |
lkcl | but 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-like | 21:42 |
lkcl | so i decided "screw it" and to keep svstep as a separate instruction | 21:43 |
lkcl | despite it being essential inside a hot-loop | 21:43 |
lkcl | c'est la vie | 21:43 |
ghostmansd | I'll drop these then, OK? | 21:44 |
ghostmansd | elif encmode == 'st': # svstep mode | 21:44 |
ghostmansd | bc_step = 1 | 21:44 |
ghostmansd | elif encmode == 'sr': # svstep BRc mode | 21:44 |
ghostmansd | bc_step = 1 | 21:44 |
ghostmansd | bc_brc = 1 | 21:44 |
lkcl | yep svstep/brc: baaaad | 21:45 |
lkcl | CTR-test/CTI: goooood | 21:45 |
ghostmansd | How about these: /all/snz/slu/lru/vs/vsi/vsb/vsbi/sl/cti | 21:48 |
markos | ok, it ran without crashing :) | 21:49 |
markos | it chokes now on the receiving result object | 21:49 |
* lkcl oleee test_caller_svp64_parallel_reduce.py works | 21:51 | |
lkcl | daaang | 21:51 |
markos | ok, it returned NoneType, that's why it chokes | 21:51 |
lkcl | you 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 |
lkcl | if fft works i'm going to fall off my chair. | 21:53 |
lkcl | stool. | 21:53 |
lkcl | well, it's only 10in off the ground | 21:53 |
lkcl | wark. | 21:53 |
lkcl | fial | 21:53 |
lkcl | fail | 21:54 |
markos | yeah yeah it's working fine, I've written a simple counter function to see if it works and it works | 21:57 |
lkcl | daaang | 21:57 |
markos | only problem is I don't know how to get the state of the resulting registers to find the result | 21:58 |
lkcl | return the sim object | 21:58 |
lkcl | from the function | 21:58 |
markos | ah | 21:58 |
lkcl | then get sim.gpr object | 21:58 |
lkcl | which has dictionary methods | 21:58 |
lkcl | likewise, sim.mem has dictionary methods | 21:59 |
markos | is 'return sim' in the end of the python object fine? | 21:59 |
lkcl | yyup | 21:59 |
markos | python function | 21:59 |
markos | hooray! TypeError: expected bytes, ISA found | 22:01 |
lkcl | b'ludy'ellfire :) | 22:01 |
lkcl | ahh the fft failures were down to svstep (Vertical-First Mode) which i've not yet added | 22:02 |
markos | oh fuck, now I need to deserialize a python dict from bytes :D | 22:02 |
lkcl | yaaaay | 22:03 |
markos | is ISA a dict? | 22:03 |
lkcl | Very Big Object | 22:03 |
lkcl | use getattr on it | 22:03 |
lkcl | 1 sec | 22:04 |
lkcl | https://docs.python.org/3/c-api/object.html | 22:04 |
lkcl | PyObject_getattr | 22:04 |
lkcl | with the name "gpr" | 22:05 |
lkcl | or "spr" | 22:05 |
lkcl | or "fpr" | 22:05 |
lkcl | or "mem" | 22:05 |
markos | ok, it works, but I'm getting all registers set to ffffffff :-/ | 22:11 |
lkcl | print them all out | 22:11 |
lkcl | print ("GPRs") | 22:11 |
lkcl | simulator.gpr.dump() | 22:11 |
markos | this is C :) | 22:11 |
lkcl | pypowersim.py line 382 | 22:12 |
lkcl | print them all out *from python* | 22:12 |
lkcl | then you will know if they're actually supposed to be 0xfffffff or not | 22:12 |
markos | good poijnt | 22:12 |
markos | ok, dump reports all zeroes, but in C I'm getting all 0xffffffff | 22:14 |
markos | weird | 22:14 |
markos | hahaha ofc they're all zero, | 22:20 |
markos | the function was a loop and the one argument was the no of iterations | 22:20 |
markos | with all registers zero nothing was computed :) | 22:21 |
markos | now it works | 22:21 |
markos | at least the python part | 22:21 |
markos | still getting 0xffffffff on the C part | 22:21 |
lkcl | :) | 22:21 |
markos | at least I'm getting the actual registers I'm messing with | 22:22 |
markos | r3, r9, r10 | 22:22 |
lkcl | you're calling PyDict_getitem https://docs.python.org/3/c-api/dict.html | 22:23 |
lkcl | ah hang on you'll be returned a SelectableInt object | 22:23 |
lkcl | so you'll have to do another PyObject_getattr(x, "value") | 22:23 |
lkcl | to get at the value | 22:24 |
lkcl | which will be of type int | 22:24 |
lkcl | decoder/isa/caller.py | 22:25 |
lkcl | GPR.dump() | 22:25 |
markos | so first getatrr("gpr") and then on *that* object, getattr(i)? | 22:25 |
markos | for the i-th register? | 22:25 |
lkcl | https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/isa/caller.py;h=3ce81e907db35d909e47c35db4b9f02719c5f5e6;hb=49d28a8633262b0410456fb849f9aea329343492#l157 | 22:25 |
lkcl | no | 22:25 |
lkcl | PyObject_getattr(sim, "gpr") | 22:26 |
lkcl | PyDict_getattr(gpr, {an_integer_object_with_the_key}) | 22:26 |
lkcl | PyObject_getattr(reg, "value") | 22:26 |
markos | ok, gotcha | 22:26 |
lkcl | look at the link i sent | 22:26 |
lkcl | it is doing exactly that | 22:27 |
lkcl | self[i].value | 22:27 |
markos | yup | 22:27 |
lkcl | i = {an_integer_object_with_the_key} | 22:27 |
lkcl | self[i] --> PyDict_getattr(gpr, i) | 22:27 |
lkcl | .value --> Pyobject_getattr(reg, "value") | 22:27 |
* lkcl afk | 22:28 | |
markos | python: | 22:33 |
markos | GPRs | 22:33 |
markos | reg 0 00000000 00000000 00000000 000000c8 00000000 00000000 00000000 00000000 | 22:33 |
markos | reg 8 00000000 000000c8 0000000a 00000000 00000000 00000000 00000000 00000000 | 22:33 |
markos | C: | 22:33 |
markos | GPR[0]: 0 / 0000000000000000 | 22:33 |
markos | GPR[1]: 0 / 0000000000000000 | 22:33 |
markos | GPR[2]: 0 / 0000000000000000 | 22:33 |
markos | GPR[3]: 200 / 00000000000000c8 | 22:33 |
markos | GPR[4]: 0 / 0000000000000000 | 22:33 |
markos | GPR[5]: 0 / 0000000000000000 | 22:33 |
markos | GPR[6]: 0 / 0000000000000000 | 22:33 |
markos | GPR[7]: 0 / 0000000000000000 | 22:33 |
markos | GPR[8]: 0 / 0000000000000000 | 22:33 |
markos | GPR[9]: 200 / 00000000000000c8 | 22:33 |
markos | GPR[10]: 10 / 000000000000000a | 22:33 |
markos | I call that success :) | 22:33 |
markos | and that's the small function I tested: | 22:36 |
markos | int 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 |
markos | lol, should be += 2*i, but even so, it's correct :) | 22:39 |
*** octavius <octavius!~octavius@175.147.93.209.dyn.plus.net> has quit IRC | 22:43 | |
lkcl | daang | 22:54 |
markos | ok, almost done with this, will commit this with the vp9 svp64 code tomorrow | 22:54 |
markos | and vp8 is almost similar, I'll just pick different functions :) | 22:55 |
*** lxo <lxo!~lxo@linux-libre.fsfla.org> has joined #libre-soc | 23:13 | |
ghostmansd | lkcl, we cannot use fields 17 and 18 in branches, they conflict with extra3 | 23:32 |
ghostmansd | You must've thought about smask when you filled this table, but bc is EXTRA3 | 23:34 |
lkcl | ghostmansd, i probably knew what i was doing, but don't now :) | 23:34 |
ghostmansd | And stuff from the last argument overrides these fields | 23:34 |
ghostmansd | extra: Extra.remap(range(10, 19)) | 23:35 |
ghostmansd | extra2: Extra2.remap(range(10, 19)) | 23:35 |
ghostmansd | extra3: Extra3.remap(range(10, 19)) | 23:35 |
ghostmansd | class BranchBaseRM(SZBaseRM, BaseRM): | 23:35 |
ghostmansd | SL: BaseRM[17] | 23:35 |
ghostmansd | SLu: BaseRM[18] | 23:35 |
lkcl | bc only has one register | 23:35 |
ghostmansd | Perhaps, as another option... | 23:35 |
ghostmansd | you assumed the last argument is address | 23:36 |
ghostmansd | and then it cannot be "extended", it's immediate | 23:36 |
ghostmansd | but the code fills the extras unconditionally | 23:36 |
lkcl | there's only ever one register in bc* | 23:36 |
lkcl | therefore the bits are free | 23:36 |
ghostmansd | ah wait | 23:38 |
ghostmansd | here they are in disassembly | 23:38 |
lkcl | openpower/isatables/RM-2P-1S1D.csv:bc,BRANCH,,2P,EXTRA3,EN,d:BI,s:BI,0,0,SPR,0,0,SPR,BI,0,0 | 23:39 |
ghostmansd | this means we've just supported basic modes in disassembly | 23:39 |
ghostmansd | yeah I just found it works | 23:39 |
ghostmansd | all of a sudden | 23:40 |
ghostmansd | but | 23:40 |
lkcl | there's a bug there, though. | 23:40 |
lkcl | bc is 1S | 23:40 |
lkcl | not 1S1D | 23:40 |
ghostmansd | test_sv_branch_cond_all fails | 23:40 |
ghostmansd | hm | 23:40 |
ghostmansd | I'll recheck it | 23:40 |
lkcl | oh probably | 23:40 |
ghostmansd | because local disassembly works as I expect | 23:41 |
lkcl | that's new, though | 23:41 |
ghostmansd | I'll also check the test now | 23:41 |
ghostmansd | * dis test | 23:41 |
lkcl | you mean this? https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=0aaebe60a59ecd3fc7a42662d84f2576776d94d1 | 23:42 |
ghostmansd | dis test is fine | 23:43 |
ghostmansd | yep | 23:43 |
ghostmansd | cf. last dis branch changes | 23:43 |
ghostmansd | no idea what happens in src/openpower/decoder/isa/test_caller_svp64_bc.py | 23:43 |
lkcl | https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/isa/test_caller_svp64_bc.py;h=1b814a65478694a29ec0f5e8a967359c2c08e378;hb=55364ba2f84a15c9292327d48ee850b797be35ca#l80 | 23:44 |
lkcl | yep that doesn't surprise me | 23:44 |
lkcl | i've been working on ISACaller | 23:44 |
ghostmansd | ah so you mean this might be unrelated | 23:44 |
lkcl | 1 sec | 23:45 |
lkcl | git stash for a mo | 23:45 |
lkcl | no it's fine | 23:45 |
lkcl | commit 55364ba2f84 | 23:45 |
lkcl | all fine | 23:45 |
ghostmansd | OK 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/!