taichi.js icon indicating copy to clipboard operation
taichi.js copied to clipboard

Export Python kernels to taichi.js?

Open ringohoffman opened this issue 1 year ago • 0 comments

I have kernels already written and developed in taichi Python that I want to export to use in a web app.

I really would like to be able to create the canvas in taichi.js like:

  let htmlCanvas = document.getElementById('result_canvas');
  htmlCanvas.width = 512;
  htmlCanvas.height = 512;
  let renderTarget = ti.canvasTexture(htmlCanvas);

and pass the renderTarget to the exported taichi Python kernels running on a WebGPU backend.

In your post announcing your plan for taichi.js, you said

I have hacked up a WebGPU Taichi runtime and used Taichi AOT and Tint to generate some WGSL kernels

When I look at the taichi-aot-demo, I see that you need to select a specific taichi arch for your AOT runtime:

    runtime_ = ti::Runtime(arch_);

I don't see WebGPU as an officially supported architecture: https://docs.taichi-lang.org/docs/taichi_core#enumeration-tiarch

How can I make my taichi Python code interoperable with taichi.js? Is it possible with existing tooling? Would you consider exposing a Python API for orchestrating this exporting?

cc: @kurtisdavid @CandiedCode

ringohoffman avatar Feb 11 '24 06:02 ringohoffman