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
435 stars 45 forks source link

[Error] error: ‘CHECK_EQ’ was not declared in this scope; did you mean ‘CHECK_OK’? #367

Open Looong01 opened 1 year ago

Looong01 commented 1 year ago

When I try to run this command "AMDGFX=gfx1031 BACKEND=c-rocm_win64 Antares torch-setup" to Setup Plugin for Pytorch, it returned an error: error: ‘CHECK_EQ’ was not declared in this scope; did you mean ‘CHECK_OK’?

And there are also many other errors when compile this.

My gcc version is 9.4.0 and Ubuntu is 20.04.1

These are some screenshots of the errors: image

image

image

Looong01 commented 1 year ago

Should I upgrade my gcc version up to gcc-11 or gcc-12?

ghostplant commented 1 year ago

Hi, antares is a compiler that can make your custom DNN computation (e.g. matmul/..) runnable on Windows ROCm. You can follow examples below to see how antares work for Windows ROCm:

# Save Runnable Source code as file
BACKEND=c-rocm_win64 antares save ./kernel_example.cpp

# Reproduce kernel evaluation based on an early saved source code:
BACKEND=c-rocm_win64 antares eval ./kernel_example.cpp

# Freeze kernels and compiled into edge-side binaries:
BACKEND=c-rocm_win64 antares compile ./kernel_example.cpp ./output-dest/
# Build solution in destination directory:
cd ./output-dest && make
Looong01 commented 1 year ago

Hi, Antares is a compiler that can make your custom DNN computation (e.g. matmul/..) runnable on Windows ROCm. You can follow examples below to see how antares work for Windows ROCm:

# Save Runnable Source code as file
BACKEND=c-rocm_win64 antares save ./kernel_example.cpp

# Reproduce kernel evaluation based on an early saved source code:
BACKEND=c-rocm_win64 antares eval ./kernel_example.cpp

# Freeze kernels and compiled into edge-side binaries:
BACKEND=c-rocm_win64 antares compile ./kernel_example.cpp ./output-dest/
# Build solution in destination directory:
cd ./output-dest && make

Hi, how can I solve this error: "error: ‘CHECK_EQ’ was not declared in this scope; did you mean ‘CHECK_OK’?", when I use "AMDGFX=gfx1031 BACKEND=c-rocm_win64 Antares torch-setup"?

Looong01 commented 1 year ago

Besides, your command returned this error: image

ghostplant commented 1 year ago

Oh, you need export AMDGFX=gfx1031 for your GPU model.

Looong01 commented 1 year ago

Oh, you need export AMDGFX=gfx1031 for your GPU model.

And how can I solve this error: "error: ‘CHECK_EQ’ was not declared in this scope; did you mean ‘CHECK_OK’?", when I use "AMDGFX=gfx1031 BACKEND=c-rocm_win64 Antares torch-setup"?

I have upgrade my gcc and g++ and g++-mingw-w64-x86-64 to version 11 that supports C++17. But it still gave many errors when I setup Antares plugin for pytorch.

(All the errors came from the backend.hpp of Antares.)

I'll be happy to hear from you! Thanks a lot!

ghostplant commented 1 year ago

antares torch-setup is only for "Pytorch CPU/CUDA/ROCm for Linux", since no such Pytorch ROCm build for Windows exists for Antares to be as its plugin, even though Antares itself can produce user-defined standalone Windows ROCm kernels & executable that is runnable on Windows without depending on Pytorch.

Looong01 commented 1 year ago

antares torch-setup is only for "Pytorch CPU/CUDA/ROCm for Linux", since no such Pytorch ROCm build for Windows exists for Antares to be as its plugin, even though Antares itself can produce user-defined standalone Windows ROCm kernels & executable that is runnable on Windows without depending on Pytorch.

So, I still cannot run PyTorch ROCm version in WSL2 with Antares?

ghostplant commented 1 year ago

