webonnx / wonnx

A WebGPU-accelerated ONNX inference run-time written 100% in Rust, ready for native and the web
Other
1.61k stars 59 forks source link

Fix Concat for larger inputs and add an additional test #183

Closed mayjs closed 1 year ago

mayjs commented 1 year ago

I messed this up in !180, sorry about that. The num_workgroups obviously only contains the number of workgroup invocations along each axis. To calculate actual_idx, we need to consider the total number of executions in the x axis, so we have to multiply with the workgroup size.

mayjs commented 1 year ago

Just as a side note: With this fix and the current state of !182 I can successfully execute a UNet network in wonnx.

pixelspark commented 1 year ago

Cool! It seems our CI tests are not configured properly but the code looks good. Would be nice to have UNet as a (testable) example, is that something you could add easily?

mayjs commented 1 year ago

Cool! It seems our CI tests are not configured properly but the code looks good. Would be nice to have UNet as a (testable) example, is that something you could add easily?

Well, that depends on how functional it would have to be for the example. The pretrained model I'm using right now is GPL licensed, so we can't integrate it into this repository. Besides, the ONNX file is about 60MB, so it would not really be a great idea to integrate it into the repository as is.

Maybe we could somehow generate the UNet graph in code and initialize the weights with a random number generator and a fixed seed? That way we could at least test for the correct output values, but the network wouldn't do anything useful of course.