OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomese-simd commits / e3bee54

Check scalar types too.
Scalars are exactly where the mistakes will be most likely to happen.
e3bee54ef4fc2e8ada18f24a411df82b32b5955b
by Linas Vepštas <linasvepstas@gmail.com> · 2025-09-12T04:35:13.000Z

Changed files (1) +12 -4

opencog/atoms/opencl/OpenclJobValue.cc +12 -4
……@@ -243,7 +243,7 @@ void OpenclJobValue::check_signature(const Handle& kern,
243243 const Handle& iface,
244244 const ValueSeq& flovecs)
245245{
246 // iface is a ConnectorSeq oc Connectors
246 // iface is a ConnectorSeq of Connectors
247247 if (flovecs.size() != iface->size())
248248 throw RuntimeException(TRACE_INFO,
249249 "Expected %zu arguments, got %zu for %s",
……@@ -254,13 +254,21 @@ void OpenclJobValue::check_signature(const Handle& kern,
254254 {
255255 TypeNodePtr typ = TypeNodeCast(cons[i]->getOutgoingAtom(0));
256256
257 if (not flovecs[i]->is_type(typ->get_kind()) and
258 not flovecs[i]->is_type(CONNECTOR))
257 // Is it a FloatValue?
258 bool is_ok = flovecs[i]->is_type(typ->get_kind());
259
260 // If not, is it a scalar?
261 if (not is_ok)
259262 {
263 Handle sex = cons[i]->getOutgoingAtom(1);
264 is_ok = flovecs[i]->is_type(CONNECTOR) and
265 (0 == sex->get_name().compare("scalar"));
266 }
267
268 if (not is_ok)
260269 throw RuntimeException(TRACE_INFO,
261270 "Argument type mismatch at %zu: expected type %s for %s",
262271 i, typ->to_string().c_str(), kern->to_string().c_str());
263 }
264272 }
265273}
266274