You can run custom computation with ROCm, but cannot run Linux-based Pytorch ROCm,

ghostplant commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

Looong01 commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

I noticed another program of Microsoft, PyTorch-DirectML, which can allow me to run PyTorch on AMD GPU. But it does not support many operators. For example, it does not support "aten::index_select" when I run a seq2seq model for the first time. And after 6 months I submitted an issue to them, they upgraded their version and support it now. As I ran seq2seq again, it returned it does not support another one, "aten::scatter_add.out". It really exhausts me.

You said, "every operator computation has to be customized and generated by you according to standard Antares usage.". Do you mean that I had to override all the operators of PyTorch when I want to use it?

Will "Antares plugin for Pytorch CPU for Windows" support all the native and original PyTorch operators?

Looong01 commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

Besides, you said that "Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031". So, if gfx1030 GPU (RX 6800) substitutes for my gfx1031 GPU (RX 6700XT), will it work? I know ROCm supports gfx1030 natively.

ghostplant commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

Besides, you said that "Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031". So, if gfx1030 GPU (RX 6800) substitutes for my gfx1031 GPU (RX 6700XT), will it work? I know ROCm supports gfx1030 natively.

If you install a prebuilt Pytorch ROCm with gfx1030 bincode included, it should be possible by a virtual stack between WSL and Windows ROCm driver, but it is not relevant to Antares.

ghostplant commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

I noticed another program of Microsoft, PyTorch-DirectML, which can allow me to run PyTorch on AMD GPU. But it does not support many operators. For example, it does not support "aten::index_select" when I run a seq2seq model for the first time. And after 6 months I submitted an issue to them, they upgraded their version and support it now. As I ran seq2seq again, it returned it does not support another one, "aten::scatter_add.out". It really exhausts me.

You said, "every operator computation has to be customized and generated by you according to standard Antares usage.". Do you mean that I had to override all the operators of PyTorch when I want to use it?

Will "Antares plugin for Pytorch CPU for Windows" support all the native and original PyTorch operators?

Yes, DirectML lacks many ops, and it should be the same for Antares, but Antares allows yourself to extend those missing ops, instead of waiting for DirectML developers to do this extension.

Looong01 commented 1 year ago

Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031, so it is impossible for you to use it in this way. We're going to publish "Antares plugin for Pytorch CPU for Windows to extend ROCm ops", as this is possible to make native Windows Pytorch to utilize ROCm gfx1031 without WSL needed. But every operator computation has to be customized and generated by you according to standard Antares usage.

Besides, you said that "Public Pytorch ROCm for Linux doesn't contain GPU codes for gfx1031". So, if gfx1030 GPU (RX 6800) substitutes for my gfx1031 GPU (RX 6700XT), will it work? I know ROCm supports gfx1030 natively.

If you install a prebuilt Pytorch ROCm with gfx1030 bincode included, it should be possible by a virtual stack between WSL and Windows ROCm driver, but it is not relevant to Antares.

So, you mean ROCm or PyTorch ROCm natively supports WSL with gfx1030?

And the last question: What is antares torch-setup used for? What can I do with it?

ghostplant commented 1 year ago

So, you mean ROCm or PyTorch ROCm natively supports WSL with gfx1030?

And the last question: What is antares torch-setup used for? What can I do with it?

Looong01 commented 1 year ago

So, you mean ROCm or PyTorch ROCm natively supports WSL with gfx1030?

  • Nop, you still a virtual stack, and I think no one has time to develop this currently.

And the last question: What is antares torch-setup used for? What can I do with it?

  • antares torch-setup is for Pytorch Linux only. In WSL environment, you Pytorch usually enable CPU device only, so antares torch-setup can extend CPU ops for that Pytorch.

Virtual stack? Like GPU-PV on Hyper-V that the virtual machine can use GPU directly? I have tried it, but it failed. It seems that Cross-OS GPU-PV does not exist (physical machine is Windows, and virtual machine is Ubuntu)