AND Parallelism in Logic Programs

TL;DR

This paper introduces a novel method for achieving AND parallelism in logic programming, allowing multiple goals within a single clause to be executed concurrently. This approach, built upon the AND/OR Process Model, aims to significantly speed up deterministic logic programs by reducing the sequential dependency chain, offering a parallel execution model that is transparent to the programmer.

What Problem Does This Paper Address?

Traditional logic programming systems, like Prolog, rely on backtracking to handle nondeterminism. While effective, this sequential search can be a bottleneck, especially for deterministic programs where the solution lies deep within a search tree. The paper addresses the challenge of exploiting parallelism within logic programs, specifically focusing on AND parallelism – the concurrent execution of multiple subgoals within a single clause. This is distinct from OR parallelism, which handles nondeterministic choices at a single goal. The goal is to provide a parallel execution model that doesn't require explicit programmer annotation, making it easier to adopt.

Methods

The core of the paper's contribution lies in the AND/OR Process Model and its implementation for AND parallelism. The model views computations as a tree of AND and OR processes.

  • AND Processes: Handle conjunctions of goals (multiple literals in a clause body). They create OR processes for each literal.
  • OR Processes: Handle single goals. They can either find a unit clause to satisfy the goal or create AND processes to solve the body of a non-unit clause.

The key innovation for AND parallelism is the Ordering Algorithm. This algorithm determines which literals within a clause body can be executed in parallel. It prioritizes literals based on:

  1. Mode Declarations: User-defined constraints on argument instantiation (e.g., input vs. output variables).
  2. Generator/Consumer Relationships: Identifying "generator" literals that produce values for variables needed by "consumer" literals.
  3. Leftmost Uninstantiated Variable: A fallback heuristic to select a generator.

This ordering creates a dataflow graph, where arcs represent variable dependencies. The execution then proceeds in two phases:

  • Forward Execution: When a literal is solved (an OR process succeeds), its node is removed from the dataflow graph. If this unblocks other literals (i.e., their generators are now solved), new OR processes are created for them.
  • Backward Execution: If a literal fails, the system uses a "redo list" and "failure context" to backtrack intelligently. It sends redo messages to the appropriate generator literals, potentially triggering a cascade of re-evaluations.

Datasets

Not discussed in the paper. The paper uses examples like "Fast Factorial" and "Map Coloring" to illustrate its concepts and algorithms, but these are presented as illustrative programs rather than formal datasets for evaluation.

Key Insights and Ideas

  • AND Parallelism as Dataflow: The paper elegantly frames AND parallelism as a dataflow computation, where literals in a clause body are nodes and variable dependencies are arcs. This provides a clear mental model for concurrent execution.
  • Generators and Consumers: The concept of "generator" and "consumer" literals is crucial for managing dependencies and enabling parallel execution. A generator is responsible for instantiating a variable that other literals (consumers) depend on.
  • Transparent Parallelism: A significant goal is to achieve parallelism without requiring programmers to annotate their code. The ordering algorithm and the AND/OR Process Model aim to handle this automatically.
  • Intelligent Backtracking Integration: The backward execution component builds upon concepts of intelligent backtracking, using redo lists and failure contexts to efficiently recover from failures in a parallel environment.

Key Results

The paper doesn't present extensive quantitative results with benchmarks. Instead, it focuses on:

  • Conceptual Framework: Defining the AND/OR Process Model and how AND parallelism fits within it.
  • Algorithmic Description: Detailing the Ordering Algorithm, Forward Execution, and Backward Execution components.
  • Illustrative Examples: Demonstrating the execution trace for "Fast Factorial" (a deterministic program) and "Map Coloring" (a program requiring backward execution) to showcase the model's behavior. For Fast Factorial, they suggest a potential speedup from O(T) to O(log2 T) for deterministic programs, where T is the number of steps in a sequential interpreter.

Limitations and Future Work

  • Distribution and Communication Costs: The authors explicitly state that they are postponing dealing with the "significant problems of effective distribution of processes to processing elements (PEs) and the physical structure of the interconnection of PEs and the resulting communication times." This is a major area for future work.
  • Backtracking Simplicity: The paper acknowledges that their backtracking algorithm "will not be as smart as the theirs [Pereira and Porto's], since ours must be executed by a number of processes as opposed to a single process with global information." This suggests room for improvement in the efficiency of backward execution.
  • Failure Message Information: The current fail messages contain "no information about xhg an OR process failed," which limits the intelligence of the backward execution.
  • Generator Heuristics: While the paper presents heuristics for selecting generators, it notes that "Other heuristics are described in [11] and [10]," implying that the chosen heuristics might not be optimal.
  • Future Work: The authors suggest further research into the distribution of processes and the efficiency of their backtracking mechanism.

Summary updated

BibTeX
@inproceedings{1983parallelism,
  title = {{AND Parallelism in Logic Programs}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1983},
}
Figure