ahrefs / ocannl

OCANNL: OCaml Compiles Algorithms for Neural Networks Learning
BSD 2-Clause "Simplified" License
67 stars 2 forks source link

Consider introducing proper static verification of merge buffer nodes, but "in the right direction" #288

Open lukstafi opened 1 month ago

lukstafi commented 1 month ago

device_to_device ~into_merge_buffer:not_No ~dst ~src used to verify its merge buffer node by requiring that dst is the context coming from linking the code consuming the merge buffer. This is half-static in that the dependency between "producing" and "consuming" the merge buffers is directly expressed in the source. But it goes against the typical uses of context chaining where routines executed later link to contexts of routines executed earlier. Moreover, we verify merge buffers dynamically, so I removed this half-static verification.

But if we convert device_to_device to returning a routine rather than directly scheduling the copying (or "streaming" e.g. aliasing), we can introduce proper static verification of merge buffer nodes. The device_to_device's context would be linked with the code consuming the merge buffer.