#asahi-gpu · 2022-09-15 17:42
linaThe code could just do atof of course#asahi-gpu · 2022-09-15 17:42
linaI think you would just define the usual grammar for float syntax and then the code would have to parse it?#asahi-gpu · 2022-09-15 17:41
robherAny idea if flex/bison support parsing floats?#asahi-gpu · 2022-09-15 17:40
linaI might just implement it then and see how it goes#asahi-gpu · 2022-09-15 17:40
linaWell, at least knowing you think it's okay helps ^^#asahi-gpu · 2022-09-15 17:39
linaAh! Sorry, I didn't know.#asahi-gpu · 2022-09-15 17:39
robherBack to dtc, I wouldn't have an issue with supporting float values, but that's ultimately the dtc maintainer's call. That's David Gibson, not me.#asahi-gpu · 2022-09-15 17:34
lina(Well, the firmware in this case, but to the kernel it's all the same)#asahi-gpu · 2022-09-15 17:33
lina"Drivers don't use float" is great and all but when the hardware itself gives you an interface with floats... ^^;#asahi-gpu · 2022-09-15 17:33
linaI don't know whether a minimal NIH implementation would be better than just pulling in math-emu?#asahi-gpu · 2022-09-15 17:32
linaSo I don't think I should be trying to use real floats just for this, a little software implementation makes more sense if we need it...#asahi-gpu · 2022-09-15 17:32
linaBut this is just for initialization, it doesn't have to be fast, and it's just calculating constants so it doesn't have to be fully correct or handle all corner cases.#asahi-gpu · 2022-09-15 17:31
linaAnd I think that part of the code doesn't work properly on ARM... ^^#asahi-gpu · 2022-09-15 17:31
robherI think math-emu is generally for kernel doing soft float for userspace. I was going to say drivers don't use float, but then it seems there is one: AMD GPU. But that driver is so big, it hasn't been that closely reviewed. So just bury it in 1M LoC and you'll be fine. ;)#asahi-gpu · 2022-09-15 17:20
linaI think that would work, I just need to add it to the Rust helpers.c and export helpers for add/sub/mul/div, then I can expose it as a type in Rust with proper operators and everything.#asahi-gpu · 2022-09-15 17:19
linajannau: Ah, I didn't realize that existed as a stand-alone module like that!#asahi-gpu · 2022-09-15 17:00
jannauI wonder if the kernel's soft-float implementation (in include/math-emu) could be used if there's need for float math in the kernel#asahi-gpu · 2022-09-15 16:55
linaIf I do end up needing to do math in the kernel, it's probably only going to be add/sub/mul/div, and if it comes down to that I can *probably* write some little integer-only implementations of that? It doesn't have to handle any corner cases so it doesn't have to be fully IEEE754 compliant.#asahi-gpu · 2022-09-15 16:50
linaThen the remaining issue is the places that might need math to compute something rather than pass it straight through, but I don't know how big that problem is right now, so we might be able to get away with just copying data from the DT unmodified.#asahi-gpu · 2022-09-15 16:49
linaBut we need some data to come from the DT, so we need to get float data in there in a way that the kernel can eventually turn it into a real float32 bit pattern, even if it doesn't call it that.#asahi-gpu · 2022-09-15 16:48
linaThe way the driver does it is all the non-DT float constants are specified as floats, but are converted to u32s at compile time, so there is no float code at runtime#asahi-gpu · 2022-09-15 16:48
linaIf we used strings then the kernel would need an integer-only string to float parser...#asahi-gpu · 2022-09-15 16:48
linarobher: The kernel can just treat them as u32s, but they are floats, and they need to be floats when we pass them to the GPU#asahi-gpu · 2022-09-15 14:00
robherIn past cases, we just use strings.#asahi-gpu · 2022-09-15 13:59
robherlina: The kernel doesn't take floats either (except in some isolated spots).#asahi-gpu · 2022-09-15 13:54
linaIn that case though, it would be useful if dtc also supported operating on floats so we don't have to hardcode the result of the computations...#asahi-gpu · 2022-09-15 13:53
linaThe other issue is that of course the kernel can't actually operate on the floats, but it might need to in some cases. Though we might be able to just pre-compute any dependent values and put them in the DT, hopefully it's not that many.#asahi-gpu · 2022-09-15 13:53
linaOtherwise we'd have to specify them as raw hex which is not great...#asahi-gpu · 2022-09-15 13:52
linaI take it dtc does not support floats... would you be okay with adding that?#asahi-gpu · 2022-09-15 13:52
linarobher: I just noticed something... The GPU firmware takes in a bunch of power-related constants as floats, and some of those come from Apple's device tree. And they differ between different hardware platforms using the same SoC...#asahi-gpu · 2022-09-11 23:48
ntrung03[m]after more testing, apparently I was very wrong about the x2 part...#asahi-gpu · 2022-09-11 22:04
ntrung03[m]*at least 2 bits#asahi-gpu · 2022-09-11 22:02
ntrung03[m]lina: There are 2 bits for the OS thing actually :D there are 4x2(ttbr0 or ttbr1) MSR to configure the permission #asahi-gpu · 2022-09-11 15:11
Sobek[m]Well, that's better than pasting a password, say hunter2 in here :)#asahi-gpu · 2022-09-11 14:53
linaWhoops, sorry, that was unintentional ;;#asahi-gpu · 2022-09-11 14:53
linaPlus power management, which is probably very complicated (the firmware runs a lot of crazy estimation algorithms for that)#asahi-gpu · 2022-09-11 07:39
linaPlus power management, which is probably very complicated (the firmware runs a lot of crazy estimation algorithms for that)#asahi-gpu · 2022-09-11 07:39
linaAnd it probably saves power too, since doing those things on a dedicated coprocessor is probably a lot more efficient than waking up the main cores for them#asahi-gpu · 2022-09-11 07:38
linaThe firmware does a lot of things, like handle preemption, IRQs, and recovery, so it would be a lot of work to reverse engineer all that and implement it on the bare hardware#asahi-gpu · 2022-09-11 03:41
phireWhich mitigates many of the disadvantage of taking to the agx controller, and makes it seem like the smarter option. At least for now#asahi-gpu · 2022-09-11 03:40
phireWe can just upgrade to a new set of firmware once we have tested and gotten all devices working.#asahi-gpu · 2022-09-11 03:39
phireWe did briefly discuss this. The fact that iboot allows us to stick with a given set of firmware means the protocol isn't going to change unexpectedly on us.#asahi-gpu · 2022-09-10 23:33
ntrung03[m]lina: Is there any particular reason that we don't talk to the PowerVR(?) sgx directly instead of going through the ascv2 that has its protocol changing every now and then?#asahi-gpu · 2022-09-10 04:14
linaThe rest of it is the same as ARM page tables, it's just that they used yet another permission interpretation (just like SPRR...)#asahi-gpu · 2022-09-10 04:13
phireI beleive I labeled it OS bcause it was always set on pages that macos mapped.#asahi-gpu · 2022-09-10 04:13
phirehell, took me a long time to notice how close it was to arm page tables, or marcan might have had to tell be that#asahi-gpu · 2022-09-10 04:12
phireyeah, that was all done a while back. A lot of guess work#asahi-gpu · 2022-09-10 03:30
linaI looked at this recently but haven't updated the code yet...#asahi-gpu · 2022-09-10 03:30
linaIt doesn't actually work like that#asahi-gpu · 2022-09-10 03:30
linaThat was what phire wrote based on standard ARM permissions