tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Backend][Relax] Add NPU BYOC backend example

Open Aristide021 opened this issue 4 months ago • 4 comments

This commit introduces a vendor-neutral NPU backend that demonstrates architectural patterns common across Neural Processing Units.

The implementation covers key NPU concepts including multi-tier memory hierarchy management, automatic tiling for large tensors, quantization handling, and specialized execution engines. It shows how NPUs manage memory across different tiers (L0/L1/L2/L3), tile operations to fit in on-chip SRAM, and dispatch operations to dedicated compute units.

This serves as an educational template for developers creating NPU backends, demonstrating BYOC integration while teaching NPU-specific optimization strategies. Uses CPU emulation for testing without requiring actual NPU hardware.

CC @tqchen - This addresses your feedback from #18201 regarding generic NPU BYOC tutorials.

Aristide021 avatar Aug 28 '25 18:08 Aristide021

cc @mshr-h can you help to take a look

tqchen avatar Aug 28 '25 19:08 tqchen

@tvm-bot rerun

mshr-h avatar Aug 29 '25 05:08 mshr-h

@Aristide021 ,

Very nice work, congratulations!

As a simple user who might have such interests, walking through the contrib section, could there be a simple README.md companion in this ‎python/tvm/relax/backend/contrib/example_npu with basic description of this folder's content ? It could describe a summary/purpose/technical/diagram (not necessarily all enumerated) perhaps even output results of the examples.

E.g. the description given here in the header of the PR is very useful but users don't "immediately" read the originating PR.

cbalint13 avatar Aug 29 '25 09:08 cbalint13

@Aristide021 ,

Very nice work, congratulations!

As a simple user who might have such interests, walking through the contrib section, could there be a simple README.md companion in this ‎python/tvm/relax/backend/contrib/example_npu with basic description of this folder's content ? It could describe a summary/purpose/technical/diagram (not necessarily all enumerated) perhaps even output results of the examples.

E.g. the description given here in the header of the PR is very useful but users don't "immediately" read the originating PR.

@cbalint13 Thank you for the feedback! I've added a comprehensive README.md in the latest commit that includes context and documentation that a user would need to understand when implementing an NPU backend.

Aristide021 avatar Aug 30 '25 14:08 Aristide021