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
449 stars 46 forks source link

Assertion error: SDK for `c-rocm_win64` is not configured correctly, #370

Open harish0201 opened 1 year ago

harish0201 commented 1 year ago

Hi!

I've installed the ROCm drivers on my laptop which has 6800M (gfx1031). I came across this repo while I was trying to see if I could get the various tensile libraries compiled using WSL. I have both WSL1 (ubuntu 20.04) and 2 (ubuntu 22.04) with the rocm-dev, rocm-core and rocm-hip-libraries installed.

I can see the dlls: amdhip64 and amdhik64 at System32 location.

When I try to do: AMDGFX=gfx1031 BACKEND=c-rocm_win64 antares. I keep getting this error: AssertionError: SDK forc-rocm_win64is not configured correctly, please look into the error messages and reconfigure the corresponding environment.

How should I resolve it?

Thank you!

ghostplant commented 1 year ago

Can you paste the full logs? I assume some important errors explain what is missing in your environment. For ROCm Win64, you need WSL + ROCm in WSL installed at least.

harish0201 commented 1 year ago

Hi!

Here is the error when I run: AMDGFX=gfx1031 BACKEND=c-rocm_win64 antares

Antares was installed with pip install --upgrade antares


[EvalAgent] Compiling Evaluator: x86_64-w64-mingw32-g++ /home/harish/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/../../graph_evaluator/run_graph.cpp -o /home/harish/.cache/antares/evaluator.c-rocm_win64.tmp -D__BACKEND__=\"c-rocm_win64\" -D__BACKEND_rocm_win64__ -std=c++17 -Wno-string-compare -Wno-unused-result -Wno-unused-value -O2 -static -lpthread -I/home/harish/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/include
/home/harish/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/../../graph_evaluator/run_graph.cpp: In function ‘void* memory_alloc(size_t)’:
/home/harish/.local/lib/python3.8/site-packages/antares_core/backends/c-rocm_win64/../../graph_evaluator/run_graph.cpp:14:29: error: ‘memalign’ was not declared in this scope
   14 |     void *data_ptr = (void*)memalign(256, length);
      |                             ^~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-string-compare’

Traceback (most recent call last):
  File "./antares/antares_compiler.py", line 790, in <module>
    main_compute()
  File "./antares/antares_compiler.py", line 676, in main_compute
    eval_client.init(backend_root=backend_root)
  File "/home/harish/.local/lib/python3.8/site-packages/antares_core/graph_evaluator/client.py", line 63, in init
    assert compile_stat == 0, error_info
AssertionError: SDK for `c-rocm_win64` is not configured correctly, please look into the error messages and reconfigure the corresponding environment.

Powershell path on windows:

C:\Program Files\Microsoft\jdk-17.0.6.10-hotspot\bin                                                                    
C:\WINDOWS\system32                                                                                                     
C:\WINDOWS                                                                                                              
C:\WINDOWS\System32\Wbem                                                                                                
C:\WINDOWS\System32\WindowsPowerShell\v1.0\                                                                             
C:\WINDOWS\System32\OpenSSH\                                                                                            
C:\Program Files (x86)\ZeroTier\One\                                                                                    
C:\Program Files\dotnet\                                                                                                
C:\Program Files\CMake\bin                                                                                              
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\                                                     
C:\Users\Harish\AppData\Local\Microsoft\WindowsApps                                                                     
C:\Users\Harish\AppData\Local\Microsoft\WinGet\Links                                                                    
C:\Program Files\AMD\ROCm\5.5\bin                                                                                       

Here is the amd*.dll: image

On windows the installer was obtained from: https://rocm.docs.amd.com/en/develop/deploy/windows/index.html

lsb_release in wsl1:

harish@Zircon-AAE:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

Rocm in wsl were installed with: sudo apt install rocm-hip-libraries rocm-dev rocm-core

and finally, hpicc version

harish@Zircon-AAE:~$ hipcc --version
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
HIP version: 5.6.31061-8c743ae5d
AMD clang version 16.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-5.6.0 23243 be997b2f3651a41597d7a41441fff8ade4ac59ac)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-5.6.0/llvm/bin
harish0201 commented 1 year ago

I was able to get it working! Just needed to do sudo ldconfig.

Running: AMDGFX=gfx1031 BACKEND=c-rocm_win64 COMPUTE_V1='- einstein_v2("output0[N] = input0[N] + input1[N]", input_dict={"input0": {"dtype": "float32", "shape": [1024 * 512]}, "input1": {"dtype": "float32", "shape": [1024 * 512]}})' antares save kernel0.hip.cc

Give this:

[EvalAgent] Evaluating Modules .. (with backend = c-rocm_win64)
\+ /opt/rocm/bin/hipcc /tmp/.antares-module-tempfile.cu --amdgpu-target=gfx1031 --genco -Wno-ignored-attributes -O2 -o /tmp/.antares-module-tempfile.cu.out
Warning: The --amdgpu-target option has been deprecated and will be removed in the future.  Use --offload-arch instead.

[EvalAgent] Results = {"K/0": 1504583185.0, "TPR": 0.000247574}

[Antares] Average time cost / run = 0.000247574 sec, 2.1177 gflops. (Checked: None)

Following the issue from this thread also seems to have helped: https://github.com/microsoft/antares/issues/345