By: Mark Roulo (nothanks.delete@this.xxx.com), March 20, 2021 5:49 pm
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on March 20, 2021 1:20 pm wrote:
> Hugo Décharnes (hdecharn.delete@this.outlook.fr) on March 20, 2021 7:34 am wrote:
> > Having programs delivered in annotated, intermediate representation (IR) would be great.
>
> In theory.
>
> Not necessarily in practice.
>
> Not only do you often have a big optimization problem (look at everybody who has tried
> it: they pretty much always ended up having a "native mode" fallback for games), but
> you have a very nasty testing problem, because often the IR is designed by compiler people,
> and those people are more than happy to talk about "undefined behavior" etc.
>
> So the end result will generally be rather under-defined, and then different
> hardware, and different recompilers will result in different behavior.
>
> That happens even with real hardware, but it at least tends to happen less. Partly because
> the HW people have actually mostly learnt from their mistakes, while in many areas the compiler
> people have been even more open to "undefined behavior" in the name of performance.
>
> Java (and wasm) is actually doing pretty damn well. It's unusually well-specified
> for an IR (despite issues), it works, it's used, and it's fine.
Were I trying to design some sort of distributable/executable IR-ish format I would focus on being able to specify "don't care" about sequencing.
One weakness with the Java Virtual Machine is that loops MUST have an order, even if the iterations are independent. In theory a good OoO engine can/might be able to untangle all the artificial dependencies. I'd like the ability to just not put in artificial/wrong dependencies that must then be removed.
Maybe there aren't enough of these for "normal" code to be worth while.
> Hugo Décharnes (hdecharn.delete@this.outlook.fr) on March 20, 2021 7:34 am wrote:
> > Having programs delivered in annotated, intermediate representation (IR) would be great.
>
> In theory.
>
> Not necessarily in practice.
>
> Not only do you often have a big optimization problem (look at everybody who has tried
> it: they pretty much always ended up having a "native mode" fallback for games), but
> you have a very nasty testing problem, because often the IR is designed by compiler people,
> and those people are more than happy to talk about "undefined behavior" etc.
>
> So the end result will generally be rather under-defined, and then different
> hardware, and different recompilers will result in different behavior.
>
> That happens even with real hardware, but it at least tends to happen less. Partly because
> the HW people have actually mostly learnt from their mistakes, while in many areas the compiler
> people have been even more open to "undefined behavior" in the name of performance.
>
> Java (and wasm) is actually doing pretty damn well. It's unusually well-specified
> for an IR (despite issues), it works, it's used, and it's fine.
Were I trying to design some sort of distributable/executable IR-ish format I would focus on being able to specify "don't care" about sequencing.
One weakness with the Java Virtual Machine is that loops MUST have an order, even if the iterations are independent. In theory a good OoO engine can/might be able to untangle all the artificial dependencies. I'd like the ability to just not put in artificial/wrong dependencies that must then be removed.
Maybe there aren't enough of these for "normal" code to be worth while.