Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP Mark Bishop.

Similar presentations


Presentation on theme: "Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP Mark Bishop."— Presentation transcript:

1 Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP Mark Bishop

2 01/04/2014(c) Bishop: Consciousness and Computations2 Theorem Let f p (x) =Function computed by NORMA program P on input X t p (x) =Number of non X|Y instructions executed by P on X Theorem: For all NORMA programs P, there is a NORMA program Q such that: f q (x) =f p (x) t q (x) =1/2 t p (x) Now, let P = Q ie. The number of non I/O instructions in NORMA programs can be reduced by an arbitrary linear factor!

3 01/04/2014(c) Bishop: Consciousness and Computations3 Method Elimination on α For each non X|Y register {A} define an extra register α. Store only {A DIV 2} in A and the modulus in α. Hence α can only takes on the values {0 or 1}. And α {0 | 1} can be eliminated by coding its state into the program structure. Limitations: Only non input/output, {X|Y}, instructions are eligible for elimination.

4 01/04/2014(c) Bishop: Consciousness and Computations4 Elimination of a binary flowchart variable Suppose a NORMA variable S takes on values of {0,1}, in a program P with labels [1.. n]. We can make two copies of P, P 0 & P 1 and eliminate S. LabelProgram PLabelProgram P 0 or P 1 JS goes to zeroj 0 GOTO (j+1) 0 j 1 GOTO (j+1) 0 JS goes to onej 0 GOTO (j+1) 1 j 1 GOTO (j+1) 1 JIF (S = 0) THEN kj 0 GOTO k 0 j 1 GOTO (j+1) 1 JNon S instructionj 0 Instruction j 1 Instruction

5 01/04/2014(c) Bishop: Consciousness and Computations5 An example Consider the following NORMA program to evaluate Y = X 2 1.IF (X = 0) THEN GOTO 0 2.X = X - 1 3.A = A + 1 4.B = B + 1 5.IF (A = 0) THEN GOTO 9 6.A = A - 1 7.B = B + 1 8.Y = Y + 1; GOTO 5 9.IF (B = 0) THEN GOTO 1 10.A = A + 1 11.B = B – 1; GOTO 9

6 01/04/2014(c) Bishop: Consciousness and Computations6 Tabulate [β = 0; α = 0] [β = 0; α = 1][β = 1; α = 0][β = 1; α = 1] 1 00 ?(X=0) GO 01 01 1 10 1 11 2 00 DEC X2 01 2 10 2 11 3 00 GO 4 01 3 01 3 10 3 11 4 00 4 01 GO 5 11 4 10 4 11 5 00 ?(A=0) 9 00 5 01 5 10 5 11 GO 6 11 6 00 DEC A;GO 7 01 6 01 6 10 6 11 GO 7 10 7 00 7 01 GO 8 11 7 10 INC B;GO 8 00 7 11 8 00 INC Y;GO 5 00 8 01 8 10 8 11 INC Y; GO 5 11 9 00 ?(B=0) GO 1 00 9 01 9 10 9 11 GO 10 11 10 00 GO 11 01 10 01 10 10 10 11 INCA;GO 11 10 11 00 11 01 DEC B;GO9 11 11 10 GO 9 00 11 11

7 01/04/2014(c) Bishop: Consciousness and Computations7 Renumbering In the above table all line numbers are coded as l βα. The next step is to list the above four segments of code consecutively and eliminate unnecessary GOTO instructions. This produces the following code: 1 00 ?(X=0)THEN GOTO 0 2 00 X=X-1 7 10 B=B+1 8 00 Y=Y+1 5 00 ?(A=0)THEN GOTO 9 00 6 00 A=A-1 8 11 Y=Y+1;GOTO 7 10 9 00 ?(B=0)THEN GOTO 1 00 11 01 B=B-1 10 11 A=A+1;GOTO 9 00

8 01/04/2014(c) Bishop: Consciousness and Computations8 The final program Which can then be renumbered to produce the final program: 1?(X=0)THEN GOTO 0 2X=X-1 3B=B+1 4Y=Y+1 5?(A=0)THEN GOTO 8 6A=A-1 7Y=Y+1;GOTO 3 8?(B=0)THEN GOTO 1 9B=B-1 10 A=A+1;GOTO 8 Now compare with original


Download ppt "Cognitive Computing: 2012 Consciousness and Computation: computing machinery and intelligence 4. NORMA PROGRAM SPEEDUP Mark Bishop."

Similar presentations


Ads by Google