OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomese-simd commits / 353d62b

Add documentation
353d62bfa5e17c5e781605ac03a34515ad5310b9
by Linas Vepštas <linasvepstas@gmail.com> · 2025-09-12T04:27:58.000Z

Changed files (1) +34 -11

opencog/atoms/opencl/OpenclJobValue.cc +34 -11
……@@ -208,9 +208,40 @@ OpenclJobValue::make_vectors(const Handle& oclno)
208208
209209// ==============================================================
210210
211void
212OpenclJobValue::check_signature(const Handle& kern, const Handle& iface,
213 const ValueSeq& flovecs)
211/// Perform some rudimentary type checking. It's rudimentary mostly
212/// because the only thing we deal wit right now are just float pt
213/// vectors, and never strings, or anything complicated. So far.
214///
215/// This is potentially useful, because, well .. although the current
216/// demos are quite simple, if there is a bug in the kernel specs or
217/// how the Atomese is written, then it would be nasty-hard to debug
218/// where the mismatch is. So we explicitly check here. Even though
219/// it's rudimentary, its better than nothing at all. This is an
220/// experiment. We'll find out.
221///
222/// Here's how it works:
223/// The interface spec is a ConnectorSeq of Connectors.
224/// Each Connector has one of the forms
225/// (Connector (Type 'FloatValue) (Sex "input"))
226/// (Connector (Type 'FloatValue) (Sex "output"))
227/// (Connector (Type 'FloatValue) (Sex "scalar"))
228/// Maybe more in the future.
229///
230/// Each item in the flovecs array is going to either be
231/// (OpenclFloatValue ...)
232/// or, for scalars,
233/// (Connector (Number 42))
234/// We know this, because we just now created these! So its almost
235/// impossible to fail this check just right now, cause the way we do
236/// kernels right now is rather simplistic. Everything is too basic.
237/// Bus still ...
238///
239/// The only sqwonky bit is the scalar checking ... I'm not yet happy
240/// with using (Connector (Number 42)) for scalars... I dunno.
241///
242void OpenclJobValue::check_signature(const Handle& kern,
243 const Handle& iface,
244 const ValueSeq& flovecs)
214245{
215246 // iface is a ConnectorSeq oc Connectors
216247 if (flovecs.size() != iface->size())
……@@ -218,14 +249,6 @@ OpenclJobValue::check_signature(const Handle& kern, const Handle& iface,
218249 "Expected %zu arguments, got %zu for %s",
219250 iface->size(), flovecs.size(), kern->to_string().c_str());
220251
221 // Each Connector has the form
222 // (Connector (Type 'FloatValue) (Sex "input"))
223 // or similar.
224 // Each item in the flovecs array is going to either be
225 // (OpenclFloatValue ...)
226 // or, for scalars,
227 // (Connector (Number 42))
228 // We're going to blow off scalar checking, for now.
229252 const HandleSeq& cons = iface->getOutgoingSet();
230253 for (size_t i = 0; i < cons.size(); i++)
231254 {