ROCm / HIP

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

[Issue]: Nvidia HIP runtime API returning pointer to local variable #3646

Closed flg closed 1 month ago

flg commented 1 month ago

Problem Description

I get a number of compilation warnings when compiling for NVIDIA HIP platform.

The majority is not too worrying like these deprecated:

/opt/rocm-6.2.2/include/hip/nvidia_detail/nvidia_hip_runtime_api.h:3570:46: warning: ‘CUresult cuTexRefSetFlags(CUtexref, unsigned int)’ is deprecated [-Wdeprecated-declarations]
 3570 |     return hipCUResultTohipError(cuTexRefSetFlags(hTexRef,Flags));
      |                              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

Some are more concerning like these returning pointer to local variable:

/opt/rocm-6.2.2/include/hip/nvidia_detail/nvidia_hip_runtime_api.h(508): warning #1056-D: returning pointer to local variable
      return &a;
             ^

I can't imagine a context in which returning a pointer to a local variable actually makes sense.

Are those expected? Is there a work-around ? A fix ?

Operating System

Red Hat Enterprise Linux 9.4 (Plow)

CPU

Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz

GPU

Nvidia Tesla T4 (TU104GL)

ROCm Version

ROCm 6.2.2

ROCm Component

HIP

Steps to Reproduce

No response

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

No response

Additional Information

No response

huanrwan-amd commented 1 month ago

@flg Thanks for your comments, this was fixed in https://github.com/ROCm/hipother/commit/1287d7e4a652ba552e392330e65adf1697e0d849 If you have further comments, please let us know.

flg commented 1 month ago

Thanks. Do you know when we can hope to have this included in an official release? I'm not familiar with ROCm release cycle.

huanrwan-amd commented 1 month ago

@flg You can expect it in the next release.

flg commented 1 month ago

Thanks