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

Add torch-mlir-no-jit-importer build case for mac os wheels #1902

Merged
merged 2 commits into from
Mar 5, 2023

Conversation

makslevental
Copy link
Collaborator

@makslevental makslevental commented Feb 25, 2023

This PR adds a build case in the build_macos_packages.sh for torch-mlir-no-jit-importer. This is probably not the best way to factor this, which is why I didn't go ahead and add such cases to the other platforms/targets.

@makslevental makslevental force-pushed the out_of_tree_build branch 3 times, most recently from f43beca to 055333b Compare March 3, 2023 21:53
@makslevental makslevental changed the title add flags to setup.py for out-of-tree build Add torch-mlir-no-jit-importer build case for mac os wheels Mar 3, 2023
setup.py Show resolved Hide resolved
@powderluv
Copy link
Collaborator

also run a nightly build with the "One shot build"

@makslevental
Copy link
Collaborator Author

using main repo branch (rather than my fork) to do a oneshot build produce a wheel (here). Demo of using the wheel:

(nelli) mlevental@maksims-MacBook-Pro examples % cat demo.py 

import torch_mlir.ir
from torch_mlir.dialects import torch

with torch_mlir.ir.Context() as ctx:
    torch.register_dialect(ctx)
    with torch_mlir.ir.Location.unknown() as loc:
        module = torch_mlir.ir.Module.create(loc)
        with torch_mlir.ir.InsertionPoint.at_block_begin(module.body):
            n = torch.ConstantNoneOp()
        module.operation.print()         
                                                                                                                                                                      
(nelli) mlevental@maksims-MacBook-Pro examples % python demo.py 

Traceback (most recent call last):
  File "/Users/mlevental/dev_projects/loopy/examples/demo.py", line 2, in <module>
    import torch_mlir.ir
ModuleNotFoundError: No module named 'torch_mlir'

(nelli) mlevental@maksims-MacBook-Pro examples % pip install https://github.com/llvm/torch-mlir/releases/download/oneshot-20230304.83/torch_mlir_no_jit_importer-20230304.83-cp311-cp311-macosx_11_0_universal2.whl   
            
Collecting torch-mlir-no-jit-importer==20230304.83
  Downloading https://github.com/llvm/torch-mlir/releases/download/oneshot-20230304.83/torch_mlir_no_jit_importer-20230304.83-cp311-cp311-macosx_11_0_universal2.whl (58.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.6/58.6 MB 18.6 MB/s eta 0:00:00
Requirement already satisfied: numpy in /Users/mlevental/miniforge3/envs/nelli/lib/python3.11/site-packages (from torch-mlir-no-jit-importer==20230304.83) (1.24.2)
Installing collected packages: torch-mlir-no-jit-importer
Successfully installed torch-mlir-no-jit-importer-20230304.83

(nelli) mlevental@maksims-MacBook-Pro examples % python demo.py

module {
  %none = torch.constant.none
}

(nelli) mlevental@maksims-MacBook-Pro examples % pip freeze | grep torch
torch-mlir-no-jit-importer @ https://github.com/llvm/torch-mlir/releases/download/oneshot-20230304.83/torch_mlir_no_jit_importer-20230304.83-cp311-cp311-macosx_11_0_universal2.whl

(nelli) mlevental@maksims-MacBook-Pro examples % 

@powderluv

@makslevental makslevental force-pushed the out_of_tree_build branch 3 times, most recently from 4d4d381 to e641adc Compare March 5, 2023 03:55
@makslevental makslevental merged commit 415265a into llvm:main Mar 5, 2023
@makslevental makslevental deleted the out_of_tree_build branch March 5, 2023 18:23
gpetters94 pushed a commit to gpetters94/mlir-npcomp that referenced this pull request May 10, 2023
)

* add flags to setup.py for out-of-tree build

* - fix build_ext bug
- add wheels script cases for mac wheels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants