[Mono-dev] arm fpu runtime selection

Geoff Norton gnorton at novell.com
Sun Jun 20 01:53:44 EDT 2010


On 2010-06-20, at 1:02 AM, Rodrigo Kumpera wrote:

> I think we can simplify your approach to a much more localized change:
> 
> 
> #ifdef MONO_ARCH_SOFT_FLOAT
> #define COMPILE_SOFT_FLOAT(cfg) ((cfg)->use_soft_float)
> #else
> #define COMPILE_SOFT_FLOAT(cfg) 0
> #endif
> 
> 
> And then on mini_method_compile:
> 
> #ifdef MONO_ARCH_SOFT_FLOAT
> cfg->use_soft_float = mono_arch_is_soft_float () && !COMPILE_LLVM (cfg);
> #endif
> 
> Then it's a matter of replacing all checks for MONO_ARCH_SOFT_FLOAT to checks for COMPILE_SOFT_FLOAT(cfg).
> 
> This approach relies on a minimally decent compiler capable of eliminating trivial dead code which IMHO is something we
> must assume to be true in 2010.
> 

The goal here is to support a runtime-selectable FPU mode (soft or hard) on architectures that support it.  I could restrict this back to a few archs, but I figured that I'd go broader at first to catch the general case for other arch's, but if you'd rather be more restrictive (ie; target this to an arm define for now and follow the above) I'm ok with that.

> I'm not a big fan of the mono_arch_is_soft_float bit. I would rather cleanup and unify this with simd and cpu-specific ops into a
> single cpu caps thing.
> 
> If we unify the above three, supporting AOT would be a matter of changing the initialization code to read a supplied argument that
> override auto-detected caps. This would be a great addition to help testing those runtime selectable features. I should have done it for Mono.Simd so our build bot could test it running on less capable hardware.
> 

Agreed, a general caps facility makes sense, but I wanted to localize the change for the first patch, and we can discuss unifying simd/fpu/etc into a caps facility that ties into AOT next?

> The only thing that would be very hard would be supporting runtime-selectable FPU under AOT. Well, not really, that would a minor enhancement over soft-float.
> 
> By the way, what's the use of runtime selectable FPU mode for JIT'd code if we don't do the same for the runtime itself?

Android for instance uses -mfloat-abi=soft everywhere, but each arch can take advantage of a hardware fpu if available outside the calling conv rules.  I'd rather not target soft float on hardware that can accelerate it.

-g



More information about the Mono-devel-list mailing list