tiramisu
tiramisu copied to clipboard
Conversion from Tiramisu DSL to C Language For-loop Code
Hello,
I'm currently working with Tiramisu DSL and code_generator, and I would like to know if it's possible to convert Tiramisu DSL code into equivalent C language for-loop code.
Here is an example of the Tiramisu DSL code:
computation comp1("comp1", {i3, i4, i5}, (comp0(i3, i4, i5) + comp0(i3, i4, i5 + 1) - comp0(i3, i4, i5 + 2)));
I would like to convert the above Tiramisu DSL code into a C language for-loop code structure similar to the following:
for (i3 = 2; i3 < 8; i3++) {
for (i4 = 2; i4 < 8; i4++) {
for (i5 = 2; i5 < 8; i5++) {
buf1[i3][i4][i5] = buf0[i3][i4][i5] + buf0[i3][i4][i5 + 1] - buf0[i3][i4][i5 + 2];
}
}
}
Are there any existing tools or methods available that can convert Tiramisu DSL code into C language for-loop code?
I would appreciate any guidance or information you can provide regarding existing tools, libraries, or approaches that could assist in this conversion process. Thank you for your time and assistance.
Hi
Tiramisu does not have a ready-to-use C backend, you can add one very easily.
There are two ways for doing this:
- Tiramisu generates Halide IR. You can translate Halide IR to C very easily.
- Tiramisu generates an ISL AST before generating the Halide IR. ISL has a C code generator from ISL AST, you can use that one.