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

Generating C executable that accesses the shared object file without Python #1003

Merged
merged 93 commits into from
Aug 20, 2024

Conversation

tzunghanjuang
Copy link
Collaborator

@tzunghanjuang tzunghanjuang commented Aug 7, 2024

Context:

  • Add debug.compiler_functions.compile_cmain to compiler a c main wrapper into an executable.
  • Support multi-dimensional arrays in c generation.

Changes

  • compile_cmain(fn: QJIT, *args) -> str, str takes a qjit decorated function and arguments for that function. It returns the path to the output binary file.
@qjit
def f(x):
    y = x*x
    debug.print_memref(y)
    return y
f(5)
>>> MemRef: base@ = 0x64fc9dd5ffc0 rank = 0 offset = 0 sizes = [] strides = [] data =
25
25
binary = compile_executable(f, 1)
result = subprocess.run(binary, capture_output=True, text=True, check=True)
result.stdout
>>> MemRef: base@ = 0x5df35987b780 rank = 0 offset = 0 sizes = [] strides = [] data =
25
  • Patch MacOS dylib broken dependencies caused by /DLC paths. Reference
  • Patch inconsistent MacOS Python dylib rpath.

Related GitHub Issues:
[sc-67088]
[sc-70777]

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.88%. Comparing base (565222e) to head (d440c66).
Report is 7 commits behind head on main.

Files Patch % Lines
frontend/catalyst/debug/compiler_functions.py 95.23% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1003      +/-   ##
==========================================
- Coverage   97.88%   97.88%   -0.01%     
==========================================
  Files          75       75              
  Lines       10704    10758      +54     
  Branches     1236     1244       +8     
==========================================
+ Hits        10478    10530      +52     
  Misses        177      177              
- Partials       49       51       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tzunghanjuang tzunghanjuang marked this pull request as ready for review August 9, 2024 17:00
@tzunghanjuang tzunghanjuang changed the title Generating executable from IRs Generating C executable that accesses the shared object file without Python Aug 9, 2024
doc/dev/debugging.rst Outdated Show resolved Hide resolved
doc/dev/debugging.rst Outdated Show resolved Hide resolved
doc/dev/debugging.rst Outdated Show resolved Hide resolved
doc/dev/debugging.rst Outdated Show resolved Hide resolved
Copy link
Collaborator

@dime10 dime10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🎉

@tzunghanjuang tzunghanjuang merged commit 7cdbda0 into main Aug 20, 2024
64 of 67 checks passed
@tzunghanjuang tzunghanjuang deleted the debug-executable branch August 20, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author:build-wheels Run the wheel building workflows on this Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants