Skip to content

[3/10] Moved TIR generation from Python to C++ for CMSIS-NN - #8951

Merged
areusch merged 3 commits into
apache:mainfrom
asparkhi:tirincpp
Sep 19, 2021
Merged

[3/10] Moved TIR generation from Python to C++ for CMSIS-NN#8951
areusch merged 3 commits into
apache:mainfrom
asparkhi:tirincpp

Conversation

@asparkhi

Copy link
Copy Markdown
Contributor

This PR moves changes from Python to C++ for Softmax via CMSIS-NN. This is a follow up PR to #8833.

It is step 2a in #8646.

@asparkhiasparkhi changed the title [CMSIS-NN] Moved TIR generation from Python to C++[3/10] Moved TIR generation from Python to C++ for CMSIS-NNSep 7, 2021

@MousiusMousius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This approach feels a lot cleaner overall @ashutosh-arm, could you update the PR title to 2a ? 😸

Comment threadpython/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc

@manupakmanupak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! I did a pass, see if you agree.

Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadpython/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated
Comment threadpython/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated

@asparkhiasparkhi left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the quick reviews @Mousius and @manupa-arm .

Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadpython/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated

@manupakmanupak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another round of comments! :)

Sorry for doing this piecemeal.

Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated
Change-Id: I2cdcd7a90aa4749877c48bc6c7c4d27328856860
Change-Id: Ie41b695fa06468cd3b0bfe428c360e98438a9180

@MousiusMousius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One minor point but happy to see it in the follow up.

Comment threadsrc/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc

@manupakmanupak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@areuschareusch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks @ashutosh-arm for the PR, just a couple questions

Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/relay_to_tir.cc

Map<String, ObjectRef> dict_attrs;
dict_attrs.Set("global_symbol", func_name_);
dict_attrs.Set("tir.noalias", Bool(true));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i thiiink this is a no-op on c target, but can you explain what you're going for here?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

What is tir.noalias used for? I am not sure. It is being used everywhere in the tests, so I thought it must be something that is being used in TIR passes.

Comment threadsrc/relay/backend/contrib/cmsisnn/tir_to_runtime.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/tir_to_runtime.cc
Comment threadsrc/relay/backend/contrib/cmsisnn/tir_to_runtime.cc
@Mousius

Copy link
Copy Markdown
Member

Hi @areusch, I acknowledge your questions but do we need to block the PR on them rather than moving forwards with the integration? I'm sure @ashutosh-arm will honourably follow up in a future PR in this series.

@areuschareusch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Mousius @ashutosh-arm ok given this is part of a larger set of PRs belonging to an RFC in-flight, let us merge this and add a follow-up.

@areusch
areusch merged commit 44b644c into apache:mainSep 19, 2021
AndrewZhaoLuo added a commit to AndrewZhaoLuo/tvm that referenced this pull request Sep 20, 2021
* main:
[3/10] Moved TIR generation from Python to C++ for CMSIS-NN (apache#8951)
Support match pvar with dtype constraint (apache#9016)
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
)
* [CMSIS-NN] Moved TIR Generation to C++
* Deleted self import for cmsisnn
Change-Id: I2cdcd7a90aa4749877c48bc6c7c4d27328856860
* Reusing CodeGenC VistiExpr for softmax
Change-Id: Ie41b695fa06468cd3b0bfe428c360e98438a9180
@asparkhi
asparkhi deleted the tirincpp branch December 7, 2021 10:09
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
)
* [CMSIS-NN] Moved TIR Generation to C++
* Deleted self import for cmsisnn
Change-Id: I2cdcd7a90aa4749877c48bc6c7c4d27328856860
* Reusing CodeGenC VistiExpr for softmax
Change-Id: Ie41b695fa06468cd3b0bfe428c360e98438a9180
Sign up for freeto 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

@asparkhi@Mousius@areusch@manupak