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

Documentation Refactor #9203

Merged
merged 3 commits into from
Oct 9, 2021
Merged

Documentation Refactor #9203

merged 3 commits into from
Oct 9, 2021

Conversation

hogepodge
Copy link
Contributor

@hogepodge hogepodge commented Oct 5, 2021

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: #8987

Stage 1 of the documentation refactor reorganizes the docs structure,
moving files (without content changes) and adding new scaffolding to
generate the proper document tree.

It does not address naming, style, content, links, or other existing
content in documents that were moved. State 2 will address fixing these
issues with existing content.

Major changes include but are not limited to:

  • Dividing the existing tutorials into two sections:
    • Tutorials
    • How Tos
  • Moving all of the existing tutorials out of the /tutorial
    directory and into the more general /gallery directory.
  • Breaking up how-tos into individual sections for more
    flexibility and more consistent rendering.
  • Moving content into new classifications:
    • /docs/arch for architecture guides
    • /docs/reference for API guides and other reference material
    • /docs/topic for topic specific guides such as microTVM and VTA
    • Restructuring /docs/dev
  • Adding a table of contents to the doc index
  • Adding instructions on how to install using third-party tlcpack

Stage 2 of the documentation refactor fixes naming and links
in the documentation to be consistent with the overall structure.

Major changes include:

  • an update to how to contribute to docs.
  • several updated index pages with title changes to match
    the organization style and bring consistency to the sections
  • expanded descriptions of some page collections
  • fixed links

Stage 3 of the documentation refactor adjusts CI for the new structure.
The CI build script takes into account the new gallery format. It
also prevents deleting existing documents, and takes advantage of the
_staging and _build directories to clean out previous builds

@hogepodge
Copy link
Contributor Author

Addressed missing links and references in documentation.

@tqchen
Copy link
Member

tqchen commented Oct 6, 2021

Thanks Chris, the overall structure looks good and thanks for the effort in preserving the contribution history.
Looks like we still need to update the CI script in order to get the things to unblock the ci

See related lines here

Likely we need to update these to the new folder locations, and in the case of ci_logs, update them to match the new location of auto_scheduler(should be gallery/how_to/tune_with_autoscheduler?). Please let me know if you need additonal help.

@tqchen
Copy link
Member

tqchen commented Oct 6, 2021

BTW, I wanted to acknowledge and thank you for all the effort you have put into the documentation. Having strong user and developer documentation is critical to TVM’s mission to provide unity to the ML Acceleration ecosystem,and the entire community stands to benefit from better documentation.

The overall direction of documentation changes looks great and layed out clearly in the RFC. Sorry for the final requests but these are the final steps toward closing the loop of our documentation refactor effort. Let's work together to land this and please let us know what we can do to help.

@tmoreau89
Copy link
Contributor

Thank you @hogepodge for this colossal PR and equally colossal effort! These changes will have a hugely positive impact on improving TVM's approachability for the community at large. Thanks for moving the needle in the right direction

@denise-k
Copy link
Collaborator

denise-k commented Oct 6, 2021

Huge, huge thanks to @hogepodge for spending so much time and energy to make our documentation shine! ✨

@hogepodge
Copy link
Contributor Author

Thanks Chris, the overall structure looks good and thanks for the effort in preserving the contribution history. Looks like we still need to update the CI script in order to get the things to unblock the ci

See related lines here

Likely we need to update these to the new folder locations, and in the case of ci_logs, update them to match the new location of auto_scheduler(should be gallery/how_to/tune_with_autoscheduler?). Please let me know if you need additonal help.

Thanks! I've updated the scripts. A little while ago @Lunderberg changed the build structure to use both a _staging and a _build directory. I've updated the scripts to see the new locations and to only remove those directories (as the main tree is not being written in to any more).

@tqchen
Copy link
Member

tqchen commented Oct 6, 2021

The remaining error seems was due to tvm not being available in some of the how to example executions. It might be helpful to run the following command to quickly check a specific tutorial to debug

TVM_TUTORIAL_EXEC_PATTERN=/path/to/specific_file\.py make html

It could be related to the staging setup, the way we setup env variables (cc @Lunderberg to see if you have any ideas).

@hogepodge
Copy link
Contributor Author

Thanks for the suggestion on that. Whether I'm building the entire document set, or just the individual how_tos that are failing in CI, I'm unable to reproduce the failures locally.

@hogepodge
Copy link
Contributor Author

I just pushed a new change to see if we can reproduce the same failures in CI.

@Lunderberg
Copy link
Contributor

Hmm. It looks like it's having trouble finding the libtvm.so file, but it finds it correctly during the initial import. From a quick 10-minute code dive, it looks like sphinx_gallery calls memory_profiler.memory_usage. This starts a subprocess, which doesn't inherit the sys.path updates made in our conf.py.

Can you try adding os.environ['PYTHONPATH'] = os.pathsep.join(sys.path) to the conf.py, just after the modifications to sys.path? The environment variable should be passed to subprocesses, where the value of sys.path is not.

@manupak
Copy link
Contributor

manupak commented Oct 6, 2021

