Cut Implementation in a Massively Parallel Prolog System Peter Kacsuk KFKI-MSZKI H-1525 Budapest, P. 0. Box 49 HUNGARY h2633kacoella.h~ ABSTRACT zyxwvutsrq An OR-parallel scheme for handling 'cut'built-in predicates in zyxwvu a distributed data driven Prolog environment is shown in the paper. First a short overview of the Distributed Data Driven Prolog Abstract Machine (3DPAM) zyx is given. 3DPAM can be considered as a data driven modijication of WAM for highly parallel distributed memory computers. The main contribution of the paper is the &finition of 3 D P M code for OR-alternative clauses containing %ut' built-in predicates. The pruning mechanism of 'cut' based on the model is explained in detail. 1 INTRODUCTION zyxwvuts Within the framework of the Gigalips project significant achievements have been made for implemeting OR-parallel Prolog on shared memory multiprocessors. One of the major problems to be solved in the project has been the pruning and scheduling speculative work lHaus893, [Beau9 11. In the present paper an alternative approach is described for implementing OR-parallel Prolog system on highly parallel distributed memory multicomputers based on the data driven semantics. The abstract machine developed in this project is called Distributed Data Driven Prolog Abstract Machine (3DPAM) and can be considered as a data driven modification of the WAM [warr83]. 3DPAM shows many similarities with the WAM mainly in the unification oriented subpart of the instruction set, but significantly differs from the WAM as to the control instructions. These instructions serve for exploiting OR-parallelism and pipeline AND-parallelism using a data driven execution scheme. In order to exploit pipeline AND-parallelism 3DPAM works as an all-solution Prolog machine generating all possible solutions for any query. In Or-parallel systems altemative clauses of a predicate can be processed in parallel by different processors. In an all- solution Prolog system all processors execute useful work as far as the altemative clauses do not contain 'cut' built-in predicates. However if a 'cut' appears in a clause (cut-clause), the branches of the Search Tree corresponding to the clauses following the cut-clause might be pruned if the 'cut' is reached in the branch of the cut-clause. Therefore the work of processes working on these prunable branches is called speculative. The parallel execution of speculative works can be either beneficial (if the 'cut' does not prune) or disadvantageous if unneeded speculative works disables processors to execute unspeculative work. In [Ali87] an OR-parallelWAM extension is shown, which is able to recognize and avoid speculative work. [Haus891 and [Beau911 demonstrate schedulers which enables the execution of speculative works but try to minimise the cost of unneeded speculative work based on run-time decisions. In the present paper an OR-parallel scheme is shown resembling to the proposal of [Beaugl], but the method is based on compile-time decisions. zyxw An early version of the CUT model described in this paper was suggested by [Omar891. 2 GENERAL VIEW OF 3DPAM As was shown in [Kacs90] and [Kacs91] Prolog programs are transformed into the Dataflow Search Graph consisting of UNIFY: UNIT: AND: for connecting body goals OR: HCOR: COR: the following dataflow operators: for executing unification of non-unit clause heads and entering binding results into clause bodies for executing unification on unit clause heads for connecting altemative clauses of a procedure for connecting two alternative clauses of a procedure the first of which contains a 'cut' goal in its body for connecting altemative inference routes for a goal followed by a series of goals including 'cut' 96 1066-619W92 $3.00 zyxwvutsrqpo 0 1992 IEEE