From: Carlos S. de La L. <car...@ur...> - 2011-10-24 14:05:31
|
> > 1) Make kernel library runtime compatible with all devices. This was the > > planned approach, it can be done by selection the implementation for a > > device using runtime conditional (C-level ifs) instead of preprocessor > > ones (#if/#ifdefs). LLVM should then eliminate dead code when generating > > the final binary. > > This does not allow hardware-dependent optimisations. For example, > certain function calls / assembler instructions are only available on > certain hardware, and lead to syntax errors on others. After some rethinking and discussion, it is probably better to forget about bytecode device independency. It is not designed to work that way and even compiled bytecode for different targets is already different just after clang. So different bytecodes inside API structures and different libraries for each device then. One interesting point is that if we want proper "vectorization" (once that is working) on the library code also, the library needs to be compiled into bytecode and linked at bytecode level, before WG generation, but LLVM assembly can handle inline target assembly so this should not be a problem. One pending task is thus to organize the library Makefiles in a way that allows each target to override generic implementations with target-dependent ones. > Now, it would be nice if these were not necessary. This would require > providing them via LLVM, i.e. implementing the OpenCL run time (e.g. > sin, cos, sqrt, their vectorised versions, etc.) in LLVM instead of in > POCL. It would simplify our job, but would make every LLVM backend have to implement all those functions, this means will make backend implementation more complex. I am dubious that LLVM project will go that way. BR, Carlos |