| … | … | @@ -208,9 +208,40 @@ OpenclJobValue::make_vectors(const Handle& oclno) |
| 208 | 208 | |
| 209 | 209 | // ============================================================== |
| 210 | 210 | |
| 211 | | void |
| 212 | | OpenclJobValue::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 | /// |
| 242 | void OpenclJobValue::check_signature(const Handle& kern, |
| 243 | const Handle& iface, |
| 244 | const ValueSeq& flovecs) |
| 214 | 245 | { |
| 215 | 246 | // iface is a ConnectorSeq oc Connectors |
| 216 | 247 | if (flovecs.size() != iface->size()) |
| … | … | @@ -218,14 +249,6 @@ OpenclJobValue::check_signature(const Handle& kern, const Handle& iface, |
| 218 | 249 | "Expected %zu arguments, got %zu for %s", |
| 219 | 250 | iface->size(), flovecs.size(), kern->to_string().c_str()); |
| 220 | 251 | |
| 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. |
| 229 | 252 | const HandleSeq& cons = iface->getOutgoingSet(); |
| 230 | 253 | for (size_t i = 0; i < cons.size(); i++) |
| 231 | 254 | { |