Khanattila / KNLMeansCL

An optimized OpenCL implementation of the Non-local means de-noising algorithm
GNU General Public License v3.0
107 stars 22 forks source link

clc compile error with OCL 1.2 #25

Closed Zeght closed 7 years ago

Zeght commented 7 years ago
 OpenCL Platform
------------------------------------------------------------
 CL_PLATFORM_VENDOR:                Advanced Micro Devices, Inc.
 CL_PLATFORM_NAME:                  AMD Accelerated Parallel Processing
 CL_PLATFORM_VERSION:               OpenCL 1.2 AMD-APP (1084.4)
 CL_PLATFORM_PROFILE:               FULL_PROFILE

 OpenCL Device
------------------------------------------------------------
 CL_DEVICE_VENDOR:                  Advanced Micro Devices, Inc.
 CL_DEVICE_NAME:                    Redwood
 CL_DRIVER_VERSION:                 1084.4 (VM)
 CL_DEVICE_VERSION:                 OpenCL 1.2 AMD-APP (1084.4)
 CL_DEVICE_PROFILE:                 FULL_PROFILE
 CL_DEVICE_IMAGE_SUPPORT:           1
 CL_DEVICE_IMAGE2D_MAX_WIDTH:       16384
 CL_DEVICE_IMAGE2D_MAX_HEIGHT:      16384
 CL_DEVICE_IMAGE_MAX_ARRAY_SIZE:    2048

 Program Build
------------------------------------------------------------
 CL_PROGRAM_BUILD_ERROR:            CL_BUILD_PROGRAM_FAILURE
 CL_PROGRAM_BUILD_OPTIONS:          -cl-single-precision-constant
                                    -cl-denorms-are-zero
                                    -cl-fast-relaxed-math
                                    -Werror        
                                    -D NLM_CLIP_TYPE_UNORM
                                    -D NLM_CLIP_REF_LUMA
                                    -D NLM_WMODE_WELSCH
                                    -D VI_DIM_X=640
                                    -D VI_DIM_Y=480
                                    -D HRZ_RESULT=1
                                    -D VRT_RESULT=1        
                                    -D HRZ_BLOCK_X=32
                                    -D HRZ_BLOCK_Y=8
                                    -D VRT_BLOCK_X=32
                                    -D VRT_BLOCK_Y=8        
                                    -D NLM_D=1
                                    -D NLM_S=4
                                    -D NLM_H=1.200000
                                    -D NLM_WREF=1.000000
 CL_PROGRAM_BUILD_LOG:              
"C:\Users\Admin\AppData\Local\Temp\OCL5FA7.tmp.cl", line 142: error: function
          "amd_max3" declared implicitly
     U5[gidx]    = amd_max3(u4, u4_mq, U5[gidx]);                                                                  
                   ^

1 error detected in the compilation of "C:\Users\Admin\AppData\Local\Temp\OCL5FA7.tmp.cl".

Internal error: clc compiler invocation failed.

 RETURN:                            0

#ifndef cl_amd_media_ops2 part of code detects cl_amd_media_ops2 as defined and won't define amd_max3 but you still need to enable cl_amd_media_ops2

Can be solved by using

#ifndef cl_amd_media_ops2
#  define amd_max3(a, b, c)   fmax(a, fmax(b, c))
#else
#  pragma OPENCL EXTENSION cl_amd_media_ops2 : enable
#endif
Khanattila commented 7 years ago

It should not have been necessary because the extension is enable by default.