Skip to content

logging

Finch logging module.

This file contains all available filters for customizing your Finch program. The compilation_stage log field is designed in a hierarchical way, to allow quick filtering of generated IRs. Each segment consists of sub-segments which build a path to a log record.

──> root
    ├──> logic
         ├──> pre-opt
         ├──> TODO: Add logging after each opt stage
         ├──> post-opt
    ├──> notation
    ├──> assembly
    ├──> galley
    └──> codegen
         ├──> c-backend
         └──> numba-backend

For example root.logic will print two Logic IRs - pre and post scheduler optimizations. root.codegen.numba-backend will provide only Numba generated kernel.

Fiters can be combined with , when passing to get_logger_handler.

Instead of full names, you can use abbrevations, listed in _abbr_mapping dictionary. We also encourage to use Finch's custom logging FORMAT for your logger setup.

Here's an example of logger setup:

import logging
from finch.util.logging import get_logger_handler, FORMAT

handler = get_logger_handler(filter_pattern="r.l.pre,r.c.nb")
logging.basicConfig(level=logging.DEBUG, handlers=[handler], format=FORMAT)

# ...Finch code...