microsoft / antares

Antares: an automatic engine for multi-platform kernel generation and optimization. Supporting CPU, CUDA, ROCm, DirectX12, GraphCore, SYCL for CPU/GPU, OpenCL for AMD/NVIDIA, Android CPU/GPU backends.
Other
438 stars 45 forks source link

Does ROCm for Windows ever exist? #269

Open daoxian opened 3 years ago

daoxian commented 3 years ago

Since the document says that Antares supports ROCm for Windows, I wonder whether this kind of thing exists in the world? The ROCm has been officially declared that there's no plans for Windows!

ghostplant commented 3 years ago

Yes. It has been supported by the end of 2020, as long as you have an AMDGPU that satisfy ROCm's official supported list, e.g. Radeon7, Vega64, etc.

You need to install latest AMD driver for Windows (version >= 2020.12), after you complete the AMD driver installation, you should see there is a runtime library C:\Windows\System32\amdhip64.dll. This means you can interactive with it to execute ROCm workloads.

Antares has already been able to interactive with this runtime library directly. What you need is: 1) Install latest AMD driver for Win10 to ensure C:\Windows\System32\amdhip64.dll exists. 2) Install WSL1.0 based on Ubuntu 18.04/20.04 image. 3) In WSL1.0, install Antares dependent packages: sudo apt install git python3-pip g++ make g++-mingw-w64-x86-64 4) Next, using git in WSL1.0 to clone Antares and try some examples executed by ROCm backend, e.g. BACKEND=c-rocm_win64 make

daoxian commented 3 years ago

Yes. It has been supported by the end of 2020, as long as you have an AMDGPU that satisfy ROCm's official supported list, e.g. Radeon7, Vega64, etc.

You need to install latest AMD driver for Windows (version >= 2020.12), after you complete the AMD driver installation, you should see there is a runtime library C:\Windows\System32\amdhip64.dll. This means you can interactive with it to execute ROCm workloads.

Antares has already been able to interactive with this runtime library directly. What you need is:

  1. Install latest AMD driver for Win10 to ensure C:\Windows\System32\amdhip64.dll exists.
  2. Install WSL1.0 based on Ubuntu 18.04/20.04 image.
  3. In WSL1.0, install Antares dependent packages: sudo apt install git python3-pip g++ make g++-mingw-w64-x86-64
  4. Then in WSL1.0, clone Antares and type some examples to run by ROCm, e.g. BACKEND=c-rocm_win64 make

OKay, that sounds amazing... Let me have a try and thanks a lot!

Column01 commented 3 years ago

Can I use this with WSL2 or does it need to be WSL1?

ghostplant commented 3 years ago

@Column01 I didn't try whether it can work in WSL2. I'll verify it later.

ghostplant commented 3 years ago

