I am currently looking for ways to generate CUDA C code.
For example the following fake Hello world (yeah it's an empty function on the
GPU).
#include <stdio.h>
#include <iostream>
__global__ void kernel (void){
}
int main( void ) {
kernel<<<1,1>>>();
printf( "Hello, World!\n" );
return 0;
}
For the global in the proc declaration I can create a new pragma with
codegenDecl similar to the following to request alignment of variable
{.pragma: align16, codegenDecl: "$# $# __attribute__((aligned(16)))".}
var foo{.aligne16.}: array[100, int]
I just have to figure out the $#
Now for the chevrons notation in the function call, where should I start? Are
[mixins](https://nim-lang.org/docs/macros.html#statements-mixin-statement)
mentionned in the macro module the way to generate custom C?
Note: I'm aware of [cudanim](https://github.com/jcosborn/cudanim) however
instead of generating the
kernel<<<1,1>>>();
It will generate something like which is a functionally equivalent alternative
cudaLaunchKernel(1,1, kernel)