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

doc: add instructions for building and testing on Windows #1441

Merged
merged 1 commit into from
Oct 2, 2022
Merged

doc: add instructions for building and testing on Windows #1441

merged 1 commit into from
Oct 2, 2022

Conversation

ashay
Copy link
Collaborator

@ashay ashay commented Sep 30, 2022

No description provided.

Copy link
Collaborator

@powderluv powderluv left a comment

Choose a reason for hiding this comment

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

Thank you. But doesn't it default to cl and link automatically ? They we could make it almost identical to the Linux commands except the %cd%

@ashay
Copy link
Collaborator Author

ashay commented Sep 30, 2022

But doesn't it default to cl and link automaticaly ?

You're right, it does default to cl and link. It seems I had my PATH variable jumbled up when I tried it a while back, since CMake was picking up the cl compiler and the GNU ld linker back then. It looks like if I do this right, by not loading the GNU toolchain (through MinGW) at all, then all is good with the default pick of the compiler and linker. Thanks for catching this, I'll fix it right away.

Then we could make it almost identical to the Linux commands except the %cd%

Sorry, I'm lost in the details. Do you mean that we could roll both the Windows and Linux build instructions into just one section? Or did you mean that we'd have a near-identical sequence of arguments passed to cmake, just like in the "CMake (Linux)" section? You're right that the only differences are in the compiler and using %cd% instead of pwd.

@ashay
Copy link
Collaborator Author

ashay commented Sep 30, 2022

I think I can roll them both into just one section. I'll push a change in a few minutes. Let me know what you think, but no rush!

@ashay
Copy link
Collaborator Author

ashay commented Sep 30, 2022

Made some small fixes. Also, it seems like PyTorch on MinGW isn't supported, so I dropped the reference to it from the doc.

$ uname -a
MINGW64_NT-10.0-22621 machine-name 3.3.6-341.x86_64 2022-09-20 22:07 UTC x86_64 Msys

$ python3 -m pip install --user --upgrade -r requirements.txt
Looking in links: https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
ERROR: Could not find a version that satisfies the requirement torch==1.13.0.dev20220930 (from versions: none)
ERROR: No matching distribution found for torch==1.13.0.dev20220930

Some old forum posts [1,2,3] suggest that to get PyTorch working on MinGW, you'd need to compile from source, with non-trivial changes to the source.
[1] https://discuss.pytorch.org/t/cmake-with-error-by-compiling-on-windows-with-mingw32-make/159140/6
[2] https://discuss.pytorch.org/t/can-i-build-libtorch-from-source-with-mingw/52632
[3] pytorch/pytorch#15099

docs/development.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@powderluv powderluv left a comment

Choose a reason for hiding this comment

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

minor nit. in case we can use . it can be the same command modulo forward/backward slash which powershell will translate

@ashay
Copy link
Collaborator Author

ashay commented Sep 30, 2022

I have never used PowerShell before, but it seems like these commands suffice. @sstamenova, do these commands look good to you?

@powderluv
Copy link
Collaborator

Perfect. Was just trying to keep them as similar as possible.

@powderluv
Copy link
Collaborator

I found that if you specify . for the pwd you get a warning in windows like:

PS C:\G\torch-mlir> cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DPython3_FIND_VIRTUALENV=ONLY -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR=. -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR=./externals/llvm-external-projects/torch-mlir-dialects -DMLIR_ENABLE_BINDINGS_PYTHON=ON
 -DLLVM_TARGETS_TO_BUILD=host externals/llvm-project/llvm
CMake Warning:
  Ignoring extra path from command line:

   "C:/G/torch-mlir"


CMake Warning:
  Ignoring extra path from command line:

So if you use this command it works exactly the same way in both Linux (Cmake 3.24.0) and Windows (CMake 3.24.1)

 cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DPython3_FIND_VIRTUALENV=ONLY -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_EXTERNAL_PROJECTS="torch-mlir;torch-mlir-dialects" -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR= -DLLVM_EXTERNAL_TORCH_MLIR_DIALECTS_SOURCE_DIR=externals/llvm-external-projects/torch-mlir-dialects -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DLLVM_TARGETS_TO_BUILD=host externals/llvm-project/llvm

So you could update the command Linux command itself to drop the pwd and we will have the exact commands on both Windows and Linux.

@ashay
Copy link
Collaborator Author

ashay commented Oct 1, 2022

So you could update the command Linux command itself to drop the pwd and we will have the exact commands on both Windows and Linux.

That's neat! Thanks for trying this out. Updated in the most recent commit.

Copy link
Collaborator

@powderluv powderluv left a comment

Choose a reason for hiding this comment

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

Maybe worth leaving the compiler flag for clang in the comments below the actual command.

@ashay ashay merged commit ffea3de into llvm:main Oct 2, 2022
@ashay ashay deleted the ashay/windows-build-instructions branch October 2, 2022 13:28
qedawkins pushed a commit to nod-ai/torch-mlir that referenced this pull request Oct 3, 2022
Signed-off-by: Philip Lassen <philiplassen+git@gmail.com>
Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
Co-authored-by: Tung D. Le <tung@jp.ibm.com>
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