@hogepodge
Copy link
Contributor Author

@manupa-arm looks like the same issue

@hogepodge
Copy link
Contributor Author

@Lunderberg trying that out, it makes sense. In my local dev environment I actually install TVM to a user python package, which may explain why I'm not seeing the local failures.

@hogepodge
Copy link
Contributor Author

Fixed linting error in conf.py

@hogepodge
Copy link
Contributor Author

@Lunderberg I made the suggested changed, but that didn't improve it. After digging into the Sphinx Gallery code a bit more, I don't think the memory_usage code is being called. It's disabled by default. Seems like this is going to need some deeper digging. I don't see anything right away that would explain these failures.

@manupak
Copy link
Contributor

manupak commented Oct 7, 2021

@hogepodge , I've just experienced another failure. I remember we had an issue which got resolved by @mbs-octoml PR, IIRC. Do we need to re-open that or create a new one as I dont immediately see this issue is relevant to the failure.

@mbs-octoml
Copy link
Contributor

mbs-octoml commented Oct 8, 2021 via email

@hogepodge
Copy link
Contributor Author

I'm not convinced this is going to fix the underlying problem, but we'll see where we are in a few hours.

@mbs-octoml
Copy link
Contributor

mbs-octoml commented Oct 8, 2021 via email

@hogepodge
Copy link
Contributor Author

The number of failures for this PR was more widely spread across a number of tutorials, and manifested as not being able import python modules and associated libraries. It seems like sphinx-gallery is brittle and has a global python state that is easily corrupted, and I'm wondering if my reordering of the how-tos is causing failures based on those changes. Your patch fixed an instance of that, but my worry is that there are more problems like that lurking. Hopefully I'm wrong about that though.

areusch
areusch previously requested changes Oct 8, 2021
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.

marking request changes for the config.cmake change--i think i see your issue.

cmake/config.cmake Outdated Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
cmake/config.cmake Outdated Show resolved Hide resolved
@tqchen
Copy link
Member

tqchen commented Oct 8, 2021

OK, I find sometime to dig a bit deeper into the errors. The problem comes from the way we get tvm_path https://github.com/apache/tvm/blob/main/docs/conf.py#L52 which is relative instead of absolute path.

Sphinx gallery runs the tutorial file from cwd of the file(e.g. it will run on gallery/how_to/compile_models/) where the environment variable of tvm_path set to ../../python produces a mismatch.

A possible way to fix is to add tvm_path = os.path.abs_path(tvm_path) to https://github.com/apache/tvm/blob/main/docs/conf.py#L54(and I confirm it works)

But given @Lunderberg you wrote this part and left a comment about relative path, would be great to confirm

@Lunderberg
Copy link
Contributor

