If it helps, this is packaged in Fedora:

https://koji.fedoraproject.org/koji/buildinfo?buildID=1131711

Though current hardware I  tested on does not have half2 support, errors I get when trying to compile using:

g++ testHalf.cpp -o testHalf -lOpenCL


testHalf.cpp:6:1: error: ‘__fp16’ does not name a type; did you mean ‘._116’?
 __fp16 Add( __fp16 a, __fp16 b ) {
 ^~~~~~
 ._116
testHalf.cpp: In function ‘int main(int, char**)’:
testHalf.cpp:67:2: error: ‘__fp16’ was not declared in this scope
  __fp16 a = 3.5;
  ^~~~~~
testHalf.cpp:67:2: note: suggested alternative: ‘._116’
  __fp16 a = 3.5;
  ^~~~~~
  ._116
testHalf.cpp:68:37: error: ‘a’ was not declared in this scope
  printf("return  %f \n", (float)Add(a, 0.53) );
                                     ^
testHalf.cpp:68:33: error: ‘Add’ was not declared in this scope
  printf("return  %f \n", (float)Add(a, 0.53) );
                                 ^~~
testHalf.cpp:87:85: warning: ‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)’ is deprecated [-Wdeprecated-declarations]  mand_queue  cmdQueue = clCreateCommandQueue(context_id, device_id, 0, &status);
^

In file included from testHalf.cpp:3:
/usr/include/CL/cl.h:1443:1: note: declared here
 clCreateCommandQueue(cl_context                     /* context */,
 ^~~~~~~~~~~~~~~~~~~~
testHalf.cpp:87:85: warning: ‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int*)’ is deprecated [-Wdeprecated-declarations]  mand_queue  cmdQueue = clCreateCommandQueue(context_id, device_id, 0, &status);
^

In file included from testHalf.cpp:3:
/usr/include/CL/cl.h:1443:1: note: declared here
 clCreateCommandQueue(cl_context                     /* context */,
 ^~~~~~~~~~~~~~~~~~~~
testHalf.cpp:90:8: error: expected ‘;’ before ‘host’
  __fp16 host[4] = {0.3, 4.8, 2.5, 3.1};
        ^~~~~
        ;
testHalf.cpp:91:83: error: ‘host’ was not declared in this scope
  clCreateBuffer(context_id,  CL_MEM_READ_WRITE, sizeof(__fp16) * 4, host, &status);
^~~~

testHalf.cpp:91:83: note: suggested alternative: ‘short’
  clCreateBuffer(context_id,  CL_MEM_READ_WRITE, sizeof(__fp16) * 4, host, &status);
^~~~
short

On 08/12/2018 11:08 PM, Michal Babej wrote:

Hello,


Pocl_version 0.13 + llvm 3.8 are both VERY old. I would be surprised if half type works there, especially in combination with 64bit ARM. I recommend you get LLVM 6 and pocl at least 1.1, otherwise you'll experience problems.


Regards,

-- mb


------------------------------------------------------------------------
*From:* Wuweijia <[email protected]>
*Sent:* Monday, August 13, 2018 5:33:46 AM
*To:* Portable Computing Language development discussion
*Cc:* Fanbohao
*Subject:* [pocl-devel] 【Hi】 There is Question about half2

Hi:

     I write the opencl demo. In this demo , I wrote the half2 type .  But it compile it failed.

   The output as below:

                2018-07-13 03:24:42.805561780] POCL: in fn void pocl_incr_device_ref() at line 294:

*** INFO ***  [GPUStub] void pocl_incr_device_ref() devices_ref=2

### use a saved llvm::Module

### fetching kernel metadata for kernel testHalf program 0x7f80a43000 input llvm::Module 0x7f80bf9580

[2018-07-13 03:24:42.805712080] POCL: in fn cl_mem POclCreateBuffer(cl_context, cl_mem_flags, size_t, void *, cl_int *) at line 94:

[2018-07-13 03:24:42.805752880] POCL: in fn cl_int POclEnqueueNDRangeKernel(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) at line 133:

*** INFO ***  Preferred WG size multiple 8

[2018-07-13 03:24:42.805786020] POCL: in fn cl_int POclEnqueueNDRangeKernel(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) at line 209:

*** INFO ***  Queueing kernel testHalf with local size 1 x 1 x 1 group sizes 3 x 1 x 1...

### calling the kernel compiler for kernel testHalf local_x 1 local_y 1 local_z 1 parallel_filename: /sdcard/pocl/kcache/HK/BOCDHECGLACEHDFDNAGEMLIFMJJKNKIKKHGMB/testHalf/1-1-1/parallel.bc

### cloning the preloaded LLVM IR

[2018-07-13 03:24:42.806801840] POCL: in fn llvm::Module *kernel_library(cl_device_id) at line 1341:

*** INFO ***  Using /data/data/org.pocl.libs/files/share/pocl/kernel-aarch64-unknown-linux-android-generic.bc as the built-in lib.

### autovectorizer enabled

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop: .lr.ph.i

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop:

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop:

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop:

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop:

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Found a loop:

LV: Can't if-convert the loop.

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Not vectorizing: Cannot prove legality.

LV: Checking a loop in "_cl_printf" from /sdcard/pocl/kcache/temp_t6kfN4.cl

LV: Loop hints: force=? width=0 unroll=0

LV: Not vectorizing: Cannot prove legality.

/usr1/code/source/pocl/llvm-3.8.0.src/lib/Bitcode/Writer/ValueEnumerator.h:132: unsigned int llvm::ValueEnumerator::getTypeID(llvm::Type*) const: assertion "I != TypeMap.end() && "Type not in ValueEnumerator!"" failed

libc: /usr1/code/source/pocl/llvm-3.8.0.src/lib/Bitcode/Writer/ValueEnumerator.h:132: unsigned int llvm::ValueEnumerator::getTypeID(llvm::Type*) const: assertion "I != TypeMap.end() && "Type not in ValueEnumerator!"" failed

the test is abort now; I have add it ” pragma OPENCL EXTENSION cl_khr_fp16 : enable” to cl file  but it still faled

Env:

                CPU: AARCH64

                OS: LINUX / android

                Pocl_version 0.13 + llvm 3.8

                GPU: no



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to