02.10.2013, 14:46, "Steven Newbury" <st...@snewbury.org.uk>:
> How does this make any sense? NEON intrinsics are there to support code
> generation targeting the ARM NEON SIMD unit on the ARM architecture.
> Power/PowerPC as it's own AltiVec/VSX SIMD units, which in turn has it's
> own intrinsics.
>
> If you want write code that explicitly targets CPU execution units it's
> necessarily tied to that specific CPU architecture. If you just want to
> test code for written for a different CPU on a development box your best
> bet is to use a VM like QEMU with CPU emulation.
>
> If you want to write code that will take advantage of whatever SIMD
> hardware is available you might want to try abstracting your
> implementation and use one of the many libraries which provide a higher
> level API to SIMD optimized functionality.
For example, Eigen library [1] supports both AltiVec and NEON.
[1] http://eigen.tuxfamily.org
--
Regards,
Konstantin
Here is an example implementation of reciprocal square root with AltiVec intinsics:
--
Regards,
Konstantin
How does this make any sense?
02.10.2013, 15:12, "David Tweed" <david...@arm.com>:
> (Note: these are personal opinions rather than anything from my employer.)
>
> Although unusual, there might be circumstances in which it would make sense.
>
> | If you want write code that explicitly targets CPU execution units it's
> | necessarily tied to that specific CPU architecture. If you just want to
> | test code for written for a different CPU on a development box your best
> | bet is to use a VM like QEMU with CPU emulation.
>
> It's possible to have either already written code to analyse, or be
> intending
> to write code that will eventually
> be deployed on a particular mobile architecture but wish to develop that on
> a desktop
> machine. Using an architectural simulation will potentially incur more of a
> cost than implementing as much optimization of the emulation via compiler
> transformation at compile time. (Whether this is actually enough all the
> work of writing
> an LLVM backend is another question of course.)
Or to compile existing code using NEON intrinsics and run it on PowerPC device
without changes.
--
Regards,
Konstantin
On 2 October 2013 10:12, Steven Newbury <st...@snewbury.org.uk> wrote:
How does this make any sense?I have to agree with you that this doesn't make much sense, but there is a case where you would want something like that: when the original source uses NEON intrinsics, and there is no alternative in AltiVec, AVX or even plain C.
Stanislav,If I got it right above, I think it would be better if you could do that transformation in IR, with a mapping infrastructure between each SIMD ISA. Something that could represent every possible SIMD instruction, and how each target represents them, so in one side you read the intrinsics (and possibly IR operations on vectors), translate to this meta-SIMD language, then export on the SIMD language that you want.A tool like this, possibly exporting back to C code (so you can add it to your project as an one-off pass), would be valuable to all programs that have legacy hard-coded SSE routines to run on any platform that support SIMD operations.I have no idea how easy would be to do that, let alone if it's at all possible, but it seems that this is what you want. Correct me if I'm wrong.
Again, the tool you describe is exactly what I ultimately want to create. The translation to AltiVec would be a step towards understanding how to manipulate the intrinsics, but it is not a goal on its own.
Do you have any ideas where in the whole LLVM structure would it fit (should it be implemented as a separate optional pass)?
Of course, adding tests for all known supported conversions to/from would be critical to the success of your project.
You can certainly do this in terms of an LLVM transformation, but I think that creating some kind of header file would be, at least, where I'd start prototyping this.