Sunday, 2022-01-23

lkclwhoops he's gone00:51
lkclif you see this in irc logs: yes, and they can always be altered later00:51
lkclcesar, i had an idea: how about creating a tiny (dummy) core using alu_hier.py?14:17
lkclreally *really* basic. "decoder" just does 1<<x on its "instruction" which is a 2-bit number14:19
lkclthe "core": if bit 0 is set, do an add, if bit 1 is set, do a "branch"14:19
lkclbranch-immediate only14:19
lkclor just... everything is immediates, and the "core" drops its result (alu.o), does nothing with it14:20
lkcl"instructions" are read from a combinatorial Array, only say... 16 entries, containing a Record with the 2-bit "instruction", and 2 4-bit immediates14:22
cesarlkcl: Sure, but why?15:45
cesarI guess it would allow writing unit tests for developing the pipelined Fetch unit...16:30
lkclyes, in a much smaller codebase16:59
lkcli think i have the bug tracked down for the dcache.py error: soc.vhdl requests 64 cache lines, the default in dcache.vhdl is 32.17:02
lkcllinux kernel expects 64, and writes *overlapping* TLB entries into cache lines. whoops17:02
lkclghostmansd[m], have you used autoconf before? it's quite straightforward20:34
lkclthere will be a config.h.in file into which you put #undef HAVE_WHATEVER20:35
lkclthen adding that option to configure.ac will "work"20:35
lkclbest thing to do is find something "reasonably similar" and cut/paste all occurrences of that20:35
lkclbut the important one not to miss is that config.h.in which you will find listed in configure.ac as a target that gets rewritten (macro-substed)20:36
lkclby running autoconf that config.h.in auto-generates a config.h20:37
lkclover the past 25 years i've done half a dozen projects with it - samba, freedce, python, webkit - so am used to it20:38
ghostmansd[m]I've not used it personally. Checked the output, yes. Rewrote the gnulib in Python, for sure. But using it is somewhat, well, exceeding the limits of my patience.20:50
ghostmansd[m]Every time I have to take a look at it is as if I see it for the first time, lol20:51
ghostmansd[m]But I have the same issue with regex, so I assume this is just a personal glitch20:51
lkclit's about a... 4-stage process. don't for goodness sake try to "learn" autoconf, go with a "pattern-matching" approach20:53
ghostmansd[m]Sure won't20:53
lkclfind something correspondingly similar, grep for all occurrences of that #define feature, and literally cut/paste20:53
lkclif you get really stuck i'll help out20:54
ghostmansd[m]Ok, it's a deal! :-)20:55
* lkcl just coming up to yet another crunch-point for dcache debugging in verilator20:55
lkclabout another 500,000 to 1,000,000 instructions to go20:56
ghostmansd[m]I think the thing basically boils down to two parts:20:56
ghostmansd[m]1. We need configure.ac to place #define SVP64 in config.h;20:56
ghostmansd[m]2. We need to adjust build system to build some code depending on whether SVP64 is active.20:56
ghostmansd[m]Basically the only obstacle here is autotools, frankly speaking20:57
ghostmansd[m]But that's not the first time I deal with it, so no way we surrender :-)20:58
lkclit really isn't an obstacle. it's extremely sophisticated and mal-aligned by people who don't understand its purpose: low-level portability across literally any system20:58
* lkcl trying to remember... ok config.h.in is autogenerated by configure.ac20:59
lkclso you should *expect* to see (once the correct voodoo incantation is added to configure.ac) a bunch of "#undef HAVE_XXXXX" entries in config.h.in21:01
lkclwhich when running autoconf will generate corresponding "#define HAVE_XXXX" entries in config.h21:02
ghostmansd[m]> by people who don't understand its purpose21:02
ghostmansd[m]It's like what I'm thinking of make. Almost anytime I see makefile people invent a brand new build system out of simple stupid tool capable of "I can track dependencies, and hey, I can also check for timestamps"21:02
lkclrrriiight.21:03
ghostmansd[m]I mean, hey, to me it looks like that people don't understand that make is _not_ a build system21:03
lkclmy favourite one there was someone - and i swear that this is genuine - writing and submitting a patch to python to replace autoconf with scons.21:03
lkclhttps://git.libre-soc.org/?p=binutils-gdb.git;a=blob;f=configure.ac;h=2b10e9a1b0260668cc3851ecfa04d59210d6eca0;hb=refs/heads/svp64#l356221:04
ghostmansd[m]It's a simple pipeline, so to speak. A mere automatuon tool.21:04
lkclyehyeah no totally get it21:04
ghostmansd[m]Wanna build system? gn, meson, even partually ninja to some degree.21:04
lkclright, the "--enable-maintainer-mode" voodoo incantation would be a good one to cut/paste copy21:04
lkclit's just a true/false setting, no "option" passed in, there.21:05
ghostmansd[m]Ok, will check this one21:05
ghostmansd[m]Thanks!21:05
ghostmansd[m]We also have another issue21:05
ghostmansd[m]We extend powerpc_opcode struct...21:05
ghostmansd[m]And, well, we have a new 64-bit int there21:06
lkclwhich means a zero needs to get added onto all struct fields, i know...21:06
ghostmansd[m]Yehyeh21:06
ghostmansd[m]I went with pragma for no221:07
ghostmansd[m]*now21:07
lkclwhich is why i think subconsciously i was recommending a uint64_t21:07
ghostmansd[m]Because, well, patch for all these entries is insane21:07
ghostmansd[m]That won't help21:07
lkclbut if you use a union with the struct it'll not need every entry in the bitfield filled out21:07
lkclunion { uint64_t x, struct blah blah { ... }}21:08
ghostmansd[m]Fricking GCC -Wmissing-field-initializers21:08
ghostmansd[m]Yeah, but at least 1 zero is needed21:08
ghostmansd[m]Even for uint64_t21:08
lkclthen set the *union* entry to zero not every single frickin bitfield, it'll be slightly more sane21:08
lkclyes sensible with the -Warn21:08
ghostmansd[m]And this makes patch bigger a lot than we want21:09
lkclyyeah21:09
* lkcl thinks21:09
lkclthere is actually a way round it21:09
ghostmansd[m]So I really would like to kick build system's ass21:09
lkcluse a *second* ppc_binutils struct21:09
lkclwhere the one that goes into the hashtable has the merged stuff21:09
lkclbut the one with the 10,000 entries does not and is not modified21:09
ghostmansd[m]You mean malloc it?21:10
ghostmansd[m]Different type, kinda C inheritance?21:10
lkclis it... ahh right, the pointers in the hashtable are just to the static data?21:10
ghostmansd[m]Yes, thought about it...21:10
* lkcl haven't looked in a year21:10
ghostmansd[m]Yep21:10
lkclarse21:10
ghostmansd[m]Lol21:10
* lkcl mumble mumble21:11
lkcl2nd hashtable...21:11
lkclmalloc....21:11
lkclextend the ppc_binutils struct...21:11
lkclall "meh" options, darn it21:11
ghostmansd[m]Yeah, kinda `struct powerpc_svp64_opcode { struct powerpc_opcode base; uint64_t ext; }`21:11
ghostmansd[m]And then malloc + memcpy21:12
ghostmansd[m]Not sure of exact place for deallocation, though21:12
ghostmansd[m]But think it's doable21:12
lkclyuk21:12
lkclyehyeh21:12
ghostmansd[m]And cast to aggregates starting with common sequence should work21:13
ghostmansd[m]Any compiler which breaks this is a real ass21:13
ghostmansd[m]Still kind hacky21:13
ghostmansd[m]*kinda21:14
ghostmansd[m]Will check all these options. Really think we should keep the patch as decoupled and simple as we can.21:14
lkcltends to suggest a separate hashtable, doesn't it?21:21
lkcloleeee! no 0x400 exception, no corrupted TLBs21:26
ghostmansd[m]Frankly, yes. That's why I suggested it before you suggested extending the original powerpc_opcode. :-)21:27
lkcldevtmpfs mounted!21:27
ghostmansd[m]That said, I still think your approach is better.21:27
lkclghostmansd[m], i remember. whoops :)21:27
ghostmansd[m]Because otherwise we simply duplicate entries.21:27
ghostmansd[m]Congrats lkcl!21:28
ghostmansd[m]Ok, have to rest for today21:28
lkclalright sah21:29
ghostmansd[m]Good luck for other stages!21:29
ghostmansd[m]And, as always, a huge thank for help and advice!21:29
lkclno problem21:29
octavius"people don't understand that make is _not_ a build system", then what should a programmer use to compile a project in, say, C? From my brief reading about Make, I understood that it's more like a scripting language, it runs routines depending on rules21:41
octaviusI've been using Make for my toy C code, however I have hit limits on the usability of my makefile21:42
lkclcorrect: it "runs routines based on rules"21:42
lkclit's *not* a "build system"21:42
lkcltherefore "oh look, you can use it *for the purpose of* performing builds"21:43
octaviusWhat *is* a build system? Something that provides dynamic library paths, your code path etc.?21:43
lkcla build system would, in my mind, be something like... mmm... openembedded.  (aka yoctoproject)21:43
lkclor, buildroot21:43
lkclwhich is about 5 or more levels far beyond the "make" command21:44
lkclor, Eclipse21:44
octaviusso is the reason why make can be used for compiling C code because the Linux environment effectively *acts* as the build system?21:46
octaviusBecause just as easily, shell script can substitute the makefile21:46
octaviusHowever the tools that you mention, give much more flexibility as to which libraries and dependencies you pull in21:47
lkclno, linux is not a "build system", it is an operating system. you use it to perform a build, by running some commands, but it is a general-purpose "program-runner"21:48
lkclone of those "programs being run" will happen to *be* a "build system" (such as buildroot, openembedded) but it is a conflation to then consider linux to *be* a build system21:49
octaviusok21:49
lkclunless of course you set up a dedicated machine21:49
lkclto which, in your data centre, you give it the one single absolute exclusive purpose, "building a system"21:50
lkcland oh look the OS happened to be linux21:50
lkclin which case it would be perfectly reasonable to refer to that machine as "the build system"21:50
octaviusBut if you just install build-essential, what is it that can be called the build system that is used for C compilation? GCC, ld?21:51
lkcllet's say you replaced make with shell scripts21:51
lkcland it takes 5 hours to build 50,000 object files21:51
lkclyou then change one header file that requires 3,000 of those object files to be rebuilt.21:52
lkclhow do you identify, in your shell scripts, which object files need to be rebuilt?21:52
octaviusYou have to check the rules that define the dependencies. A simple shell script doesn't do that21:52
lkclcorrect21:53
octaviusWhereas a build system would21:53
lkclnow you understand why make exists21:53
octaviusok21:53
lkclagain: you are thinking "too big an all-encompassing box" by using the term "build system"21:53
lkclyou could just use "make" for that purpose i described21:54
octaviusBut because Make is so open-ended, it was not really optimised for being used just for building21:54
lkclyou do not in any way need a "full build system"21:54
lkclit's the largest task for which it happens to be put21:54
lkclbecause of its amazingly-generic ability to analyse recursive dependencies21:55
octaviusAh ok21:55
lkclall of this is just... "semantics" or "nit-picking" at one level21:55
lkclbut it is a fine-grain distinction that turns out to be important if you need to know :)21:56
octaviusTrue ;)21:56
lkclDRAT. the 0x300 exception had simply moved to a different point because of the changes to the cache size21:56
lkcldrat21:56
lkclit's at least really funny to get a fully-functioning interactive linux kernel debug / monitor prompt21:58
lkcland, thank god for save/restore breakpoints21:59

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