Commit Graph

12 Commits

Author SHA1 Message Date
Lite Ye 262906516a [TVMScript] Printer: add boolean operators to OperationDoc (#12518)
This PR adds boolean operators to OperationDoc. This is needed by the TIR expression printing because it has `tir::And` and `tir::Or`.

Tracking issue: #11912
2022-08-21 22:10:23 -07:00
Lite Ye cc769fdc95 [TVMScript] Printer entry point (#12462)
This PR:

- Adds an entry point for the TVMScript Unified Printer
- Adds a helper object class `RootNodeContainer` to provide an injection point for the actual printer implementation to add specialized logic on the root node to print.

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-08-20 20:41:42 -07:00
Lite Ye 1a9faeb77e [TVMScript] Printer IRDocsifier (#12396)
This PR:

- Adds IRDocsifier

This PR is in draft state because it's branched off from a pending PR #12336

Tracking issue: https://github.com/apache/tvm/issues/11912

Co-authored-by: Greg Bonik <gbonik@octoml.ai>
2022-08-16 14:06:29 -07:00
Lite Ye d33a332283 [TVMScript] Printer VarTable (#12336)
This PR:

- Adds VarTable for the new TVMScript Printer

Compared to the prototype version, this:

- Removes unnecessary public methods.
  - GetObjectName
  - GetUniqueName
- Add Frame parameter for `Define` methods. VarTable will add callback to Frame to remove variable when Frame exits.
- Changes DocFactory from `ExprDoc(ObjectPath)` to `ExprDoc()` to simplify var definition.

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-08-13 13:04:39 -07:00
Lite Ye 3cb57d20a0 [TVMScript] Printer Frame (#12366)
This PR:

- Implement Frame for the TVMScript Unified Printer

Compared to the prototype version, this:

- Removes the dependency of VarTable (SymbolTable) from Frame
- Adds a callback array to the Frame base class so that VarTable can add callback to clean variable when Frame goes out scope

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-08-11 20:22:37 -07:00
Greg Bonik f5f5a75ae9 [TVMScript] Text underlining in DocPrinter based on Doc's source_paths (#12344)
This adds an ability to print a "diagnostic marker" based on a given ObjectPath. For example, say we are printing a fragment of TIR like
```
for i in T.serial(10):
    a[i] = 5
```
and we would like bring the user's attention to the bound of the loop:
```
for i in T.serial(10):
                  ^^
    a[i] = 5
```
In this case we would give the doc printer an object path that represents this loop bound, i.e. something like `path_to_underline=ObjectPath.root().attr("extent")`

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-08-10 22:43:54 -07:00
Lite Ye 0973248858 [TVMScript] Add source_paths to Doc (#12324)
This PR:

- Add the source_paths attribute to Doc base class.
- Add the corresponding Python binding for it.

This PR is depended by multiple tasks, including the diagnostic output in DocPrinter, VarTable and IRDocisifer.

Tracking issue: https://github.com/apache/tvm/issues/11912

Co-authored-by: Greg Bonik <gbonik@octoml.ai>
2022-08-05 13:33:38 -07:00
Lite Ye 834e998618 [TVMScript] Python Expression Precedence (#12148)
This PR:

- Handle expression (operator) precedence during Python code printing (`(* 1 (+ 2 3))` prints as
`1 * (2 + 3)`)
- Addresses remaining feedback from previous PR #12112
- Reformats Python import with isort

Tracking issue: #11912
2022-07-31 23:45:44 -07:00
Junru Shao 9f16b607c8 [TVMScript] Doc Definition (#12244)
This single-file PR is automatically generated by a script that describes the Doc AST.
2022-07-30 19:58:08 -07:00
Lite Ye fcec5f4a76 [TVMScript] StmtDoc Definitions (#12111)
This PR addes:

- All StmtDoc subclasses
- Python bindings for StmtDoc

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-07-27 16:56:15 -07:00
Lite Ye 584b0f31d8 [TVMScript] ExprDoc (#12048)
This PR addes:

- All ExprDoc subclasses
- Their Python bindings
- Support of ExprDoc in PythonDocPrinter
- Unit tests for ExprDoc in PythonDocPrinter

Tracking issue: https://github.com/apache/tvm/issues/11912
2022-07-27 09:27:48 -07:00
Lite Ye 9f4bf38b57 [TVMScript] Doc Base Class & DocPrinter Scaffolding (#11971)
This PR addes:
- Doc base class
- DocPrinter base class
- PythonDocPrinter
- LiteralDoc and its support in DocPrinter

Tracking issue: #11912
2022-07-06 22:11:10 -07:00