MIOpen icon indicating copy to clipboard operation
MIOpen copied to clipboard

OpenCL backend does not build

Open DomWilliamsEE opened this issue 10 months ago • 3 comments

Hello,

We have a good amount of existing OpenCL code that is not trivial to port to HIP. I understand the OpenCL backend is deprecated, but there's an argument for keeping it compiling and working until it is fully dropped.

The main blocking build issue with -DMIOPEN_BACKEND=OpenCL is the following #error Unsupported backend here.

Another that is easier to work around is a possibly missing include:

/src/MIOpen/src/cat/problem_description.cpp:58:72: error: use of undeclared identifier 'short4'; did you mea
n 'short'?
   58 |     auto max_inner_size = max_x_dim_size * stride * data_size / sizeof(short4);
      |                                                                        ^~~~~~
      |                                                                        short
1 error generated.

DomWilliamsEE avatar Feb 12 '25 10:02 DomWilliamsEE

Hi @DomWilliamsEE. Internal ticket has been created to investigate this issue. Thanks!

ppanchad-amd avatar Feb 12 '25 14:02 ppanchad-amd

Hi @DomWilliamsEE. To fix your main blocking issue you could remove this line and then export MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3=0 to prevent execution of this code. This is not a fix, for experimental purposes only.

averinevg avatar Mar 04 '25 19:03 averinevg

Adding this leads to different errors. Full build log attached

opt/rocm-6.3.1/include/hip/hip_runtime.h:66:2: error: ("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
   66 | #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
      |  ^
In file included from /src/MIOpen/src/dropout_api.cpp:41:
In file included from /src/MIOpen/src/kernels/miopen_rocrand.hpp:45:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_xorwow.h:24:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_common.h:38:
In file included from /opt/rocm-6.3.1/include/hip/hip_runtime.h:70:
/opt/rocm-6.3.1/include/hip/hip_runtime_api.h:9342:2: error: ("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
 9342 | #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
      |  ^
/opt/rocm-6.3.1/include/hip/hip_runtime_api.h:9391:61: error: use of undeclared identifier 'hipHostMallocDefault'
 9391 |                                        unsigned int flags = hipHostMallocDefault) {
      |                                                             ^
/opt/rocm-6.3.1/include/hip/hip_runtime_api.h:9408:61: error: use of undeclared identifier 'hipHostAllocDefault'
 9408 |                                        unsigned int flags = hipHostAllocDefault) {
      |                                                             ^
/opt/rocm-6.3.1/include/hip/hip_runtime_api.h:9427:61: error: use of undeclared identifier 'hipMemAttachGlobal'
 9427 |                                        unsigned int flags = hipMemAttachGlobal) {
      |                                                             ^
In file included from /src/MIOpen/src/dropout_api.cpp:41:
In file included from /src/MIOpen/src/kernels/miopen_rocrand.hpp:45:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_xorwow.h:24:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_common.h:38:
In file included from /opt/rocm-6.3.1/include/hip/hip_runtime.h:71:
/opt/rocm-6.3.1/include/hip/library_types.h:77:2: error: ("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
   77 | #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
      |  ^
In file included from /src/MIOpen/src/dropout_api.cpp:41:
In file included from /src/MIOpen/src/kernels/miopen_rocrand.hpp:45:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_xorwow.h:24:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_common.h:38:
In file included from /opt/rocm-6.3.1/include/hip/hip_runtime.h:73:
/opt/rocm-6.3.1/include/hip/hip_vector_types.h:38:2: error: ("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
   38 | #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
      |  ^
In file included from /src/MIOpen/src/dropout_api.cpp:41:
In file included from /src/MIOpen/src/kernels/miopen_rocrand.hpp:45:
In file included from /opt/rocm-6.3.1/include/rocrand/rocrand_xorwow.h:24:
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:116:1: error: unknown type name '__forceinline__'
  116 | __forceinline__ __device__ __host__ unsigned long long
      | ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:116:27: error: expected ';' after top level declarator
  116 | __forceinline__ __device__ __host__ unsigned long long
      |                           ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:159:12: error: unknown type name '__forceinline__'
  159 |     static __forceinline__ __device__ __host__ bool has_float(const Engine* engine)
      |            ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:159:38: error: expected ';' at end of declaration list
  159 |     static __forceinline__ __device__ __host__ bool has_float(const Engine* engine)
      |                                      ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:195:1: error: unknown type name '__forceinline__'
  195 | __forceinline__ __device__ __host__ void split_ull(T& lo, T& hi, unsigned long long int val);
      | ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:195:27: error: expected ';' at end of declaration
  195 | __forceinline__ __device__ __host__ void split_ull(T& lo, T& hi, unsigned long long int val);
      |                           ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:195:28: error: unknown type name '__host__'
  195 | __forceinline__ __device__ __host__ void split_ull(T& lo, T& hi, unsigned long long int val);
      |                            ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:195:52: error: unknown type name 'T'
  195 | __forceinline__ __device__ __host__ void split_ull(T& lo, T& hi, unsigned long long int val);
      |                                                    ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:195:59: error: unknown type name 'T'
  195 | __forceinline__ __device__ __host__ void split_ull(T& lo, T& hi, unsigned long long int val);
      |                                                           ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:198:1: error: unknown type name '__forceinline__'
  198 | __forceinline__ __device__ __host__ void
      | ^
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:197:1: error: extraneous 'template<>' in declaration of variable '__device__'
  197 | template<>
      | ^~~~~~~~~~
/opt/rocm-6.3.1/include/rocrand/rocrand_common.h:198:27: error: expected ';' at end of declaration
  198 | __forceinline__ __device__ __host__ void
      |                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

DomWilliamsEE avatar Mar 07 '25 07:03 DomWilliamsEE

This issue has been migrated to: https://github.com/ROCm/rocm-libraries/issues/887

Imported to ROCm/rocm-libraries

ammallya avatar Jul 28 '25 20:07 ammallya