-
Notifications
You must be signed in to change notification settings - Fork 45
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
Usage with Rocm windows for hip code compilation and documentation #342
Comments
Have you installed with BTW, in wsl2, you need to install rocm compiler according to 'https://sep5.readthedocs.io/en/latest/Installation_Guide/Installation-Guide.html#performing-an-opencl-only-installation-of-rocm', making sure command |
it seems restarting ubuntu in wls2 helped, the BACKEND=c-rocm_win64 antares gave me [Antares] Incorrect compute kernel from evaluator. I havent installed the rocm compiler, i will proceed to do so |
Is this command working? /opt/rocm/bin/hipcc ~/.cache/antares/cache/_/my_kernel.cc --genco -O2 --amdgpu-target=gfx1031 -Wno-ignored-attributes -o /tmp/out.hsaco |
i haven't installed rocm yet, do i need to install a previous version?, or do i install the newest 5.1.1 which has support for gfx1030 |
|
These two packages |
That's great. Next you need to install an upgrade antares version. pip3 install --upgrade antares==0.3.13.1 # If it fails, it means the PYPI repo is not up-to-date, please re-run this command until it succeed.
# Then, try show the output for this command:
AMDGFX=gfx1031 BACKEND=c-rocm_win64 antares |
gfx1031 is possibly not the corresponding spec name for your GPU. Or your AMD driver for Windows is not up-to-date, or not in the worst case, not supporting this spec. |
how can i know? |
My GPU is an RX 6800m which it's pretty much a rx6700 xt with tdp limit of 145, ubuntu said it was a gfx 1031 when i installed it |
Please guess and try other numbers like 1030, 1010, etc. |
i have 2 amd gpu doe, the rx 6800m and a vega one that is integrated, do i need to specify that? |
What is the gfx number for the vega one? |
is there a command to check that? |
What is the full model name of Vega GPU? |
it literally just says amd radeon tm graphics, according to the wiki its a vega 8 gpu |
the rx6800m says it's navi22 XTM |
Maybe you can temporarily disable the Vega GPU in windows device manager for this test. |
i do not have a mux switch, i will try to select ubuntu or wsl to use the rx6800m |
Nop, rocminfo is not the suitable test command. I don't think the "new error" is related to our topic. After you disable Vega GPU in "Windows Device Manager", Please try: antares clean
AMDGFX=gfx1031 BACKEND=c-rocm_win64 antares |
i fear that if i disable it i won't have a screen input, since the vega 8 gpu is the one connected to the laptop display, not the rx6800m |
OK, since you don't know which GPU is the enabled one. Firstly please try which of the following typical spec settings can work: antares clean
AMDGFX=gfx803 BACKEND=c-rocm_win64 antares
AMDGFX=gfx900 BACKEND=c-rocm_win64 antares
AMDGFX=gfx902 BACKEND=c-rocm_win64 antares
AMDGFX=gfx906 BACKEND=c-rocm_win64 antares
AMDGFX=gfx908 BACKEND=c-rocm_win64 antares
AMDGFX=gfx1010 BACKEND=c-rocm_win64 antares
AMDGFX=gfx1030 BACKEND=c-rocm_win64 antares |
Nothing, not a single one worked |
does it affect that i'm, in wsl2? |
Please open this file via vim: vi ~/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/include/backend.hpp For the content, please fully replace the original init function with this updated function: void init(int dev) {
ab::hLibDll = LoadLibrary(AMDHIP64_LIBRARY_PATH);
CHECK(hLibDll, "Cannot find `" AMDHIP64_LIBRARY_PATH "` !\n");
int gpu_count = -1;
LOAD_ONCE(hipGetDeviceCount, int (*)(int*));
CHECK(0 == hipGetDeviceCount(&gpu_count), "Failed to run hipGetDeviceCount().");
fprintf(stderr, "@@ hipGetDeviceCount = %d\n", gpu_count);
LOAD_ONCE(hipSetDevice, int (*)(int));
CHECK(0 == hipSetDevice(dev), "Failed initialize AMD ROCm device with `" AMDHIP64_LIBRARY_PATH "` (No AMDGPU installed or enabled?).");
_current_device = dev;
} After saving, please re-run |
If you see |
2 means both 2 gpu will be supported. (Vega 8 and RX6700). Thus, you need to link to correct GPU ID and correct GFX number: Please re-open this file via vim: vi ~/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/include/backend.hpp Similarly, for the content, please fully replace the original init function with this updated function: void init(int dev) {
ab::hLibDll = LoadLibrary(AMDHIP64_LIBRARY_PATH);
CHECK(hLibDll, "Cannot find `" AMDHIP64_LIBRARY_PATH "` !\n");
LOAD_ONCE(hipSetDevice, int (*)(int));
CHECK(0 == hipSetDevice(1), "Failed initialize AMD ROCm device with `" AMDHIP64_LIBRARY_PATH "` (No AMDGPU installed or enabled?).");
_current_device = dev;
} After saving, please re-run The main difference is that this will use the 2nd GPU for a trial. |
|
How did you get "a hip error no binary"? The new change will in the wost case throw that error again. Can you re-update antares with "pip3 install antares --upgrade" (possibly multiple times if fails)? |
to get that error i did this
|
i managed to recreate it, i did "pip3 install antares --upgrade", then i ran AMDGFX=gfx1031 BACKEND=c-rocm_win64 antares, and i got this (ghostplant said:)OK, this is a good state, but the init function are reverted as well, you need to re-edit that into: void init(int dev) {
ab::hLibDll = LoadLibrary(AMDHIP64_LIBRARY_PATH);
CHECK(hLibDll, "Cannot find `" AMDHIP64_LIBRARY_PATH "` !\n");
LOAD_ONCE(hipSetDevice, int (*)(int));
CHECK(0 == hipSetDevice(1), "Failed initialize AMD ROCm device with `" AMDHIP64_LIBRARY_PATH "` (No AMDGPU installed or enabled?).");
_current_device = dev;
} |
Yes, it successful utilize RX6700 for computation. |
i have my kernel.hip.cpp and source .cpp files, how can i compile them? (i'm literally new to this) |
for example with rocm in ubuntu (no wsl) this would be the command /opt/rocm/hip/bin/hipcc source.cpp kernel.hip.cpp -o libbm3dhip.so -shared -fPIC -std=c++17 -O3 -I/home/comp/vapoursynth/include -Wno-unused-result --offload-arch=gfx1031 $(/opt/rocm/hip/bin/hipconfig --cxx_config), what do i change to do it with antares? |
This allows you execute Antares treats ROCm for Windows as a special-hardware backend, and can generate any IR-based efficient kernel to build up that |
Can native hip kernels be compiled in antares to run hip code in windows without the need of wsl? |
You need to compile the hip kernels in wsl since hipcc is from wsl only, After that, hipcc will produce HSACO binary code for AMDGPU, this file can be directly loaded by Win64 program and no need to use wsl. Briefly, you need wsl to compile all hip kernels to many HSACO files, and then you can detach wsl and write clean Win64 |
Please add more documentation. |
First, where is the documentation?, after installation in wsl2 it told me the command antares didn't exist, second i have my kernel.hip.cpp and source .cpp files, how could i compile that?, do i need to install rocm to compile it for gfx 1031?, or can antares compile that?
The text was updated successfully, but these errors were encountered: