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

Looplift fail on if-branch after for-loop in py3.8 #5045

Open
2 tasks done
sklam opened this issue Jan 7, 2020 · 1 comment
Open
2 tasks done

Looplift fail on if-branch after for-loop in py3.8 #5045

sklam opened this issue Jan 7, 2020 · 1 comment
Labels
bug lowpriority performance performance related issue

Comments

@sklam
Copy link
Member

sklam commented Jan 7, 2020

Reporting a bug

See affected test in #5029.

Reproducer:

from numba import jit
import logging
logging.basicConfig(level=logging.DEBUG)

def bar(x):
    return x

@jit
def foo(x):
    h = 0.
    for k in range(x):
        h = h + k

    bar(x)
    if x:
        h = h - bar(x)
    return h


foo(1)
foo.inspect_types()

The log will show:

INFO:numba.transforms:finding looplift candidates
DEBUG:numba.transforms:top-level loop: Loop(entries={14}, exits={40}, header=16, body={16, 28})
DEBUG:numba.transforms:same_exit_point=False ({52, 53})

Loop lifting fails on the same_exit_point requirement.

@sklam sklam added bug lowpriority performance performance related issue labels Jan 7, 2020
@sklam
Copy link
Member Author

sklam commented Jan 7, 2020

There's no plan to fix it (hence the lowprority). Users are advised to switch to @njit and refactor the performance-critical loop out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug lowpriority performance performance related issue
Projects
None yet
Development

No branches or pull requests

1 participant