The issue was that ExplicitOrder requires relative paths, and tvm_path is currently used to generate the arguments for ExplcitOrder. (I had to verify to remind myself why. The implementation of ExplicitOrder expects the string representation of the paths to be an exact match for the path being used. It gets passed the path relative to the source directory, and so that's what we need to give it.) If I remember correctly, I think the failure mode was generating URLs that included the full path to the file, including /home/Lunderberg.

The path being added to sys.path doesn't need to be a relative path, so we could change tvm_path to tvm_path.resolve() on those two lines.

@hogepodge
Copy link
Contributor Author

@Lunderberg I just came to the same conclusion, and addressed it by making a tvm_path_rel variable to use in the Sphinx Gallery ExplicitOrder.

Chris Hoge added 3 commits October 9, 2021 19:00
RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: #8987

Stage 1 of the documentation refactor reorganizes the docs structure,
moving files (without content changes) and adding new scaffolding to
generate the proper document tree.

It does not address naming, style, content, links, or other existing
content in documents that were moved. State 2 will address fixing these
issues with existing content.

Major changes include but are not limited to:

* Dividing the existing tutorials into two sections:
  * Tutorials
  * How Tos
* Moving all of the existing tutorials out of the `/tutorial`
  directory and into the more general `/gallery` directory.
* Breaking up how-tos into individual sections for more
  flexibility and more consistent rendering.
* Moving content into new classifications:
  * `/docs/arch` for architecture guides
  * `/docs/reference` for API guides and other reference material
  * `/docs/topic` for topic specific guides such as microTVM and VTA
  * Restructuring `/docs/dev`
* Adding a table of contents to the doc index
* Adding instructions on how to install using third-party tlcpack
RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: #8987

Stage 2 of the documentation refactor fixes naming and links
in the documentation to be consistent with the overall structure.

Major changes include:

* an update to how to contribute to docs.
* several updated index pages with title changes to match
  the organization style and bring consistency to the sections
* expanded descriptions of some page collections
* fixed links
RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: #8987

Stage 3 of the documentation refactor adjusts CI for the new structure.
The CI build script takes into account the new gallery format. It
also prevents deleting existing documents, and takes advantage of the
`_staging` and `_build` directories to clean out previous builds.
@tqchen tqchen dismissed areusch’s stale review October 9, 2021 23:50

The requests are fulfilled

@tqchen
Copy link
Member

tqchen commented Oct 9, 2021

Thanks @hogepodge @Lunderberg @areusch . All the comments are resolved.

I am merging this in given that this is a major refactor could conflict/block future changes and would benefit from prioritization. Let us send followup PRs for future tweaks.

@tqchen tqchen merged commit 44549e6 into apache:main Oct 9, 2021
masahi pushed a commit to Laurawly/tvm-1 that referenced this pull request Oct 14, 2021
* Documentation Refactor - Stage 1

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 1 of the documentation refactor reorganizes the docs structure,
moving files (without content changes) and adding new scaffolding to
generate the proper document tree.

It does not address naming, style, content, links, or other existing
content in documents that were moved. State 2 will address fixing these
issues with existing content.

Major changes include but are not limited to:

* Dividing the existing tutorials into two sections:
  * Tutorials
  * How Tos
* Moving all of the existing tutorials out of the `/tutorial`
  directory and into the more general `/gallery` directory.
* Breaking up how-tos into individual sections for more
  flexibility and more consistent rendering.
* Moving content into new classifications:
  * `/docs/arch` for architecture guides
  * `/docs/reference` for API guides and other reference material
  * `/docs/topic` for topic specific guides such as microTVM and VTA
  * Restructuring `/docs/dev`
* Adding a table of contents to the doc index
* Adding instructions on how to install using third-party tlcpack

* Documentation Refactor - Stage 2

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 2 of the documentation refactor fixes naming and links
in the documentation to be consistent with the overall structure.

Major changes include:

* an update to how to contribute to docs.
* several updated index pages with title changes to match
  the organization style and bring consistency to the sections
* expanded descriptions of some page collections
* fixed links

* Documentation Refactor - Stage 3

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 3 of the documentation refactor adjusts CI for the new structure.
The CI build script takes into account the new gallery format. It
also prevents deleting existing documents, and takes advantage of the
`_staging` and `_build` directories to clean out previous builds.
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* Documentation Refactor - Stage 1

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 1 of the documentation refactor reorganizes the docs structure,
moving files (without content changes) and adding new scaffolding to
generate the proper document tree.

It does not address naming, style, content, links, or other existing
content in documents that were moved. State 2 will address fixing these
issues with existing content.

Major changes include but are not limited to:

* Dividing the existing tutorials into two sections:
  * Tutorials
  * How Tos
* Moving all of the existing tutorials out of the `/tutorial`
  directory and into the more general `/gallery` directory.
* Breaking up how-tos into individual sections for more
  flexibility and more consistent rendering.
* Moving content into new classifications:
  * `/docs/arch` for architecture guides
  * `/docs/reference` for API guides and other reference material
  * `/docs/topic` for topic specific guides such as microTVM and VTA
  * Restructuring `/docs/dev`
* Adding a table of contents to the doc index
* Adding instructions on how to install using third-party tlcpack

* Documentation Refactor - Stage 2

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 2 of the documentation refactor fixes naming and links
in the documentation to be consistent with the overall structure.

Major changes include:

* an update to how to contribute to docs.
* several updated index pages with title changes to match
  the organization style and bring consistency to the sections
* expanded descriptions of some page collections
* fixed links

* Documentation Refactor - Stage 3

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 3 of the documentation refactor adjusts CI for the new structure.
The CI build script takes into account the new gallery format. It
also prevents deleting existing documents, and takes advantage of the
`_staging` and `_build` directories to clean out previous builds.
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* Documentation Refactor - Stage 1

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 1 of the documentation refactor reorganizes the docs structure,
moving files (without content changes) and adding new scaffolding to
generate the proper document tree.

It does not address naming, style, content, links, or other existing
content in documents that were moved. State 2 will address fixing these
issues with existing content.

Major changes include but are not limited to:

* Dividing the existing tutorials into two sections:
  * Tutorials
  * How Tos
* Moving all of the existing tutorials out of the `/tutorial`
  directory and into the more general `/gallery` directory.
* Breaking up how-tos into individual sections for more
  flexibility and more consistent rendering.
* Moving content into new classifications:
  * `/docs/arch` for architecture guides
  * `/docs/reference` for API guides and other reference material
  * `/docs/topic` for topic specific guides such as microTVM and VTA
  * Restructuring `/docs/dev`
* Adding a table of contents to the doc index
* Adding instructions on how to install using third-party tlcpack

* Documentation Refactor - Stage 2

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 2 of the documentation refactor fixes naming and links
in the documentation to be consistent with the overall structure.

Major changes include:

* an update to how to contribute to docs.
* several updated index pages with title changes to match
  the organization style and bring consistency to the sections
* expanded descriptions of some page collections
* fixed links

* Documentation Refactor - Stage 3

RFC: https://github.com/apache/tvm-rfcs/blob/main/rfcs/0027-formalize-documentation-organization.md
Tracking Issue: apache#8987

Stage 3 of the documentation refactor adjusts CI for the new structure.
The CI build script takes into account the new gallery format. It
also prevents deleting existing documents, and takes advantage of the
`_staging` and `_build` directories to clean out previous builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants