-
Notifications
You must be signed in to change notification settings - Fork 25
[Docs] Add automatic operation documentation generation with PyTorch-style structure #3039
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
base: main
Are you sure you want to change the base?
[Docs] Add automatic operation documentation generation with PyTorch-style structure #3039
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samiyadev786 thanks for your contribution! We'll review it asap! :))
@chandrasekaranpradeep, can you do an initial overview of the change? Have in mind that operation documentation should be generated based on existing ops + automatically discover when new are added and generate docs based on them as well. I.e., referncing this and similar files:
- tenstorrent/tt-forge-fe/forge/forge/op/*
Sure Nikola will review it |
|
@chandrasekaranpradeep Please review this PR. |
I saw doc generation implementation changes from ttir to forge operation. So waiting for you to complete. will review this PR within today or tomorrow |
@chandrasekaranpradeep Thank you! The implementation is already complete on my end. Please feel free to review the PR when you’re available. |
Summary
This PR implements automatic operation discovery and documentation generation from
forge/forge/op/*.pyfiles, addressing the requirement for automatic discovery of operations similar to Doxygen/PyTorch documentation style.Changes
🎯 Core Implementation
Automatic Operation Discovery (
scripts/discover_operations.py)forge/forge/op/*.pyfilesEnhanced Documentation Generator (
scripts/generate_ops_docs.py)ops_data.pyonly if automatic discovery fails📝 Generated Documentation
Operation Documentation Pages
forge.op.*naming conventionIndex Page (
docs/src/operations.md)Features
✅ Automatic Discovery: Operations are automatically discovered from Python source files
✅ No Manual Entry Required: Simply define operations with proper docstrings in
forge/forge/op/*.py✅ Accurate Signatures: Uses actual Python function signatures from source code
✅ Better Formatting: Cleaner parameter and return descriptions
✅ Category Inference: Automatically categorizes operations based on file location
✅ Edge Case Handling: Handles missing/incorrect docstrings gracefully
✅ PyTorch-Style Structure: Matches PyTorch documentation format with root page and individual pages
How It Works
Discovery Phase (
discover_operations.py):forge/forge/op/directoryeltwise_unary.py→ "Elementwise Operations")Conversion Phase (
generate_ops_docs.py):Generation Phase (
generate_ops_docs.py):Usage
To regenerate documentation after adding new operations:
New operations are automatically discovered if they:
forge/forge/op/*.pyfilesDocumentation Structure
Index Page (
operations.md)Individual Operation Pages
Each page includes:
Current Coverage
Automatically discovered 78 operations from the codebase, including:
Testing
This implementation provides:
forge/forge/op/*Related Issue
Closed: #59