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

Merge pull request #92 from kc611/debug_patch #94

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -6,7 +6,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 @@ -55,7 +56,7 @@ def from_bytecode(code: Callable) -> "ByteFlow": # type: ignore
The resulting ByteFlow object.
"""
bc = dis.Bytecode(code)
_logger.debug("Bytecode\n%s", _LogWrap(lambda: bc.dis())) # type: ignore # noqa E501
# _logger.debug("Bytecode\n%s", _LogWrap(lambda: bc.dis())) # type: ignore # noqa E501

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 @@ -12,7 +12,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]) -> None:
Expand Down Expand Up @@ -257,9 +257,11 @@ def restructure_loop(parent_region: RegionBlock) -> None:
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 @@ -442,7 +444,7 @@ def extract_region(
def restructure_branch(parent_region: RegionBlock) -> None:
assert parent_region.subregion is not None
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
6 changes: 3 additions & 3 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 abc import abstractmethod
from numba_rvsdg.core.datastructures.basic_block import (
BasicBlock,
Expand Down Expand Up @@ -79,7 +79,7 @@ def render_block(
elif isinstance(block, SyntheticBlock):
self.render_basic_block(digraph, name, block)
else:
raise Exception("unreachable")
raise Exception(f"unreachable: {type(block)}")

def render_edges(self, scfg: SCFG) -> None:
"""Function that renders the edges in an SCFG.
Expand Down Expand Up @@ -323,7 +323,7 @@ def view(self, name: Optional[str] = None) -> None:
self.g.view(name)


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


def render_func(func) -> None: # type: ignore
Expand Down