Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
youkaichao committed Nov 27, 2023
1 parent 9b546a9 commit 992194b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Take the workflow from the walk-through example:
- Generate source code for transformed bytecode and resume functions.
- Link graph computation functions with on-disk code, so that debuggers can step through the code.

The main usage of ``depyf`` involves two context managers:
The main usage of ``depyf`` involves two context managers, and it is recommended to launched the script with a debugger:

.. code-block:: python
Expand Down Expand Up @@ -49,6 +49,11 @@ The main usage of ``depyf`` involves two context managers:
with depyf.debug():
output = function(shape_10_inputs)
The first context manager ``depyf.prepare_debug()`` accpets whatever you give to ``torch.compile``, and one directory path to dump all source code to. Inside this context manager, all function call of the compiled function ``function`` will be hooked by ``depyf``, which dumps necessarry source code for you.

Upon exiting the context manager, the program will pause, and you can browse all source code under the directory you specify (``"./debug_dir"`` in this example). The entry file is ``full_code.py``. You can set breakpoints inside these files.

The second context manager ``depyf.debug()`` has no arguments, it just disables new compiled entries. And the most important thing is, those breakpoints you set, can be hit under this context manager. And you can step through the code line by line, to debug possible ``NaN`` values or to understand what happens to your code.

.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit 992194b

Please sign in to comment.