Skip to content

Trying to jit fibonacci function results in JitError: function can't be jitted #5159

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

Closed
ashish01 opened this issue Feb 8, 2024 · 3 comments · Fixed by #5473
Closed

Trying to jit fibonacci function results in JitError: function can't be jitted #5159

ashish01 opened this issue Feb 8, 2024 · 3 comments · Fixed by #5473
Labels
C-bug Something isn't working

Comments

@ashish01
Copy link

ashish01 commented Feb 8, 2024

Summary

JitError: function can't be jitted (fibonacci)

Expected

The function is compiled to native code and runs fast

Actual

JitError

Details

Trying to run the following program in windows 11

def fib(n: int) -> int:
  if n == 0 or n == 1:
    return 1
  return fib(n-1) + fib(n-2)

fib.__jit__()

print(fib(35))

Results in following

target\release\rustpython.exe fibs.py
Traceback (most recent call last):
  File "fibs.py", line 6, in <module>
    fib.__jit__()
JitError: function can't be jitted

I compiled from source on following commit

commit 3eda1cf3b4a29eb35c30f2a3ed272771c642c065 (HEAD -> main, origin/main, origin/HEAD)
Author: Alin-Ioan Alexandru <118962201+alinioan@users.noreply.github.com>
Date:   Thu Jan 25 07:54:06 2024 +0200

    Deprecation warning fix for __complex__ (#5152)

using following command

>cargo build --release --features jit

Is this expected?

@ashish01 ashish01 added the C-bug Something isn't working label Feb 8, 2024
@theshubhamp
Copy link
Contributor

Current JIT implementation is experimental & doesn't support calling out or accessing items from global scope.

Sent a PR that adds supports for recursion: #5473

@theshubhamp
Copy link
Contributor

Fixed. Can be closed @youknowone ?

@youknowone youknowone linked a pull request Jan 13, 2025 that will close this issue
@youknowone
Copy link
Member

Thank you for reminding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants