Open xuhao1 opened 3 years ago
Thanks! Supporting pointer
on the CC backend is not on our near roadmap yet. We can try to figure sth out regarding how users can better utilize the LLVM backend's compiled results.
@k-ye Thanks for your reply! Directly using LLVM's compiled result is more reasonable than use C as a intermediate representation . Do you have any roadmap on this?
Hey @xuhao1 !
Basically, you can dump the .ll
file using print_kernel_llvm_ir
and print_kernel_llvm_ir_optimized
(see also https://taichi.readthedocs.io/en/latest/contributor_guide.html#tips-on-the-taichi-compiler-development), then convert the ll
to an actual library via LLVM CLI tools.
Inside the .ll
file, you should be able to find functions like cpu_parallel_range_for
and cpu_parallel_range_for_task
(if you choose the ti.cpu
backend), among various other arcane stuff... . Basically, cpu_parallel_range_for
is the entry point of the CPU-backend's thread loop, and the body
parameter is the LLVM IR generated from your @ti.kernel
.
Sorry I know this is not a great answer and lacks lots of details. But if you start playing around with a simple taichi kernel, it might become intuitive to figure out what's going on... We are trying to implement something that can dump your taichi kernels into a file and load it separately, please stay tuned! :-)
@k-ye Well I am taking a look of this method and trying to understand the LLVM layer of taichi. Also hoping we can see your new easy-to-use dumping tool soon~ Thanks for your excellent work on taichi again.
Describe the bug I am trying to export the taichi kernels to C code because my own taichi project TaichiSLAM requires massive real-time IO. I followed the instructions and tried to record my kernel, it raise
Sparse data structure is improtant to my SLAM project (that's why I trying to write them in Taichi), and the IO speed of python too slow for a real-world aerial robot.
Does Taichi has the plan to support SNodeType=pointer on C backend or I have another way to call Taichi kernels in C/C++?
To Reproduce
Log/Screenshots