ROCm / ROCm-Device-Libs

ROCm Device Libraries
97 stars 60 forks source link

[Issue]: hashcat HIP backend fails due to missing symbols #106

Closed sjnewbury closed 8 months ago

sjnewbury commented 8 months ago

Problem Description

When using the HIP backend of hashcat it fails with the following error:

-------------------
* Hash-Mode 0 (MD5)
-------------------

'+gws' is not a recognized feature for this target (ignoring feature)
'+gws' is not a recognized feature for this target (ignoring feature)
hiprtcCompileProgram(): HIPRTC_ERROR_COMPILATION

ld.lld: error: undefined hidden symbol: __ockl_get_group_id
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_memset)
>>> referenced 7 more times

ld.lld: error: undefined hidden symbol: __ockl_get_local_size
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_memset)
>>> referenced 7 more times

ld.lld: error: undefined hidden symbol: __ockl_get_local_id
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_decompress)
>>> referenced by /home/steve/.local/share/hashcat/comgr-4247ea/input/LLVMBitcode.bc.o:(gpu_memset)
>>> referenced 7 more times

* Device #1: Kernel /usr/share/hashcat/OpenCL/shared.cl build failed.

* Device #1: Kernel /usr/share/hashcat/OpenCL/shared.cl build failed.

I'm not sure if this is a bug in hashcat, or in ROCm. It did supposedly work with earlier versions of ROCm. The OpenCL backend works fine.

Operating System

Gentoo

CPU

Any

GPU

AMD Radeon Pro VII

ROCm Version

ROCm 6.0.0, ROCm 5.7.1

ROCm Component

ROCm-Device-Libs

Steps to Reproduce

Use hashcat benchmark mode "hashcat -b". "--backend-ignore-opencl" and/or "--backend-ignore-cuda" may be necessary depending upon system and enumeration order.

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

b-sumner commented 8 months ago

@sjnewbury not sure why this is a device libs issue? Those functions are defined. I suggest raising this issue with the hashcat developers.

sjnewbury commented 8 months ago

@b-sumner , those symbols are in ockl, which is part of device-libs. I guess hashcat are doing something wrong and need to link ockl somehow when calling hiprtcCompileProgram(). I did say I wasn't sure whose bug it is, only that it worked with old versions of ROCm. I'll continue to try to figure out how the linker is called from hashcat.

The bug has been reported there previously with hashcat, but didn't get any feedback, and the reporter closed the bug after getting it working with OpenCL. I'll see if I can get the bug reopened there if it's definitely not a problem on the ROCm side.

sjnewbury commented 8 months ago

Using -lockl was enough to make it work!

--- a/src/backend.c
+++ b/src/backend.c
@@ -8754,8 +8754,8 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p
       hiprtc_options[5] = "-I";
       */

-      hiprtc_options[1] = "-nocudainc";
-      hiprtc_options[2] = "-nocudalib";
+      hiprtc_options[1] = "-lockl";
+      hiprtc_options[2] = "";
       hiprtc_options[3] = "";
       hiprtc_options[4] = "";