@Column01 WSL2 should work since this PR (https://github.com/microsoft/antares/pull/282), which makes two backends DirectX12 & ROCm work in both WSL1 and WSL2.

Because it is for WSL instead of real Linux, so by default, it will work using DirectX12 for acceleration whose backend name is c-hlsl_win64.

If you explicitly set export BACKEND=c-rocm_win64 or BACKEND=c-rocm_win64 make, it will recognize this backend change and be going to work using Windows-side AMD ROCm driver.

Note that Windows-side AMD ROCm driver only provide runtime instead of HIP compiler, so we still need to install rocm-dev in WSL according to ROCm Official Guide which would be only used to compile the C-based source code.

Column01 commented 3 years ago

Hmm. Maybe I'm misunderstanding but would this let me run PyTorch using ROCm on windows? I'm pretty new to ML and GPU computing in general.

Basically I guess my question is would this only be for compiling ROCm code I've written to work on Windows or could it let me run linux ROCm code on windows and in this case, PyTorch?

Assuming I install it under WSL2 and run this, PyTorch should see my AMD gpu correct?

ghostplant commented 3 years ago

@Column01 Antares is not a virtual machine but device code generator and optimizer for devices it covers. So your understanding of letting you to run "ROCm device kernel" using "native Windows AMDGPU" is correct, and it is not the component to make the full-stack of ROCm to work in WSL as Linux mode.

Briefly, this c-rocm_win64 backend will satisfy customers who have "Windows OS + ROCm GPU" and want Standard Win64 applications to run clean ROCm device code, and Antares will help to generate Windows ROCm device code for that.

LuisB79 commented 2 years ago

Briefly, this c-rocm_win64 backend will satisfy customers who have "Windows OS + ROCm GPU" and want Standard Win64 applications to run clean ROCm device code, and Antares will help to generate Windows ROCm device code for that.

can i run HIP code with this?

ghostplant commented 2 years ago

Yes, Just try this in windows WSL.

pip3 install --upgrade antares
BACKEND=c-rocm_win64 antares
LuisB79 commented 2 years ago

i will, it's just that i have gfx1031 and there is no official support for it afaik, but it seems i can compile with flags to enable support on gfx1031, should i try and compile rocm with support for gfx1031? or does wsl2 helps with this?

LuisB79 commented 2 years ago

Yes, Just try this in windows WSL.

pip3 install --upgrade antares
BACKEND=c-rocm_win64 antares

i have an gfx1031 and there is no official support for it. It seems i can compile rocm with flags to enable support on gfx1031 since it gfx1030 is currently supported, should i try and compile rocm with support for gfx1031? or does wsl2 helps with this?

ghostplant commented 2 years ago

Yes, Just try this in windows WSL.

pip3 install --upgrade antares
BACKEND=c-rocm_win64 antares

i have an gfx1031 and there is no official support for it. It seems i can compile rocm with flags to enable support on gfx1031 since it gfx1030 is currently supported, should i try and compile rocm with support for gfx1031? or does wsl2 helps with this?

You can try that, we even did similar things for gfx1010, which is also not officially supported by HIP, but it can work by Antares + Windows 10 WSL 1.0 + Last version of C:\Windows\System32\amdhip64.dll.

LuisB79 commented 2 years ago

Yes, Just try this in windows WSL.

pip3 install --upgrade antares
BACKEND=c-rocm_win64 antares

i have an gfx1031 and there is no official support for it. It seems i can compile rocm with flags to enable support on gfx1031 since it gfx1030 is currently supported, should i try and compile rocm with support for gfx1031? or does wsl2 helps with this?

You can try that, we even did similar things for gfx1010, which is also not officially supported by HIP, but it can work by Antares + Windows 10 WSL 1.0 + Last version of C:\Windows\System32\amdhip64.dll.

does it need to be wsl1? or wls2?, also wonderful

ghostplant commented 2 years ago

Current Antares needs to work in WSL, but won't in the future.

cstueckrath commented 1 year ago

any news on this? Would you share how you compiled rocm with support for other cards?

ghostplant commented 1 year ago

any news on this? Would you share how you compiled rocm with support for other cards?

Just follow instructions above, the only difference for other amdgpu is choosing a different gfx number.

heloess commented 1 year ago

It actually exists but not publicly available https://wiki.blender.org/wiki/Building_Blender/GPU_Binaries#AMD

BBC-Esq commented 11 months ago

Was this ever solved definitively? I'm building programs that use PyTorch and gpu acceleration, but apparently PyTorch only supports AMD GPUs on Linux, not Windows. It'd be great to have clear installation instructions to install WSL on conjunction with RocM on Windows to utilize an AMD GPU acceleration! Here's my repo where you can see in my installation instructions that I've been struggling with this for a long time...https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio

And here's a link to a summary of the possible solutions I've found so far...But using WSL seems the best so far: https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio/issues/4

ghostplant commented 11 months ago

Was this ever solved definitively? I'm building programs that use PyTorch and gpu acceleration, but apparently PyTorch only supports AMD GPUs on Linux, not Windows. It'd be great to have clear installation instructions to install WSL on conjunction with RocM on Windows to utilize an AMD GPU acceleration! Here's my repo where you can see in my installation instructions that I've been struggling with this for a long time...https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio

And here's a link to a summary of the possible solutions I've found so far...But using WSL seems the best so far: https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio/issues/4

Does it depend on Pytorch operators? If all operators can be defintely by yourself, you can use this https://github.com/microsoft/antares#quick-test-1-create-custom-operator-of-your-own-in-pytorch-2 to create and accelerate them by GPU on windows (no longer WSL needed.)

LuisB79 commented 11 months ago

Was this ever solved definitively? I'm building programs that use PyTorch and gpu acceleration, but apparently PyTorch only supports AMD GPUs on Linux, not Windows. It'd be great to have clear installation instructions to install WSL on conjunction with RocM on Windows to utilize an AMD GPU acceleration! Here's my repo where you can see in my installation instructions that I've been struggling with this for a long time...https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio

And here's a link to a summary of the possible solutions I've found so far...But using WSL seems the best so far: https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio/issues/4

AFAIK Rocm was released for windows, but if you dont have a pro card or a NX1 card you will havve issues and you will have to do other steps to get it working, i dont know which ones doe

ghostplant commented 11 months ago

Was this ever solved definitively? I'm building programs that use PyTorch and gpu acceleration, but apparently PyTorch only supports AMD GPUs on Linux, not Windows. It'd be great to have clear installation instructions to install WSL on conjunction with RocM on Windows to utilize an AMD GPU acceleration! Here's my repo where you can see in my installation instructions that I've been struggling with this for a long time...https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio And here's a link to a summary of the possible solutions I've found so far...But using WSL seems the best so far: https://github.com/BBC-Esq/ChromaDB-Plugin-for-LM-Studio/issues/4

AFAIK Rocm was released for windows, but if you dont have a pro card or a NX1 card you will havve issues and you will have to do other steps to get it working, i dont know which ones doe

What is the progress? Having SDK already, or supporting Windows applications like Pytorch?

BBC-Esq commented 11 months ago

What is the progress? Having SDK already, or supporting Windows applications like Pytorch?

Basically, I'm using it to create vector databases and interact with a large language model, so basic PyTorch stuff. NVIDIA and AMD GPUs are supported on Linux. NVIDIA GPUs are supported on Windows. The only outlier is that AMD GPUs are not supported on Windows.

Honestly, programming is not my trade, so I don't know what operators even means referring to PyTorch. Any help would be much appreciated.