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

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

Merged
merged 3 commits into from
Sep 19, 2021

Conversation

ashutosh-arm
Copy link
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.

@ashutosh-arm ashutosh-arm changed the title [CMSIS-NN] Moved TIR generation from Python to C++ [3/10] Moved TIR generation from Python to C++ for CMSIS-NN Sep 7, 2021
Copy link
Member

@Mousius Mousius left a comment

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 ? 😸

python/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@manupak manupak 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 the PR! I did a pass, see if you agree.

src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
Copy link
Contributor Author

@ashutosh-arm ashutosh-arm 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 the quick reviews @Mousius and @manupa-arm .

src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/cmsisnn/codegen.py Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@manupak manupak left a comment

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.

src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/cmsisnn/codegen_cmsisnn.cc Outdated Show resolved Hide resolved
Change-Id: I2cdcd7a90aa4749877c48bc6c7c4d27328856860
Change-Id: Ie41b695fa06468cd3b0bfe428c360e98438a9180
Copy link
Member

@Mousius Mousius left a comment

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.

Copy link
Contributor

@manupak manupak left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@areusch areusch left a comment

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


Map<String, ObjectRef> dict_attrs;
dict_attrs.Set("global_symbol", func_name_);
dict_attrs.Set("tir.noalias", Bool(true));
Copy link
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
Contributor Author

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.

@Mousius
Copy link
Member

Mousius commented Sep 17, 2021

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.

Copy link
Contributor

@areusch areusch left a comment

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:main Sep 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
@ashutosh-arm ashutosh-arm 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 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