Search code examples
prologbit-manipulationhpcsicstus-prologclpz

Utilizing CLMUL in SICStus Prolog


How can I get the SICStus Prolog JIT to use any of the following ISA?

I need them for supercharging . Right now, I got:

  1. http://www.hackersdelight.org/ and

  2. the non-ISO arithmetic function msb/1.

For a start that's good, but I want more. Please help!


Solution

  • Unfortunately, there is no way for users to extend the JIT for cases like this.

    I have been thinking about accessing the population count instructions (for some unrelated uses) from Prolog. The way to add this and other similar instructions would be:

    1. Add a new arithmetic instruction to is/2. This needs to be supported by all our code, not just JIT-compiled code, so interpreter, WAM-emulator, various internal byte-code-processors, all the static analyzers in our IDE, etc. etc.
    2. Add JIT-compilation that just calls back into the corresponding C routine in the runtime system.
    3. If it can be demonstrated to benefit performance sufficiently, make the JIT compiler emit the special purpose CPU instructions for targets that have them.

    (1) requires sufficient user demand (or explicit financing, of course). (3) requires convincing benchmarks. Currently neither of these are available, but that could change, of course.