Automatic Code Optimization - ProkopHapala/FireCore GitHub Wiki
// C++ code with a Tiramisu expression.
// Declare a Tiramisu expression (algorithm) that is equivalent to the following C code
// for (i=0; i<100; i++)
// for (j=0; j<100; j++)
// C(i,j) = 0;
#include "tiramisu/tiramisu.h"
using namespace tiramisu;
void generate_code(){
tiramisu::init("foo"); // Specify the name of the function that you want to create.
var i("i", 0, 100), j("j", 0, 100); // Declare two iterator variables (i and j) such that 0<=i<100 and 0<=j<100.
computation C({i,j}, 0);
// Specify optimizations
C.parallelize(i);
C.vectorize(j, 4);
buffer b_C("b_C", {100, 100}, p_int32, a_output);
C.store_in(&b_C);
C.codegen({&b_C}, "generated_code.o"); // Generate code
}