A simple CIL-to-GPU translator targeting PTX/AMDIL for NVIDIA/AMD GPUs. You write your GPGPU code using pure C# and launch the kernel via OpenCL interface (subset of https://openclnet.codeplex.com codebase is used here). Translation pipeline relies on .NET introspection (Mono.Reflection disassembler by Jb Evain is used here).
Translation pipeline starts from ordinary .NET compiler and continues with 5 runtime phases:
- Disassembling with Mono.Reflection namespace functions.
- Instructions selection (intermediate representation construction).
- Optional IR-based optimization: subprograms inlining.
- Target code generation: IR->PTX for NVIDIA or IR->AMDIL for AMD.
- Final compilation with OpenCL functions from OpenCL.Net namespace.
This project was originally developed under master thesis research. The Author hopes this code may be useful in educational purposes.