{"id":13643640,"url":"https://github.com/tensil-ai/tensil","last_synced_at":"2025-04-21T02:30:57.617Z","repository":{"id":37053567,"uuid":"463728195","full_name":"tensil-ai/tensil","owner":"tensil-ai","description":"Open source machine learning accelerators","archived":false,"fork":false,"pushed_at":"2024-03-24T19:33:47.000Z","size":2942,"stargazers_count":358,"open_issues_count":18,"forks_count":29,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-11-09T15:43:16.811Z","etag":null,"topics":["artificial-intelligence","asic","fpga","hdl","machine-learning","scala","silicon"],"latest_commit_sha":null,"homepage":"https://www.tensil.ai","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tensil-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-26T02:00:32.000Z","updated_at":"2024-11-02T21:45:53.000Z","dependencies_parsed_at":"2024-06-19T02:57:29.249Z","dependency_job_id":"863f53ed-053e-45cf-aa33-96a0f1b16ad5","html_url":"https://github.com/tensil-ai/tensil","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensil-ai%2Ftensil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensil-ai%2Ftensil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensil-ai%2Ftensil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensil-ai%2Ftensil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensil-ai","download_url":"https://codeload.github.com/tensil-ai/tensil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249986042,"owners_count":21356313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","asic","fpga","hdl","machine-learning","scala","silicon"],"created_at":"2024-08-02T01:01:50.612Z","updated_at":"2025-04-21T02:30:52.607Z","avatar_url":"https://github.com/tensil-ai.png","language":"Scala","funding_links":[],"categories":["Scala","Lighter and Deployment Frameworks","Applications"],"sub_categories":[],"readme":"Tensil\n==========================\n\n[![Build status](https://badge.buildkite.com/11c53cfb0931de5a89dfece9634fe3a5f5cefc9525e1162e1a.svg?branch=main)](https://buildkite.com/tensil/tensil)\n\n## Tensil toolchain flow\n\n![Flow](https://s3.us-west-1.amazonaws.com/downloads.tensil.ai/doc/flow.png)\n\n## Tutorials\n\nFor in-depth end-to-end instructions check our tutorials.\n\n- [Learn how to combine Tensil and TF-Lite to run YOLO on Ultra96](https://www.tensil.ai/docs/tutorials/yolo-ultra96v2/)\n- [Learn Tensil with ResNet and PYNQ Z1](https://www.tensil.ai/docs/tutorials/resnet20-pynqz1/)\n- [Learn Tensil with ResNet and Ultra96](https://www.tensil.ai/docs/tutorials/resnet20-ultra96v2/)\n- [Learn how to build speech controlled robot with Tensil and Arty A7 - Part I](https://www.tensil.ai/docs/tutorials/speech-robot-part1/)\n- [Learn how to build speech controlled robot with Tensil and Arty A7 - Part II](https://www.tensil.ai/docs/tutorials/speech-robot-part2/)\n- [Getting Tensil to run ResNet at 300 FPS on ZCU104](https://www.tensil.ai/docs/tutorials/resnet20-zcu104/)\n\n## Documentation\n\nFor reference documentation see our [website](https://www.tensil.ai/docs/).\n\n## Setup\n\n1. Pull and run [Tensil docker container](https://hub.docker.com/r/tensilai/tensil) (see below);\n2. Download and install [Xilinx Vitis or Vivado](https://www.xilinx.com/support/download.html);\n3. Download and install [Xilinx PYNQ](http://www.pynq.io/board.html) for your FPGA development platform;\n4. Copy Tensil PYNQ driver `drivers/tcu_pynq` to `/home/xilinx/tcu_pynq` on your FPGA development platform.\n\n## Pull and run docker container\n\n```\ndocker pull tensilai/tensil\ndocker run -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/work -w /work -it tensilai/tensil bash\n```\n\n## Compile AI/ML model\n\nCompile AI/ML model (ResNet20 v2 CIFAR) for specific TCU architecture and FPGA development platform, [PYNQ Z1](https://digilent.com/shop/pynq-z1-python-productivity-for-zynq-7000-arm-fpga-soc/) in this example.\n\n#### From ONNX\n\n```\ntensil compile -a /demo/arch/pynqz1.tarch -m /demo/models/resnet20v2_cifar.onnx -o \"Identity:0\" -s true\n```\n\n#### From frozen TensorFlow graph\n\n```\ntensil compile -a /demo/arch/pynqz1.tarch -m /demo/models/resnet20v2_cifar.pb -o \"Identity\" -s true\n```\n\n#### Other ML frameworks are supported by converting to ONNX\n\n- [TensorFlow and Tflite](https://github.com/onnx/tensorflow-onnx/blob/master/README.md)\n- [Pytorch](https://pytorch.org/docs/stable/onnx.html)\n- [Other](https://onnx.ai/supported-tools.html)\n\n## Run bit accurate Tensil emulator\n\n```\ntensil emulate -m resnet20v2_cifar_onnx_pynqz1.tmodel -i /demo/models/data/resnet_input_1x32x32x8.csv\n```\n\n## Make Verilog RTL\n\nMake Verilog RTL for specific TCU architecture and FPGA development platform, [PYNQ Z1](https://digilent.com/shop/pynq-z1-python-productivity-for-zynq-7000-arm-fpga-soc/) in this example.\n\n```\ntensil rtl -a /demo/arch/pynqz1.tarch -s true\n```\n\n## Create Vivado design\n\nCreate Vivado design for specific FPGA development platform. We include detailed steps in our [PYNQ Z1 tutorial](https://www.tensil.ai/docs/tutorials/resnet20-pynqz1/). If you get stuck, we can help! Please reach out to us at [contact@tensil.ai](mailto:contact@tensil.ai) or in [Discord](https://discord.gg/TSw34H3PXr).\n\n![PYNQ Z1 design](https://s3.us-west-1.amazonaws.com/downloads.tensil.ai/doc/pynqz1_design.png)\n\n## Run AI/ML model on FPGA\n\nUse PYNQ and Jupyter notebooks to run AI/ML model on FPGA. (See in `notebooks`.)\n\n![Resnet on PYNQ](https://s3.us-west-1.amazonaws.com/downloads.tensil.ai/doc/resnet20_on_pynq.png)\n\n## For maintainers\n\n### Additional setup steps\n\n1. Download and install [OpenJDK 11 from Azul](https://www.azul.com/downloads/?version=java-11-lts\u0026package=jdk);\n2. Download and install [Verilator](https://verilator.org/guide/latest/install.html);\n3. Download test models:\n\n```\nwget https://github.com/tensil-ai/tensil-models/archive/main.tar.gz\ntar xf main.tar.gz\nmv tensil-models-main models\nrm main.tar.gz\n```\n\n### Run RTL tool from source code\n\n```\n./mill rtl.run -a ./arch/pynqz1.tarch -s true\n```\n\n### Run compiler from source code\n\n```\n./mill compiler.run -a ./arch/pynqz1.tarch -m ./models/resnet20v2_cifar.onnx -o \"Identity:0\" -s true\n```\n\n### Run emulator from source code\n\n```\n./mill emulator.run -m resnet20v2_cifar_onnx_pynqz1.tmodel -i ./models/data/resnet_input_1x32x32x8.csv\n```\n\n### Run full test suite\n\n```\n./mill __.test -l org.scalatest.tags.Slow\n```\n\nTo run a single RTL test in, for example, the Accumulator module, and also output a VCD file, do:\n\n```\n./mill rtl.test.testOnly tensil.tcu.AccumulatorSpec -- -DwriteVcd=true -z \"should accumulate values\"\n```\n\n### View VCD files\n\nTo view the latest VCD file generated:\n\n```\n./scripts/gtkwave/display-latest-vcd.py\n```\n\nTo view a specific VCD file:\n\n```\n./scripts/gtkwave/display-vcd.sh \u003cvcd_file\u003e\n```\n\n### Build and push AWS ECS image for web compiler (Tensil Explorer)\n\n```\ndocker build -f docker/web/Dockerfile -t tensil-web-compiler .\naws ecr get-login-password | docker login --username AWS --password-stdin \u003cACCOUNT ID\u003e.dkr.ecr.\u003cREGION\u003e.amazonaws.com\ndocker tag tensil-web-compiler \u003cACCOUNT ID\u003e.dkr.ecr.\u003cREGION\u003e.amazonaws.com/tf2rtl-web-compiler\ndocker push \u003cACCOUNT ID\u003e.dkr.ecr.\u003cREGION\u003e.amazonaws.com/tf2rtl-web-compiler\n```\n\n## Get help\n\n- Say hello and ask a question on our [Discord](https://discord.gg/TSw34H3PXr)\n- Email us at [support@tensil.ai](mailto:support@tensil.ai)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensil-ai%2Ftensil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensil-ai%2Ftensil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensil-ai%2Ftensil/lists"}