HIP plugin fails to load due to missing symbols

HIP plugin fails to load for me due to missing symbols:

~ SYCL_PI_TRACE=-1 sycl-ls
SYCL_PI_TRACE[-1]: dlopen(/opt/intel/oneapi/compiler/2023.2.0/linux/lib/libpi_hip.so) failed with </opt/intel/oneapi/compiler/2023.2.0/linux/lib/libpi_hip.so: undefined symbol: _Z23hipDestroySurfaceObjectP13__hip_surface, version hip_4.2>
SYCL_PI_TRACE[all]: Check if plugin is present. Failed to load plugin: libpi_hip.so

libamdhip64.so contains this symbol without name mangling:

~ readelf -sW /opt/rocm/lib/libamdhip64.so | rg hipDestroySurface
   397: 000000000025bf40  2439 FUNC    GLOBAL DEFAULT   10 hipDestroySurfaceObject@@hip_4.2
1 Like

Hi, what’s your HIP version? Is it 4.2 as the printout suggests? I’m afraid 4.2 isn’t one of the supported versions for our plugins. See the version compatibility information here:

We currently support only versions between 4.5.x and 5.4.x.

Is it 4.2 as the printout suggests?

FWIW, I checked, and see the same @hip_4.2 suffix in all ROCm versions I have available, from 4.5.2 to 5.7.0. I have the exactly same output as OP with ROCm 4.5.2 and 5.7.0; but the _Z23hipDestroySurfaceObjectP13__hip_surface symbol is present in ROCm 5.3 to 5.6.

P.S.: As an ugly hack, a user can mess with LD_PRELOAD to add stubs for the missing _Z23hipDestroySurfaceObjectP13__hip_surface and _Z22hipCreateSurfaceObjectPP13__hip_surfacePK15hipResourceDesc functions and hope they are not called (at least, it worked for my ROCm 5.7 with oneAPI 2024.0 well enough to run a simple test app). But improving compatibility of the released binary would be better, IMO :slight_smile:

I am using ROCm 5.7.
Thanks for the clarification about which symbols are defined in which library version, al42and.
For now, the easiest solution for me was to compile DPC++ from source with HIP support enabled.

Thank you for checking this. This is consistent with our testing - we test ROCm 5.4.3 for this plugin version, which is in between 5.3 and 5.6. We know that this plugin version can work with a wider range of ROCm versions, but unfortunately we cannot currently test all of them and ROCm binary interfaces seem to change quite frequently.

Please note we also have another version of the plugin available at developer.codeplay.com, which is tested for ROCm 4.5.2 and should work for a range of ROCm versions around that.
image


ROCm 4.5.2 should work with the 4.5.2 plugin. When using the 5.4.3 plugin and ROCm 4.5.2, the error is expected as the ROCm versions have incompatible binaries. Similarly, ROCm versions from 5.5 and above are currently unsupported by our binary plugin releases (as mentioned in the guide).

We will look into updating the supported versions with future oneAPI releases. Compiling from source is also a good option like @attractadore did. There are also daily binary releases of the open source compiler, which have the CUDA and HIP support enabled: