News for hackers. Stuff that matters.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by voidbert on Wednesday April 09, 2025 @07:15PM (#43639012)
So, could it be a feasable for a Zen CPU to have multiple microcode banks it switches between, so that it can run code in multiple architectures? For example, in addition to x86, some microcode for running WebAssembly or Java bytecode with native performance and no JIT overhead?
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by throwaway48476 on Wednesday April 09, 2025 @07:24PM (#43639065)
Its possible but the platform would have to support it, ie UEFI etc.

Some arm CPUs did have a mode that ran Java bytecode natively but it was slower than the jvm.

https://en.wikipedia.org/wiki/Jazelle

Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by mosura on Wednesday April 09, 2025 @07:45PM (#43639188)
These often repeated notions about Jazelle make little sense.

J2ME code for Jazelle based feature phones (with appropriate VMs) was noticeably faster than otherwise, to the point Android raw Java performance did not catch up for a really long time. If you have loads of RAM to JIT later then . . . good, but that didn’t arrive for years after the fact.

Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by grishka on Wednesday April 09, 2025 @07:51PM (#43639225)
Android ended up doing AOT (the infamous "optimizing apps" step on boot). The modern versions, iirc, have a hybrid approach, interpreting and JITing for newly installed apps but still AOT compiling while the device is charging.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by dzaima on Wednesday April 09, 2025 @07:50PM (#43639219)
Directly running wasm/Java bytecode in hardware is just a bad idea unless you somehow have tons of loopless code that'll only be run once; both are stack-based with an unbounded stack size, so each op would have multiple memory loads/stores. At the very least you'd want some rewriting to use multiple registers, at which point a simple JIT/AOT isn't far off.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by monocasa on Wednesday April 09, 2025 @07:57PM (#43639267)
At least for jazelle, R0-R3 were an alias for top of stack, which removed a lot of memory accesses for the stack nature of the ISA.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by AstralStorm on Wednesday April 09, 2025 @08:03PM (#43639300)
And that still ultimately proved slower than JIT and AOT sped up JIT.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by monocasa on Wednesday April 09, 2025 @08:09PM (#43639338)
And it wasn't targeting devices that had enough spare RAM to run a JIT.
Re:Run RISC-V Binaries on AMD Zen-Series CPUs via Microcode ... by wtallis on Wednesday April 09, 2025 @07:50PM (#43639222)
No, it would need multiple instruction decoders to switch between, not just swapping microcode. Most instructions are not handled with microcode.