[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C extension as mandatory

Hi Glenn,

Em 17 de abr. de 2021 às 23:27, Glenn Baxter <glenn@petacat.com> escreveu:
> Hello,
> I am somewhat new to RISCV, but am fairly familiar with SiFive, CVA6, BOOM(s) and most recently with Black Parrot.  I am trying to understand the rational for the mandatory usage of C extension in order to build Linux. I read the reasoning online, but do not agree it should be mandatory.  Compression is an expensive extension which can slow down the CPU’s execution speed (Fmax), and affects area, particularly in FPGA implementations.
> This then leads me to a question:   It should be possible to compile all of the tree without compression and it should function.  Is there any way to do this?  Not all RISCV implications support C, and it would be a shame to not be able to run Debian on them.

This was discussed quite a lot at the time.  For some reason they
decided to make the C extension mandatory for "Unix-class" (general
purpose OS) processors, that is, processors capable to run modern OS,
not like microcontrollers.

I believe that the reason there was that it was a significant
advantage to use the C extension for the usual benefits (reduction in
cache usage, speed-up to be able to keep more code from the working
set in the fastest caches, etc).  I don't recall the actual figure,
but the gains were something significant like 10%, not something
marginal like 1-2%, and brought it more or less on par with other
major architectures (e.g. ARM's Thumb).

Basically at the time we decided to follow that decision, after
speaking public and privately with several knowledgeable people very
involved with those decisions.  Having not done that would have meant
that, yeah, it would be able to run in FPGAs or experimental designs,
but at the cost of running slower/use more energy/etc for regular
users, and having Debian compared badly against other OS/distros that
decided to go with the C extension.  So we could risk having another
case of Raspbian... RISCVian maybe? :)  At least for me, this was/is a
significant concern.

Now for solutions... I expect that in order to be able to run the
code, it would need to be recompiled without the C extension, by
making the compiler to ignore that.  Not sure how difficult is that
though... it depends on the packages that you want to run, because to
do it for the whole distro is quite impractical.  But for a small
Debian base, it can be a matter of hours to copile the base packages.

As another wild idea, I think that in theory it would be possible some
kind of transformation changing the binaries to use the full-length
instructions, but not sure if anyone has ever tried something like

Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>

Reply to: