tree: 31a849120559d89bc9a8d37d1d5db02635e4d4b7 [path history] [tgz]
  1. tablegen_kernel/
  2. .gitignore
  3. LLVM_TableGen.ipynb
  4. LLVM_TableGen.md
  5. README.md
  6. sql_query_backend.ipynb
  7. sql_query_backend.md
  8. tablegen_tutorial_part_1.ipynb
  9. tablegen_tutorial_part_1.md
utils/TableGen/jupyter/README.md

Jupyter Tools for TableGen

This folder contains notebooks relating to TableGen and a Jupyter kernel for TableGen.

Notebooks

LLVM_TableGen.ipynb - A demo of the kernel's capabilities.

tablegen_tutorial_part_1.ipynb - A tutorial on the TableGen language.

sql_query_backend.ipynb - How to write a backend using JSON output and Python.

Notebooks can be viewed in browser on Github or downloaded and run locally. If that is not possible, there are Markdown versions next to the notebook files.

TableGen Kernel

To use the kernel, first install it into jupyter.

If you have installed Jupyter into a virtual environment, adjust python3 to be the interpreter for that environment. This will ensure that tools run the kernel in the correct context.

    python3 -m tablegen_kernel.install

If you are going to open the notebook in an IDE like Visual Studio Code, you should restart it now so that it will find the newly installed kernel.

Then run one of:

    jupyter notebook
    # Then in the notebook interface, select 'LLVM TableGen' from the 'New' menu.

    # To run the example notebook in this folder.
    jupyter notebook LLVM_TableGen.ipynb

    # To use the kernel from the command line.
    jupyter console --kernel tablegen

Or open the notebook in a tool with built in Jupyter support.

llvm-tblgen is expected to be either in the PATH or you can set the environment variable LLVM_TBLGEN_EXECUTABLE to point to it directly.

If you see an error like this:

  Cell In[8], line 2
    // This is some tablegen
    ^
SyntaxError: invalid syntax

You are probably running the notebook using the iPython kernel. Make sure you have selected the tablegen kernel.

To run the kernel's doctests do:

    python3 tablegen_kernel/kernel.py