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

Re: How to write optimized code for an instruction set not supported by my computer?

<tomas@tuxteam.de> writes:
This link might be relevant:


Besides Intel's Software Development Emulator, which seems to have pretty
burdensome license terms (on a superficial read -- it seems you have to
download the whole gorilla to just read the license, duh) it seems that
Bochs is the way to go?

I have encountered that superuser.com question previously. It does not really provide a solution. It mentions an experimental extension to QEMU (an old version of QEMU) that implements some AVX instructions. I am wary of software like that. It seems to be done more as a proof of concept and as an exercise than a something intended for "production" usage.

mailinglist@darac.org.uk writes:
Is the intention to eventually run this code on a system that does support that instruction? If so, then yes, emulation should do the job.  As you mention, it will be slower than native, but it will execute enough for debugging.

If you only ever intend to run it on a machine that doesn't support that instruction then... what's the point?

Yes, the code will be eventually run on a system with native support for the instructions.

mailinglist@darac.org.uk writes:
I doubt that, even if the Bochs emulator is single-threaded, it doesn't support multiple threads in the emulated system. The nature of threads is that they're handled by the kernel, rather than the CPU.

Another alternative would be QEMU, which allows you to assign multiple vCPUs to a system.

QEMU does not support AVX as far as I know.

The problem with Bochs and multithreading that I was referring to is that although the OS can handle multiple threads just as well on a single core system than on a multiple core system, the threads won't run on parallel; that has effects on performance which are not present on a real multithreaded systems, and those effects should be accounted for when tunning for performance.

joel.rees@gmail.com writes:
Why on earth would you want to go to the bother of using AVX
instructions for working with Base64?

For performance, of course. That is always the case when explicitly using some instructions in specific (rather than leaving it to the compiler to decide which instructions to use).

joel.rees@gmail.com writes:
The question being begged is this -- Do you really want to use AVX
enough to sign the Intel agreement that you can't read unless you
agree to it before you read it so you can download it and read it?

It *is* a valid question, and I can't tell you the answer to that.
Maybe you can't answer that question yourself yet.

No, I am not willing to use Intel's proprietary tools. In an earlier message in the same thread I said that I avoid proprietary software. That is one of the reasons of why I use Debian: It is easy to avoid the proprietary software.


Thanks to everybody who replied. I will probably use Bochs when time comes to port the algorithm to AVX. Right now I am writing and perfecting it in portable C, to have a base result against which to compare performance and complexity.


Reply to: