| … | … | @@ -215,28 +215,26 @@ void OpenclJobValue::build(const Handle& oclno) |
| 215 | 215 | |
| 216 | 216 | std::string kname = get_kern_name(); |
| 217 | 217 | |
| 218 | | // Get our program from the OpenclNode. |
| 219 | | const cl::Program& proggy = OpenclNodeCast(oclno)->get_program(); |
| 220 | | |
| 221 | | // If the user mistyped the kernel name, the `cl:Kernel` will |
| 222 | | // throw an exception that is not meaningful to most users. |
| 223 | | // Rewrite it to Atomese standard. |
| 224 | | try |
| 225 | | { |
| 226 | | _kernel = cl::Kernel(proggy, kname.c_str()); |
| 227 | | } |
| 228 | | catch (const std::exception& ex) |
| 229 | | { |
| 218 | // See if its a kernel that we know. |
| 219 | // XXX FIXME this will fail for SPV files, because we don't |
| 220 | // (yet) generate signatures for them. |
| 221 | OpenclNodePtr ocn = OpenclNodeCast(oclno); |
| 222 | AtomSpace* as = ocn->getAtomSpace(); |
| 223 | Handle kit = as->add_node(ITEM_NODE, std::string(kname)); |
| 224 | const HandleMap& ifmap = ocn->_kernel_interfaces; |
| 225 | if (ifmap.find(kit) == ifmap.end()) |
| 230 | 226 | throw RuntimeException(TRACE_INFO, |
| 231 | | "Unknown kernel name \"%s\" given to %s\n", kname.c_str(), ex.what()); |
| 232 | | } |
| 227 | "This OpenclNode does not know about the kernel \"%s\"\n", |
| 228 | kname.c_str()); |
| 229 | |
| 230 | // Get our kernel from the program from the OpenclNode. |
| 231 | const cl::Program& proggy = ocn->get_program(); |
| 232 | _kernel = cl::Kernel(proggy, kname.c_str()); |
| 233 | 233 | |
| 234 | 234 | // Build the OpenclJobValue itself. |
| 235 | 235 | ValueSeq flovecs = make_vectors (oclno); |
| 236 | 236 | ValuePtr args = createLinkValue(flovecs); |
| 237 | | AtomSpace* as = oclno->getAtomSpace(); |
| 238 | | Handle kh = as->add_node(ITEM_NODE, std::move(kname)); |
| 239 | | _value = ValueSeq{kh, args}; |
| 237 | _value = ValueSeq{kit, args}; |
| 240 | 238 | |
| 241 | 239 | // Bind the kernel to the kernel arguments |
| 242 | 240 | size_t pos = 0; |