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

[TIR] Add type hint for TIR #9432

Merged
merged 32 commits into from
Nov 9, 2021
Merged

[TIR] Add type hint for TIR #9432

merged 32 commits into from
Nov 9, 2021

Conversation

shingjan
Copy link

@shingjan shingjan commented Nov 2, 2021

This PR intends to add type hinting and enable auto-completion for TIR and namespace tvm.script.tir as T as a follow-up PR for this.

Co-authored-by: Zihao Ye <zihaoye.cs@gmail.com>

cc: @vinx13 @junrushao1994

@shingjan shingjan requested a review from junrushao November 2, 2021 20:45
@shingjan shingjan changed the title [TIR][WIP] Add type hint for TIR [WIP][TIR] Add type hint for TIR Nov 2, 2021
@shingjan shingjan changed the title [WIP][TIR] Add type hint for TIR [TIR] Add type hint for TIR Nov 2, 2021
@shingjan shingjan requested a review from vinx13 November 2, 2021 23:25
@vinx13
Copy link
Member

vinx13 commented Nov 2, 2021

We will need a few test cases that cover various TIR elements (block related: T.block, T.match_buffer, T.alloc_buffer, T.block_attr, loop related: T.grid, T.serial, T.thread_binding, etc). You can find good examples of TIR scripts written for previous test cases. Please also add script to run the tests to https://github.com/apache/tvm/blob/main/tests/scripts/task_mypy.sh and make sure it can pass the tests

@shingjan shingjan requested a review from vinx13 November 3, 2021 22:55
Copy link
Member

@vinx13 vinx13 left a comment

Choose a reason for hiding this comment

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

Would be great to also run pylint over the test file to see the TIR script can pass pylint after adding these stubs. There are also some issues on CI

@shingjan shingjan requested a review from vinx13 November 4, 2021 21:15
Copy link
Member

@vinx13 vinx13 left a comment

Choose a reason for hiding this comment

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

would be great to also add test commands to pylint.sh

@shingjan shingjan requested a review from vinx13 November 8, 2021 20:54
@shingjan shingjan requested a review from vinx13 November 8, 2021 22:54
@junrushao
Copy link
Member

Quick question: do we plan to add docstring in this PR?

@junrushao junrushao merged commit 00b0a81 into apache:main Nov 9, 2021
AndrewZhaoLuo added a commit to AndrewZhaoLuo/tvm that referenced this pull request Nov 12, 2021
* main: (119 commits)
  [Topi][Op][PyTorch][Vitas] Fix inconsistent kernel layout conventions for conv2d_transpose (apache#9336)
  Fix repository URL in ubuntu_install_rocm.sh (apache#9425)
  Add LLVM-13 installation to Docker setup (apache#9498)
  [Relay] Use target_host determined at Relay level instead of recalculating it (apache#9499)
  Arm(R) Ethos(TM)-U NPU BinaryElementwise operators support (apache#9442)
  [COMMUNITY] Junru's and Wuwei's PGP key for ASF release (apache#9488)
  Add default for split op (apache#9489)
  [HOTFIX][TARGET] Change LOG in compilation config to DLOG (apache#9486)
  Fixed some warnings about lambda's closures that are bigger than necessary (apache#9481)
  [Support] Add libinfo into the runtime build (apache#9310)
  Change Call with TIRCallAttrs to call_lowered op (apache#9312)
  [ETHOSN] Streamline Ethos(TM)-N cross-compile rpc usage (apache#9477)
  [CMSIS-NN] Assert correct amount of CMSIS-NN artifacts in MLF (apache#9480)
  [MicroTVM][PyTest] Explicitly skip MicroTVM unittests. (apache#9335)
  [microNPU] Replace ICHECK with diagnostic context in type inference (apache#9470)
  Better host handling in CompilationConfig & debug printing (apache#9460)
  [AOT][Tests] Use pre-built libraries in Reference System tests (apache#9271)
  [TIR] Add type hint for TIR  (apache#9432)
  [TVMC] Add test for quantized pytorch model (apache#9467)
  [CMSIS-NN] Convert CMSIS-NN to use Target Hooks (apache#9397)
  ...
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
* add init

* get rid of span

* afs header

* update scope_handler

* rm tir/__init__.pyi

* fix linting

* fix lint

* new test case

* add axis module

* address comments

* redefine ty types

* lint

* address comments

* address comments

* fix ci

* add test cases

* fix CI

* address comments

* add types

* mypy --strict

* comments

* update test comments

* linting fix

* address comments

* add pylint for tir type check

* address comments

* move doc string

* comments

* getter setter

* add PrimExpr, IterVar and Var

* add sequence

* change for handle
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
* add init

* get rid of span

* afs header

* update scope_handler

* rm tir/__init__.pyi

* fix linting

* fix lint

* new test case

* add axis module

* address comments

* redefine ty types

* lint

* address comments

* address comments

* fix ci

* add test cases

* fix CI

* address comments

* add types

* mypy --strict

* comments

* update test comments

* linting fix

* address comments

* add pylint for tir type check

* address comments

* move doc string

* comments

* getter setter

* add PrimExpr, IterVar and Var

* add sequence

* change for handle
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* add init

* get rid of span

* afs header

* update scope_handler

* rm tir/__init__.pyi

* fix linting

* fix lint

* new test case

* add axis module

* address comments

* redefine ty types

* lint

* address comments

* address comments

* fix ci

* add test cases

* fix CI

* address comments

* add types

* mypy --strict

* comments

* update test comments

* linting fix

* address comments

* add pylint for tir type check

* address comments

* move doc string

* comments

* getter setter

* add PrimExpr, IterVar and Var

* add sequence

* change for handle
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* add init

* get rid of span

* afs header

* update scope_handler

* rm tir/__init__.pyi

* fix linting

* fix lint

* new test case

* add axis module

* address comments

* redefine ty types

* lint

* address comments

* address comments

* fix ci

* add test cases

* fix CI

* address comments

* add types

* mypy --strict

* comments

* update test comments

* linting fix

* address comments

* add pylint for tir type check

* address comments

* move doc string

* comments

* getter setter

* add PrimExpr, IterVar and Var

* add sequence

* change for handle
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* add init

* get rid of span

* afs header

* update scope_handler

* rm tir/__init__.pyi

* fix linting

* fix lint

* new test case

* add axis module

* address comments

* redefine ty types

* lint

* address comments

* address comments

* fix ci

* add test cases

* fix CI

* address comments

* add types

* mypy --strict

* comments

* update test comments

* linting fix

* address comments

* add pylint for tir type check

* address comments

* move doc string

* comments

* getter setter

* add PrimExpr, IterVar and Var

* add sequence

* change for handle
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.

3 participants