Vectorization Techniques for Prolog - Kanada

1 downloads 0 Views 2MB Size Report
operations case-by-case at machine level, These operations cannot ... The answer is listla. b, c, d, el (A list is bracketed in Prolog). ... The question has multiple answers because ...... [Kum 861 Kumon, K., et. al., "KABU-WAKE: A New Parallel.
Vectorization Techniques for Prolog Yasusi Kanada, Keiji Kojima, and Masahiro Sugaya Central Research Laboratory, Hitachi Ltd. Kokubunji, Tokyo 185, Japan.

Abstract

The (ormer approach has been widely studied, (or example, in

Several techniques for running Prolog programs on pipeline
3090 Vector Facility.

However, their wrget is different (rom

Kanada's (ours). Our target is 1.0 improve perrormance of Prolog ....ith changing its semantics as little &s possible.

is to improve performance or a logic programming languags

1. Introduc�ion

without backtracking, i.e., a so·called paruliel logic programming

and Its High.Speed Execution

1.1 Prolog

language GHC IUed 85) or its subset.

Prolog is 8 language with unification a n d automatic backtracking ('Prolog' is hereafter used to indicate logic programming languages in generall.

1.2 Difficulties in

Unification is a very

or assembly language.

AutomaLic backtracking makes programming of search problems

u-ans(ormation called

With theS(' reatures, Prolog is quite suitable ror symbol

processing such

8S

speed is rather low. required.

Vectorizing compilers perform a program

II«lorilotion to

generate the object progrom,

numerical programs have been established, and the program

very powerful language, its I!Iuculion

transformation is rather easy.

Thus, achieving high.speed execution ;.

This is because

their main data

structures are arrays that the vector processors Bre speciolized to

Many Prolog optimizing compilers i n large scale

process. and because their cO!llrol structures are simple 00 loops

general·purpose computers have been developed. However, higher

in moslcases.

speed requires parallel execution. There 8re t....o possible methods ror parallel execution of Prolog.

Portron

In the case of Fortran, vectorization techniques for most

knowledge-base processing, and so on. a

used by

which is a U
In the case of

,- append([a, bl, Ie]. Z i),

composition, the cons cells are allocated on the heap, and the

) - ,'ppend(atom, [atom]. 22)

,- ,)ppend([', 2, 31- [4, 51, l3)

value of the first and the second arguments are stored in them. The addresses

of the cons cells is calculated by an arithmetic

sequence ge neration ope ration and stored in output v ector c. There is also the problem of conditional control.

method

true

the un ific ations are controlled by the

true

There are three conditional control methods.

stored data.

Output mask

vector " "

succeed, this failure or success mu st be st ored in memory. The

tfUE!

They are explained in Sec tion 3.3.

"

[1,2,3)

,

�/ i,,2nd nrg



t,

" "

[4,

,

Input

word mod� information refers to in fo rm a t ion that shows

Inpllt

whether the arguments or variables a re used only for input,

vee!;,,· ,

procedures

a

Output indo

l

control is

[a,b,