Skip to content

[Feat] Hardware Generation For Differentiable Logic Networks (ADLS Group 1) #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 28, 2025

Conversation

samuelpswang
Copy link
Contributor

@samuelpswang samuelpswang commented Mar 25, 2025

Description

Recently proposed Deep Differentiable Logic Gate Networks (DiffLogic) provide state of the art performance while keeping the network size small and the hardware requirements low. This pull request implements the key components of the logic gate network in hardware for Mase.

Key Contributions

  • Implemented PyTorch-custom-module-mapped parameterised hardware and their test-benches, namely fixed_difflogic_logic.sv (mapping to LogicLayer module) and fixed_difflogic_groupsum.sv (mapping to GroupSum module).
  • Connected hardware to Mase hardware emit passes for automatic hardware generation and test-bench generation, including modifications to emit_verilog_top_transform_pass and emit_cocotb_transform_pass.

Usage

  • Detailed information, including an introduction on DiffLogic, a tutorial on generating hardware for a MNIST DiffLogic model, and modification information for each function, can be found in src/tutorials/difflogic/demo.ipynb.

References

@samuelpswang samuelpswang changed the title ADLS Group 1: Hardware Generation Capability For Differentiable Logic Networks [Feat] Hardware Generation For Differentiable Logic Networks (ADLS Group 1) Mar 25, 2025
jianyicheng
jianyicheng previously approved these changes Apr 20, 2025
Copy link
Collaborator

@jianyicheng jianyicheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to MASE! This is excellent work!

I think your PR is technically strong, and only require minor changes to be merged into the main branch. Please see my detailed comments.

Makefile Outdated
-v /$(USER_PREFIX)/$(shell whoami)/.gitconfig:/root/.gitconfig \
-v /$(USER_PREFIX)/$(shell whoami)/.ssh:/root/.ssh \
-v /$(USER_PREFIX)/$(shell whoami)/.mase:/root/.mase:z \
-v $(shell pwd):/workspace:z \
-v $(shell pwd):/workspace/mase-DLG:z \
-v $(shell pwd)/../traceable-difflogic:/workspace/traceable-difflogic:z \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is specific to your machine, right? You can make this general in two ways:

  1. write a script to clone from an open-source repo (with a specific commit) at the installation
  2. include them as submodules

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed for now (8360889), those were configurations of mappings from local directories into the Docker container left in by accident. The used repo (difflogic) was not a direct dependancy of the features we developed, so I don't think we have to make it as a submodule, right?

@jianyicheng jianyicheng merged commit ac5d357 into DeepWok:main Apr 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants