You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Akhil via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/10/01 03:06:49 UTC

[Apache TVM Discuss] [Questions] Topi.sqrt and other functions throwing an error in opencl target


Hey I was trying to execute the functions given in topi (https://tvm.apache.org/docs/api/python/topi.html) using opencl target but only the ceil and floor operations seem to work the rest throws an error in tvm.

Here is my code.

> import tvm
>
> from tvm import te, topi
> 
> import numpy as np
> 
> n = 8
> 
> A = te.placeholder((n,), name="A", dtype="int32")
> 
> B = topi.sqrt(A)
> 
> s = te.create_schedule(B.op)
> 
> x = s[B].op.axis[0]
> 
> xo, x1 = s[B].split(x, factor = 4)
> s[B].bind(xo, te.thread_axis("blockIdx.x"))
> 
> s[B].bind(x1, te.thread_axis("threadIdx.x"))
> 
> a_np = np.array([1, 2, 3, 4, 5, 6, 7, 8]).astype(np.int32)
> 
> b_np = np.random.uniform(size=(n,)).astype(np.int32)
> 
> target, ctx = 'opencl', tvm.context("opencl")
> 
> a_tvm = tvm.nd.array(a_np, ctx=ctx)
> 
> b_tvm = tvm.nd.array(b_np, ctx=ctx)
> 
> func = tvm.build(s, [A, B], target)
> 
> func(a_tvm, b_tvm)
> 
> print(b_tvm)

and the error is as follows

> Traceback (most recent call last):
>   File "ex.py", line 27, in <module>
>     func(a_tvm, b_tvm)
>   File "/home/akhil/Downloads/RedefineTVM/tvm/python/tvm/runtime/module.py", line 110, in __call__
>     return self.entry_func(*args)
>   File "/home/akhil/Downloads/RedefineTVM/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 225, in __call__
>     raise get_last_ffi_error()
> tvm._ffi.base.TVMError: Traceback (most recent call last):
>   [bt] (2) /home/akhil/Downloads/RedefineTVM/tvm/build/libtvm.so(TVMFuncCall+0x65) [0x7f1324be4ea5]
>   [bt] (1) /home/akhil/Downloads/RedefineTVM/tvm/build/libtvm.so(+0x1768200) [0x7f1324bfa200]
>   [bt] (0) /home/akhil/Downloads/RedefineTVM/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x82) [0x7f13240e9c82]
>   File "/home/akhil/Downloads/RedefineTVM/tvm/src/runtime/opencl/opencl_module.cc", line 220
>   File "/home/akhil/Downloads/RedefineTVM/tvm/src/runtime/library_module.cc", line 79
> TVMError: Check failed: ret == 0 (-1 vs. 0) : OpenCL build error for device=0x7f131ea0e0c0stringInput.cl:2:89: error: call to 'sqrt' is ambiguous
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:85:20: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:184:19: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1431:21: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1432:21: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1433:21: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1434:21: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1435:22: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1436:20: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1437:20: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1438:20: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1439:20: note: candidate function
> /usr/lib/x86_64-linux-gnu/beignet/include/ocl_math.h:1440:21: note: candidate function





---
[Visit Topic](https://discuss.tvm.apache.org/t/topi-sqrt-and-other-functions-throwing-an-error-in-opencl-target/8052/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/78c447e6b0850ecf0192ff5a15e6282e0ee1562d5eb9fbe975c2fb1ac8377c12).