RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.73k stars 160 forks source link

HIP: enable support for ROCm 6 #206

Closed GZGavinZhao closed 2 months ago

GZGavinZhao commented 3 months ago

Currently, when building oidn against ROCm 6, the following error occurs:

<dir>/oidn/devices/hip/hip_device.cpp:202:20: error: no member named 'memoryType' in 'hipPointerAttribute_t'
    switch (attrib.memoryType)
            ~~~~~~ ^
<dir>/oidn/devices/hip/hip_device.cpp:202:20: error: no member named 'memoryType' in 'hipPointerAttribute_t'
    switch (attrib.memoryType)
            ~~~~~~ ^
<dir>/oidn/devices/hip/hip_device.cpp:202:20: error: no member named 'memoryType' in 'hipPointerAttribute_t'
    switch (attrib.memoryType)
            ~~~~~~ ^
<dir>/oidn/devices/hip/hip_device.cpp:202:20: error: no member named 'memoryType' in 'hipPointerAttribute_t'
    switch (attrib.memoryType)
            ~~~~~~ ^

This is because of a breaking API change documented here. The field is now attr.type. This PR aims to allow building oidn against both ROCm 5 and 6 by conditionally switching between attr.memoryType and attr.type at compile time based on HIP's major version reported by CMake.

Ran all HIP tests locally on gfx1032 (emulated as gfx1030) and passed.

atafra commented 2 months ago

Thanks. Introducing a macro definition isn't necessary though. It's now fixed in devel.