gwihlidal / intel-tex-rs

Rust bindings for Intel's ISPC texture compression
Apache License 2.0
23 stars 4 forks source link

Use ispc_compile and ispc_rt to feature gate compilation of ISPC code #3

Closed Twinklebear closed 5 years ago

Twinklebear commented 5 years ago

This PR uses the newly split ispc-rs crates, ispc_compile and ispc_rs to feature gate the compilation of the ISPC code to fix #2 . The compiled library are portable across vector ISAs by compiling them for multiple ISAs, then ISPC internally will pick the right backend to dispatch the function calls too, based on the host ISA. There's an existing issue in the ISPC compiler which seems to give an ICE if I compile for the KNL and SKX targets as well with optimization enabled, so I just have SSE through AVX2 on the list. I'll open an issue on the ISPC repo shortly with a smaller repro case (this may be a windows specific thing, or fixed in 1.10.0, I'm still looking into this some).

To compile the ISPC libraries and bindings compile with the optional feature enabled, cargo build --features ispc. To build with the existing bindings, just compile with cargo build. This will select the right pre-compiled library for the corresponding host triple, so to distribute this library you'll need to build the bindings on each OS and package the libraries into the repo. The generated Rust bindings can be taken from any host OS though.

Twinklebear commented 5 years ago

I've worked around the ISPC crash (https://github.com/ispc/ispc/issues/1408) in https://github.com/Twinklebear/ispc-rs/commit/ad3d01cb24a266479a1744159b5a3add1483089f, released in ispc_compile 1.0.2

gwihlidal commented 5 years ago

Awesome! Thank you