Error when executing code targeted to opencl

I get the following error when executing simple code targeted at opencl. This is after I have installed a new opencl platform called pocl. Furthermore this error occurs even I if just use llvm target and cpu I cant figure out why ?.

This is the code that produced the error.

import tvm 
from tvm import te
import numpy as np

n = te.var("n") 
A = te.placeholder((n,),name = 'A') 
B = te.placeholder((n,),name = 'B') 
C = te.compute(A.shape,lambda i: A[i] + B[i], name = 'C')

s = te.create_schedule(C.op)

bx, tx = s[C].split(C.op.axis[0], factor = 64)

s[C].bind(bx, te.thread_axis("blockIdx.x")) 
s[C].bind(tx, te.thread_axis("threadIdx.x"))

fadd_cl = tvm.build(s, [A,B,C], target= 'opencl' , name = "myadd")

ctx = tvm.opencl()

n = 1024 
a = tvm.nd.array(np.random.uniform(size=n).astype(A.dtype), ctx) 
b = tvm.nd.array(np.random.uniform(size=n).astype(B.dtype), ctx) 
c = tvm.nd.array(np.zeros(n, dtype=C.dtype), ctx) 
fadd_cl(a,b,c) 
np.testing.assert_allclose(c.asnumpy(), a.asnumpy() + b.asnumpy())

I got this error before. It was caused by LLVM returning a generic target triple as the default triple. Indeed TVM asks LLVM for the default target triple during compilation and I guess that LLVM has it set to generic and does not have a codegen for it.

A fast fix is to specify which triple TVM will use in the target string if you target the CPU, or in the target host. It should look like “llvm -mtriple=x86_64-unknown-linux” if you use linux. In order to properly fix it you may want to change the LLVM library that is linked to TVM in order to use one that has the default triple corresponding to your hardware.

Hey @aurel333 thanks , Like you said the llvm which I used to build tvm was the wrong one.