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

Fix md files causing github pages to fail #178

Closed
ddilbazTT opened this issue Jan 9, 2025 · 2 comments
Closed

Fix md files causing github pages to fail #178

ddilbazTT opened this issue Jan 9, 2025 · 2 comments
Assignees

Comments

@ddilbazTT
Copy link
Contributor

ddilbazTT commented Jan 9, 2025

@vmilosevic has enabled tt-torch github pages to be deployed from ddilbaz/fix-pages-build-and-deployment Therefore, we can make changes to this branch and trigger a pages build which can help with debugging. This issue is related to #169

md files seem to result in "Stack level too deep" error after ~600 rows in md tables. Should adjust generate_md.py to fix this. The solution is to have multiple tables back to back with each having ~600 rows (no headers in between)

Tagging @AleksKnezevic for reference

@ddilbazTT ddilbazTT self-assigned this Jan 9, 2025
@ddilbazTT
Copy link
Contributor Author

I used kramdown to test which md files have difficulty being converted into html files, upon reading kramdown is one of the ways github pages convert md files to html. This is the ruby script I used:

require 'kramdown'
require 'fileutils'

# Directories containing the markdown files
dirs = ['docs/ops/stablehlo', 'docs/ops/ttnn']

# Loop through each directory
dirs.each do |dir|
  # Find all .md files in the current directory (recursively if needed)
  Dir.glob("#{dir}/**/*.md") do |file_path|
    begin
      # Read the contents of the Markdown file
      text = File.read(file_path)

      # Convert the Markdown text to HTML
      html = Kramdown::Document.new(text).to_html

      # You could print the HTML, or save it to a file
      # If saving to file, you can adjust the output path as needed
      output_path = file_path.sub('.md', '.html')
      File.write(output_path, html)

      puts "Successfully converted: #{file_path} -> #{output_path}"

    rescue SystemStackError => e
      # Handle the stack level too deep error specifically
      puts "Stack level too deep while processing #{file_path}: #{e.message}"
      # Optionally log the file or take additional action
      next  # Continue processing the next file

    rescue StandardError => e
      # Handle any other errors (e.g., file read errors, conversion errors, etc.)
      puts "Failed to read or convert #{file_path}: #{e.message}"
      next  # Continue processing the next file
    end
  end
end

Based on this, there were 4 html files that caused "stack level too deep" errors. I tested removing a significant portion of one these files and that was able to generate html files. These are the 4 files:

  • docs/ops/ttnn/ttnn.empty.md
  • docs/ops/ttnn/ttnn.to_device.md
  • docs/ops/ttnn/ttnn.to_layout.md
  • docs/ops/ttnn/ttnn.typecast.md

I removed these 4 files and tested my branch. I noticed that pages build-and-deployment workflow is passing successfully: link

However, there are 2 questions:

  • Though the action is passing, the following website doesn't show anything: https://docs.tenstorrent.com/tt-torch/ @vmilosevic Would you be able to check if this related to something in the settings? You can cross reference with the successful github action link.
  • How do we go about handling long md files automatically? Should the md file generator have a limit to the number of elements it can have? Or after these files are created, should we cut off after a certain line number? Since we are moving to automating the publishing of ttnn md files, we need an automatic safeguard as well. We could also have some ops who are ignored if they are not important to publish anyways. I have a feeling these ops (empty, to_device, to_layout, typecase) aren't that significant in terms of the input variation.

@ddilbazTT
Copy link
Contributor Author

Things seem to be working now that I added index.md under docs: https://docs.tenstorrent.com/tt-torch/ A couple remarks:

The successful workflow is here

ddilbazTT added a commit that referenced this issue Jan 10, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

generate_md.py is changed to address this. Now, md files have tables with 600 rows max,
and each file size is 500MB max (due to github pre-commit). After
hitting these restrictions, a new file is created.

Furthermore, github pages landing page is added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 10, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

generate_md.py is changed to address this. Now, md files have tables with 600 rows max,
and each file size is 500MB max (due to github pre-commit). After
hitting these restrictions, a new file is created.

Furthermore, github pages landing page is added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 13, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

generate_md.py is changed to address this. Now, md files have tables with 600 rows max,
and each file size is 500MB max (due to github pre-commit). After
hitting these restrictions, a new file is created.

Furthermore, github pages landing page is added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 13, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

generate_md.py is changed to address this. Now, md files have tables with 600 rows max,
and each file size is 500MB max (due to github pre-commit). After
hitting these restrictions, a new file is created.

Furthermore, github pages landing page is added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 17, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

generate_md.py is changed to address this. Now, md files have tables with 600 rows max,
and each file size is 500MB max (due to github pre-commit). After
hitting these restrictions, a new file is created.

Furthermore, github pages landing page is added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 17, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

- generate_md.py changed - md files have tables with max 600 rows.

- pre-commit large file check removed.

- landing page added (docs/index.md)
ddilbazTT added a commit that referenced this issue Jan 17, 2025
There are certain md pages breaking github pages build-and-deployment.
These can be tested using kramdown, md to html converter.

- generate_md.py changed - md files have tables with max 600 rows.

- pre-commit large file check removed.

- landing page added (docs/index.md)
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

No branches or pull requests

1 participant