Skip to content
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

[Relay] softmax, max_pool2d, conv2d, fix 4D memory connections (WIP) #289

Merged
merged 96 commits into from
Dec 20, 2020

Conversation

cgyurgyik
Copy link
Collaborator

@cgyurgyik cgyurgyik commented Dec 2, 2020

Overview

  • nn.max_pool2d implementation with test.
  • nn.conv2d implementation with test.
  • Fixes to 4D to actually hook in all the appropriate addresses. This includes a runt test, since I missed this bug in an earlier PR.
  • Fixes [fud] Add named components for Dahlia lowering to fud, FuTIL passes. #274 .
  • Improves modularity. Everything that deals with Relay function call -> Dahlia function -> FuTIL lowering is done in a single file dahlia_lowering.py now.
  • Allows for lowering of VGG Net from Relay IR to FuTIL, i.e. python3 example.py vgg_net. This is by no means fast; lowering MLP Net is faster given the smaller number of instructions. I've also verified the FuTIL output lowers to Verilog in both cases.

TODOs Left

  • Need to improve nn.softmax to avoid integer underflow for fixed point. Currently, this includes a std_exp operator, however, this operator rounds to the nearest integer because of the following:
            /* verilator lint_off REALCVT */
            out = 2.718281 ** exponent;

Ideally, we'd like that not to occur. I mention this in #299 , though I'm not sure I'll have time to work on this more before Tuesday. I believe this will be easy to do once we can support generalized functions with invoke.

@cgyurgyik cgyurgyik changed the title [Relay] softmax, max_pool2d, fix 4D memory connections (WIP) [Relay] softmax, max_pool2d, conv2d, fix 4D memory connections (WIP) Dec 10, 2020
@cgyurgyik cgyurgyik marked this pull request as ready for review December 11, 2020 01:13
@cgyurgyik
Copy link
Collaborator Author

The TODOs left for VGG Net lowering are discussed explicitly in #276. This includes updating nn.softmax to use invoke and adding the correct types rather than defaulting to unsigned. Currently, VGG Net lowers to Verilog. While not a measure of correctness or completeness, it is progress.

primitives/std.lib Outdated Show resolved Hide resolved
primitives/std.lib Outdated Show resolved Hide resolved
@cgyurgyik
Copy link
Collaborator Author

@rachitnigam I've removed the unnecessary additions to the primitives library and marked softmax as unimplemented for now. This CL is already pretty large, so I can finish the rest in a follow-up CL.

@rachitnigam
Copy link
Contributor

Are there any tests you want to enable by default in the top-level runt.toml?

@cgyurgyik
Copy link
Collaborator Author

Are there any tests you want to enable by default in the top-level runt.toml?

At this time, no. Perhaps after the dat rehaul is finished, or I find that more people are committing. Thanks for the review.

@cgyurgyik cgyurgyik merged commit 53b145b into master Dec 20, 2020
@cgyurgyik cgyurgyik deleted the relay branch December 20, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Relay Relay-to-FuTIL compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fud] Add named components for Dahlia lowering to fud, FuTIL passes.
2 participants