(lang dune 3.21)
(using mdx 0.4)
(name vaccel)
(source (tangled gazagnaire.org/ocaml-vaccel))
(license ISC)
(authors "Thomas Gazagnaire <thomas@gazagnaire.org>")
(maintainers "Thomas Gazagnaire <thomas@gazagnaire.org>")

(generate_opam_files true)
(implicit_transitive_deps false)

(package
 (name vaccel)
 (synopsis "vAccel RPC protocol in pure OCaml")
 (description
  "The vAccel RPC protocol in pure OCaml: hand-written protobuf codecs for the vaccel-rpc-proto message schemas (sessions, resources, the generic genop operation, image classification, TensorFlow, TensorFlow Lite and PyTorch inference, profiling) and the typed method table of the sync AgentService, ready to call over any ttrpc transport. vAccel forwards acceleration operations from a guest without accelerator access (a VM or unikernel) to a host agent that owns the hardware; this library is the wire contract of that conversation, with no I/O of its own.")
 (tags (org:blacksun network))
 (depends
  (ocaml (>= 4.14.0))
  (dune (>= 3.0))
  fmt
  ttrpc
  nox-protobuf
  (alcotest :with-test)
  (alcobar :with-test)
  (mtime :with-test)
  (nox-rope :with-test)
  (mdx :with-test)))

(package
 (name vaccel-eio)
 (synopsis "vAccel over Eio: a policy-broker in front of an upstream agent")
 (description
  "An Eio policy-broker for the vAccel RPC protocol. Guests connect to the broker instead of the agent; the broker authenticates each guest, applies an authorization policy, enforces a per-guest session quota, isolates guests from each other's sessions, and forwards the calls to one upstream agent over ttrpc. It attenuates access to a shared accelerator the way a capability system narrows authority, and audits every decision through a runtime-events probe.")
 (tags (org:blacksun network))
 (depends
  (ocaml (>= 4.14.0))
  (dune (>= 3.0))
  fmt
  (eio (>= 1.0))
  vaccel
  ttrpc
  ttrpc-eio
  nox-protobuf
  probe
  (eio_main :with-test)
  (mtime :with-test)
  (nox-rope :with-test)
  (alcotest :with-test)))

(package
 (name vaccel-client)
 (synopsis "vAccel client: call the AgentService through typed handles")
 (description
  "The guest half of the vAccel RPC protocol over Eio: dial an agent (or a broker in front of one) and call the AgentService -- sessions, resources, image classification, genop, the TensorFlow, TensorFlow Lite and PyTorch methods, and the profiler -- through typed handles rather than raw ttrpc calls carrying protobuf records. A session and a resource carry the client they were opened from, so an id is never threaded through a call by hand; the session bracket destroys what it opened, on an exception as much as on a result; and failures come back as values.")
 (tags (org:blacksun network))
 (depends
  (ocaml (>= 4.14.0))
  (dune (>= 3.0))
  fmt
  (eio (>= 1.0))
  mtime
  vaccel
  ttrpc
  ttrpc-eio
  (nox-protobuf :with-test)
  (astring :with-test)
  (nox-csv :with-test)
  (ascii :with-test)
  (eio_main :with-test)
  (alcotest :with-test)))

(package
 (name vaccel-metal)
 (synopsis "vAccel agent backend running inference on the Metal GPU")
 (description
  "The Metal host side of the vAccel protocol: a vaccel-eio agent backend that runs image classification on the Apple GPU with nox-metal (a CPU fallback off macOS). A session holds a linear classifier registered as a model blob; unikernel guests offload classification to it over ttrpc, unchanged whether the host has a GPU or not.")
 (tags (org:blacksun network))
 (depends
  (ocaml (>= 4.14.0))
  (dune (>= 3.0))
  fmt
  (eio (>= 1.0))
  vaccel
  vaccel-eio
  ttrpc
  ttrpc-eio
  nox-metal))

(package
 (name vaccel-oci)
 (synopsis "Resolve vAccel models from an OCI content store by digest")
 (description
  "The bridge between the vAccel Metal agent and an OCI content-addressable store: a model is published once as a content-addressed blob and named by its digest, so it rides the vAccel protocol as a reference the agent pulls from the store and caches. Every guest that names a model's digest is served the same cached, parsed copy. The reusable host side of by-digest model delivery.")
 (tags (org:blacksun network))
 (depends
  (ocaml (>= 4.14.0))
  (dune (>= 3.0))
  fmt
  (eio (>= 1.0))
  vaccel-metal
  nox-metal
  oci))
