Hello Dmitry,
>>Other mostly works well. At least on x86 platform, I can run LLVM
>>bitcode on windows which is compiled on linux or darwin.
>
> Unfortunately, bitcode is not portable between OSes in general case (even on
> the same CPU).
> It may work though. And the problem is not only datalayout (default
> alignments are different), but
> different function calling ABI. I.e. for simple cases it will work the most
> likely, but for multiple
> parameters (especially structure types, floating point values and hardware
> vector register types will
> definitely break the the code). And this is a problem as ABI lowering
> happens in clang (i.e. in FE,
> when IR is generated), but not in codegen. So, be careful calling library
> and other external functions.
Yeah! my 10 years of PPC/AltiVec, x86/SSE, Cell/SPE, and other SIMD
architecture coding experience shows ABI incompatibility is annoying
problem.
Possibly only one solution I've found is pass everything by pointer
and don't use return value. e.g.
vec4 muda(vec4 a, float b, struct bora c);
->
void muda(vec4* ret, vec4* a, float* b, struct bora* c);
I use this technique to C/C++ JIT shader, MUDA compiler experience(
http://lucille.sourceforge.net/muda/ ), and other production
code(Mac/Linux/Win) using LLVM I'm developing. At least it has been
working well.
Even though this might not produce efficient code(Calling convention
might force the compiler to produce register-to-memory copy for vector
value, for example), but usually heavy compute kernel is resident in
ISPC(or other SIMD language) world, so inefficient code at C/C++
boundary won't be critical to the entire performance.
>>If ISPC version works well by fixing the problem discussed here,
>>things could be much more nicer and it would be good example of ISPC
>>use!
>
> Thanks for bringing attention to this problem, we will definitely work on
> it.
Also, it would be interesting if ISPC JIT shader could be combined
with embree ray tracing kernel.
--
Syoyo