Skip to content

Commit 0bfbceb

Browse files
committed
add alternative compiler based on svekars comments
1 parent d2e1f27 commit 0bfbceb

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

prototype_source/inductor_windows_cpu.rst

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,30 @@ This tutorial will guide you through the process of using TorchInductor on a Win
2424
* Miniforge for Windows
2525

2626
Install the Required Software
27-
-------------------------------------------
27+
-----------------------------
2828

2929
First, let's install the required software. C++ compiler is required for TorchInductor optimization.
3030
We will use Microsoft Visual C++ (MSVC) for this example.
3131

3232
1. Download and install `MSVC <https://visualstudio.microsoft.com/downloads/>`_.
3333

34-
2. During the installation, choose **Desktop Development with C++** in the **Desktop & Mobile** section. Then install the software
34+
2. During the installation, choose **Desktop Development with C++** in the **Desktop & Mobile** section in **Workloads** table. Then install the software
3535

3636
.. note::
3737

3838
We recommend C++ compiler `Clang <https://github.com/llvm/llvm-project/releases>`_ and `Intel Compiler <https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html>`_.
39-
39+
Please check `Alternative Compiler for better performance <#alternative-compiler-for-better-performance>`_.
4040

4141
3. Download and install `Miniforge3-Windows-x86_64.exe <https://github.com/conda-forge/miniforge/releases/latest/>`__.
4242

4343
Set Up the Environment
44-
------------------------------
44+
----------------------
4545

4646
#. Open the command line environment via ``cmd.exe``.
47-
#. Activate `MSVC` with the following command::
47+
#. Activate ``MSVC`` with the following command::
4848

4949
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"
50-
#. Activate `conda` with the following command:
50+
#. Activate ``conda`` with the following command:
5151

5252
.. code-block:: sh
5353
@@ -62,7 +62,7 @@ Set Up the Environment
6262
#. Install `PyTorch 2.5 <https://pytorch.org/get-started/locally/>`_ or later.
6363

6464
Using TorchInductor on Windows CPU
65-
----------------------------------------
65+
----------------------------------
6666

6767
Here’s a simple example to demonstrate how to use TorchInductor:
6868

@@ -102,7 +102,24 @@ The code above returns the following output:
102102
[ 5.7244e-04, 1.2799e+00, 1.3595e+00, 1.0907e+00, 3.7191e-01,
103103
1.4062e+00, 1.3672e+00, 6.8502e-02, 8.5216e-01, 8.6046e-01]])
104104
105+
Alternative Compiler for better performance
106+
-------------------------------------------
107+
108+
To enhance performance on Windows inductor, you can use the Intel Compiler or LLVM Compiler. However, they rely on the runtime libraries from Microsoft Visual C++ (MSVC). Therefore, your first step should be to install MSVC.
109+
110+
Intel Compiler
111+
^^^^^^^^^^^^^^
112+
113+
#. Download and install `Intel Compiler <https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler-download.html>`_ with Windows version.
114+
#. Set Windows Inductor Compiler via environment variable ``set CXX=icx-cl``
115+
116+
LLVM Compiler
117+
^^^^^^^^^^^^^
118+
119+
#. Download and install `LLVM Compiler <https://github.com/llvm/llvm-project/releases>`_ and choose win64 version.
120+
#. Set Windows Inductor Compiler via environment variable ``set CXX=clang-cl``
121+
105122
Conclusion
106123
----------
107124

108-
In this tutorial, we have learned how to use Inductor on Windows CPU with PyTorch 2.5 or later.
125+
With this tutorial, we introduce how to use Inductor on Windows CPU with PyTorch 2.5 or later. We can use Intel Compiler or LLVM Compiler to get better performance.

0 commit comments

Comments
 (0)