Tech Deep Dive

Compiled Graphs: Representation and Execution

AI

We distinguish graphs that represent engineered designs from graphs compiled to schedule repeated computation. The episode explains graph rewriting, Ray’s execution model, and where a fixed graph is useful.

What was said, and where it came from

  1. A February 1, 2022 review in Frontiers describes graphs in engineering design as representations of products, with nodes for entities and edges for relations.

  2. The review says those structures can represent geometry, product hierarchies, functions, and flows of information or resources.

  3. In engineering design, graphs are commonly typed and attributed: types distinguish categories of objects, while attributes store data about them.

  4. The review says graph nodes can stand for anything from geometric vertices to larger objects such as walls or building stories.

  5. Graph rewriting uses rules to manipulate a model’s nodes, edges, and attributes.

  6. The review describes a rule as having a condition and a rewriting pattern.

  7. Once design rules are formalized, software frameworks can apply them to evolve the representation.

  8. The review says a design can be represented as a procedural construction history rather than only as a finished result.

  9. Varying the rules, the matches selected, and their parameters can explore a solution space; directed search can then restrict that exploration.

  10. The review places graph rewriting within computational design synthesis, which it describes through problem representation, solution generation, evaluation, and guidance of the next search cycle.

  11. Ray’s documentation describes Compiled Graph as a static execution model, unlike the eager execution of classic Ray APIs.

  12. Ray’s documentation says Compiled Graph can pre-allocate resources to reduce system overhead.

  13. The documentation says it can prepare NCCL communicators and apply deadlock-free scheduling.

  14. Ray’s documentation lists automatic overlap of GPU computation and communication as experimental.

  15. The documentation gives less than 50 microseconds of system overhead for workloads that repeatedly execute the same task graph, compared with about one millisecond per task launch for Ray Core.

  16. Ray’s documentation says compiled graphs natively support GPU-to-GPU communication with NCCL.

  17. Gradient Flow, in an October 18, 2024 account, describes workloads as directed acyclic graphs that are compiled into an execution plan.

  18. An October 7, 2024 Anyscale blog says the compiled backend statically allocates input and output buffers for actor tasks at compilation and reuses them during execution.

  19. The Anyscale blog says actors on the same Ray node share a physical input buffer, synchronized by the compiled-graph backend.

  20. The blog says that reusing buffers reduces per-task work such as serializing arguments, allocating argument memory, and invoking a task.

  21. For a pipeline, the blog describes executing the same graph several times before retrieving the outputs so executions can be pipelined across actors.

  22. The blog says Compiled Graph can use NCCL to transfer CUDA tensors between actors.

  23. In the blog’s benchmarks, round-trip communication with a 40-megabyte CUDA tensor had nearly 140 times lower latency on a machine with A100 GPUs and NVLink than with Ray Core.

  24. The blog reports a 10–15 percent throughput and latency improvement in vLLM model-parallel inference compared with its default NCCL backend.

  25. Ray’s documentation says Compiled Graph is currently in beta and that its APIs are subject to change.

  26. Gradient Flow says compiled graphs are designed for computation whose graph is effectively static, while Ray Core is the better fit when more dynamic flexibility is required.