ROCm / HIP

HIP: C++ Heterogeneous-Compute Interface for Portability
https://rocmdocs.amd.com/projects/HIP/
MIT License
3.54k stars 518 forks source link

[Issue]: use of overloaded operator '/' is ambiguous (with operand types 'float2' (aka 'HIP_vector_type<float, 2>') and 'float2') #3510

Closed Vishal-S-P closed 3 weeks ago

Vishal-S-P commented 3 weeks ago

Problem Description

I am trying to HIPIFY the CUDA code using CUDAExtension. Here is the CUDA source https://github.com/nerfstudio-project/nerfacc/tree/master/nerfacc/cuda. Following is my step.py file -

setup.txt

Here is the hipied file - utils_math_hip.txt

I keep encountering this issue in the converted hip files -

/dockerx/nerfacc/nerfacc/cuda/csrc/include/utils_math_hip.cuh:1458:36: error: use of overloaded operator '/' is ambiguous (with operand types 'float2' (aka 'HIP_vector_type<float, 2>') and 'float2') 1458 | float2 y = clamp(float2(x - a) / float2(b - a), float2(0.0f, 0.0f), float2(1.0f, 1.0f));

Operating System

Ubuntu 22.04.4

CPU

AMD EPYC 7773X 64-Core Processor

GPU

AMD Instinct MI250X

ROCm Version

ROCm 6.1.0

ROCm Component

HIPIFY

Steps to Reproduce

No response

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

No response

Additional Information

No response

mangupta commented 3 weeks ago

The CUDA code that you are trying to hipify adds operators for the CUDA/HIP vector types. See https://github.com/nerfstudio-project/nerfacc/blob/master/nerfacc/cuda/csrc/include/utils_math.cuh#L975-L1052. While CUDA does not provide any operators for the vector types, HIP has implemented operators for these vector types. See https://github.com/ROCm/clr/blob/develop/hipamd/include/hip/amd_detail/amd_hip_vector_types.h. So the only solution is to disable the operators in your cuda/hip code.

Vishal-S-P commented 3 weeks ago

Thank you!!. Commenting out the code related to operators solved the issue.