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

Patching debug logging calls and debug print statements #92

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions numba_rvsdg/core/datastructures/byte_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from numba_rvsdg.core.datastructures.scfg import SCFG
from numba_rvsdg.core.datastructures.basic_block import RegionBlock
from numba_rvsdg.core.datastructures.flow_info import FlowInfo
from numba_rvsdg.core.utils import _logger, _LogWrap

# from numba_rvsdg.core.utils import _logger, _LogWrap

from numba_rvsdg.core.transformations import (
restructure_loop,
Expand Down Expand Up @@ -54,7 +55,7 @@ def from_bytecode(code) -> "ByteFlow":
The resulting ByteFlow object.
"""
bc = dis.Bytecode(code)
_logger.debug("Bytecode\n%s", _LogWrap(lambda: bc.dis()))
# _logger.debug("Bytecode\n%s", _LogWrap(lambda: bc.dis()))

flowinfo = FlowInfo.from_bytecode(bc)
scfg = flowinfo.build_basicblocks()
Expand Down
12 changes: 7 additions & 5 deletions numba_rvsdg/core/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
)
from numba_rvsdg.core.datastructures import block_names

from numba_rvsdg.core.utils import _logger
# from numba_rvsdg.core.utils import _logger


def loop_restructure_helper(scfg: SCFG, loop: Set[str]):
Expand Down Expand Up @@ -250,9 +250,11 @@ def restructure_loop(parent_region: RegionBlock):
or next(iter(nodes)) in scfg[next(iter(nodes))].jump_targets
]

_logger.debug(
"restructure_loop found %d loops in %s", len(loops), scfg.graph.keys()
)
# _logger.debug(
# "restructure_loop found %d loops in %s",
# len(loops),
# scfg.graph.keys()
# )
# rotate and extract loop
for loop in loops:
loop_restructure_helper(scfg, loop)
Expand Down Expand Up @@ -431,7 +433,7 @@ def extract_region(

def restructure_branch(parent_region: RegionBlock):
scfg: SCFG = parent_region.subregion
print("restructure_branch", scfg.graph)
# print("restructure_branch", scfg.graph)
doms = _doms(scfg)
postdoms = _post_doms(scfg)
postimmdoms = _imm_doms(postdoms)
Expand Down
4 changes: 2 additions & 2 deletions numba_rvsdg/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
# import logging

_logger = logging.getLogger(__name__)
# _logger = logging.getLogger(__name__)


class _LogWrap:
Expand Down
11 changes: 6 additions & 5 deletions numba_rvsdg/rendering/rendering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
# import logging
from numba_rvsdg.core.datastructures.basic_block import (
BasicBlock,
RegionBlock,
Expand Down Expand Up @@ -50,8 +50,10 @@ def render_block(
self.render_basic_block(digraph, name, block)
elif type(block) == RegionBlock:
self.render_region_block(digraph, name, block)
elif isinstance(block, BasicBlock):
self.render_basic_block(digraph, name, block)
else:
raise Exception("unreachable")
raise Exception(f"unreachable: {type(block)}")

def render_edges(self, scfg: SCFG):
"""Function that renders the edges in an SCFG.
Expand Down Expand Up @@ -169,8 +171,7 @@ def render_branching_block(
digraph.node(str(name), shape="rect", label=body)

def render_byteflow(self, byteflow: ByteFlow):
"""Renders the provided `ByteFlow` object.
"""
"""Renders the provided `ByteFlow` object."""
self.bcmap_from_bytecode(byteflow.bc)
# render nodes
for name, block in byteflow.scfg.graph.items():
Expand Down Expand Up @@ -292,7 +293,7 @@ def view(self, name: str):
self.g.view(name)


logging.basicConfig(level=logging.DEBUG)
# logging.basicConfig(level=logging.DEBUG)


def render_func(func):
Expand Down
Loading