75
A Characterization of Reuse Technologies Ted J. Biggerstaff Ted J. Biggerstaff [email protected] [email protected] m m

A Characterization of Reuse Technologies

  • Upload
    shalin

  • View
    21

  • Download
    0

Embed Size (px)

DESCRIPTION

A Characterization of Reuse Technologies. Ted J. Biggerstaff [email protected]. Reuse Technologies. Concrete components e.g., Functions, OOP, Frameworks, DCOM, … Compositionally Derived Components e.g., Templates, GenVoca, … Pattern-directed transformation systems - PowerPoint PPT Presentation

Citation preview

Page 1: A Characterization of Reuse Technologies

A Characterization of Reuse Technologies

Ted J. BiggerstaffTed J. [email protected]@austin.rr.com

Page 2: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

e.g., Functions, OOP, Frameworks, DCOM, …e.g., Functions, OOP, Frameworks, DCOM, … Compositionally Derived Components Compositionally Derived Components

e.g., Templates, GenVoca, …e.g., Templates, GenVoca, … Pattern-directed transformation systemsPattern-directed transformation systems

e.g., Draco, CAPE, IP, DMS, Sinapse, ...e.g., Draco, CAPE, IP, DMS, Sinapse, ...

Page 3: A Characterization of Reuse Technologies

Control Regimes

PD Search – Independent Local ChoicesPD Search – Independent Local Choices Strategically Blind – exploding search spaceStrategically Blind – exploding search space Biased Toward Local Syntactic StructureBiased Toward Local Syntactic Structure Rules are General & Allow Easy ExtensionRules are General & Allow Easy Extension

Page 4: A Characterization of Reuse Technologies

Control Regimes PD Search – Independent Local ChoicesPD Search – Independent Local Choices

Strategically Blind – exploding search spaceStrategically Blind – exploding search space Biased Toward Local Syntactic StructureBiased Toward Local Syntactic Structure Rules are General & Allow Easy ExtensionRules are General & Allow Easy Extension

MetaPrograms – Algorithmic MetaPrograms – Algorithmic Strategically & Tactically PurposefulStrategically & Tactically Purposeful State Dependent Actions Reduce Search SpaceState Dependent Actions Reduce Search Space Representation Makes Extensions HardRepresentation Makes Extensions Hard

Page 5: A Characterization of Reuse Technologies

Constraint Propagation Problem

Refine tox

Program

x Constraint

Reuse LibraryAlternative Refinementsof

Page 6: A Characterization of Reuse Technologies

PD Explosion Control

Group Rules by PhaseGroup Rules by Phase Implicit Phases based on Distinct DSLsImplicit Phases based on Distinct DSLs

Mutually Exclusive DSL Operators & OperandsMutually Exclusive DSL Operators & Operands

Page 7: A Characterization of Reuse Technologies

Draco Domains

Abstractions:

Keys,Relations,Attributes, …Operations:

Search, Delete,Add, Update,

Attach,Detach, ...

Abstractions:Cursor, Container,

Keys,Relations,Attributes, …Operations:

Search, Delete,Add, Update,

Attach,Detach, ...

Data Base

RelationalAlgebra

Abstract DataTypes

C Code

Tuple Index

Page 8: A Characterization of Reuse Technologies

Refinements

Data Base

Relational

Algebra

Abstract Data

TypesC Code

Tuple Index

Component: Insert(Value V, Container C){Refinement: Stack Condition: LIFO(C) Code: {Push(V,C)}}{Refinement: Sorted Container Condition: SortedOn(C, Value) Assertion: SortedOn(C, Value) Code: {Merge(V,C)}}

...}

Page 9: A Characterization of Reuse Technologies

PD Explosion Control

Group Rules by PhaseGroup Rules by Phase Implicit Phases based on Distinct DSLsImplicit Phases based on Distinct DSLs

Mutually Exclusive DSL Operators & OperandsMutually Exclusive DSL Operators & Operands … … and based MetaProgramand based MetaProgram

{Refine DSL; Optimize Refined DSL}{Refine DSL; Optimize Refined DSL}

Page 10: A Characterization of Reuse Technologies

Domain to self:Join(?Relation1, Empty_Relation, ?Attribute)=>Empty_RelationSelect(?Relation1,TRUE_expression)=>Relation1Select(?Relation1,FALSE_expression)=> Empty_Relation

Data Base

Relational

Algebra

Abstract Data

TypesC Code

Tuple Index

Optimizing Transforms

Page 11: A Characterization of Reuse Technologies

Kinds of Optimization

Simplification & DS OptimizationsSimplification & DS Optimizations Key Point: DS Reductions Not CombinationsKey Point: DS Reductions Not Combinations

Page 12: A Characterization of Reuse Technologies

Pattern-Directed Systems Example domain: communications protocols Example domain: communications protocols Benefits:Benefits:

Fine grain rules allow great horizontal scalingFine grain rules allow great horizontal scaling Small search spaces (DSL->DSL) vs. one largeSmall search spaces (DSL->DSL) vs. one large Powerful in-domain optimizationsPowerful in-domain optimizations

Shortcomings:Shortcomings: Global reorganizing optimizations can explode Global reorganizing optimizations can explode

search spacesearch space

Page 13: A Characterization of Reuse Technologies

Essence of The Technology

ClassClass ElementsElements OperationsOperationsConcrete Reuse PL Struct. Concrete Reuse PL Struct. Hand Assem.Hand Assem.CompositionComposition Abstract PL Abstract PL InliningInliningPD GeneratorPD Generator DSL Struct. DSL Struct. PD XformsPD Xforms

Page 14: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

e.g., Functions, OOP, Frameworks, DCOM, …e.g., Functions, OOP, Frameworks, DCOM, … Compositionally Derived Components Compositionally Derived Components

e.g., Templates, GenVoca, …e.g., Templates, GenVoca, … Pattern-directed transformation systemsPattern-directed transformation systems

e.g., Draco, CAPE, IP, DMS, Sinapse, ...e.g., Draco, CAPE, IP, DMS, Sinapse, ... Reorganizing generator systemsReorganizing generator systems

AO generator (AOG), AOP, ...AO generator (AOG), AOP, ...

Page 15: A Characterization of Reuse Technologies

DSL for Sobel Edge Detection

b=[(a s)2 + (a s’)2]1/2

a b

Page 16: A Characterization of Reuse Technologies

Problem: Antagonistic Goals

High level operators and operands provide High level operators and operands provide programming leverage & variationsprogramming leverage & variations

E.g., (image E.g., (image neighborhood) convolution neighborhood) convolution

But fracture and de-localize code piecesBut fracture and de-localize code pieces b=((a b=((a s) s)22 + (a + (a s’) s’)22 ) )1/21/2

Needed optimizations: code sharing, re-org. & re-weavingNeeded optimizations: code sharing, re-org. & re-weaving

Conventional Optimization approaches induce Conventional Optimization approaches induce large search spaces (EXPLOSION)large search spaces (EXPLOSION)

Page 17: A Characterization of Reuse Technologies

Kinds of Optimization Simplification & DS OptimizationsSimplification & DS Optimizations

Key Point: DS Reductions Not CombinationsKey Point: DS Reductions Not Combinations LocalizationLocalization

Separate Parts Woven into Computational FormSeparate Parts Woven into Computational Form

General Interdependent Parts Problem NP CompleteGeneral Interdependent Parts Problem NP Complete Tractable Via Narrow Domain Knowledge & GroupingTractable Via Narrow Domain Knowledge & Grouping

Weave

Page 18: A Characterization of Reuse Technologies

Explosion Control Group Rules by PhaseGroup Rules by Phase

Implicit Phases based on Distinct DSLs & Implicit Phases based on Distinct DSLs & {Refine; Optimize} MetaProgram{Refine; Optimize} MetaProgram

Explicit Finer Grain PhasesExplicit Finer Grain Phases {Loop Optimization, Code Generation, …}{Loop Optimization, Code Generation, …}

Group Rules by Named EntityGroup Rules by Named Entity E.g., Type or Operator or Arbitrary EntityE.g., Type or Operator or Arbitrary Entity Mechanisms in AOG, Stratego, etc.Mechanisms in AOG, Stratego, etc.

AOG Uses Both Entity and PhaseAOG Uses Both Entity and Phase

Page 19: A Characterization of Reuse Technologies

Explicit Entities & Phases Phase (Job)Phase (Job)

Type Type (Semantics)(Semantics)

Loop Loop OptimizationOptimization(Fusion2)(Fusion2)

CodeCodeGenerationGeneration(Fusion3)(Fusion3)

. . .. . .

OperatorOperator ,, ,, . . .. . .ImageImage , , , , . . .. . .Neighbor-Neighbor-hoodhood

,, , , . . .. . .

. . .. . . . . .. . . . . .. . . . . .. . .

Page 20: A Characterization of Reuse Technologies

Example Loop Opt. Transform Phase (Job)Phase (Job)

Type Type (Semantics)(Semantics)

Loop Loop OptimizationOptimization(Fusion2)(Fusion2)

CodeCodeGenerationGeneration(Fusion3)(Fusion3)

. . .. . .

OperatorOperator . . .. . .ImageImage , , . . .. . .Neighbor-Neighbor-hoodhood

. . .. . .

. . .. . . . . .. . . . . .. . . . . .. . .

Page 21: A Characterization of Reuse Technologies

Example Loop Opt. Transform

(=> compositeleaf fusion2 image

Refine Image to BWPixel with loop shorthand tags

Name, Phase, Location

LHS

RHS

PreRoutine PostRoutine)

Page 22: A Characterization of Reuse Technologies

Example Loop Opt. Transform

(=> compositeleaf fusion2 image

Refine Image to BWPixel with loop shorthand tags

Name, Phase, Location

`$(pand $(por (leaf ?op) ?op)) …sub-pattern to get type …

…sub-pattern to get dimensions of ?op…)

RHS

LHS

PreRoutine PostRoutine)

Page 23: A Characterization of Reuse Technologies

Example Loop Opt. Transform

(=> compositeleaf fusion2 image

Refine Image to BWPixel with loop shorthand tags

Name, Phase, Location

`$(pand $(por (leaf ?op) ?op)) ($(spanto ?pre (tags)) (tags $(spanto ?pretags (itype ?itype))

?spaceover $(remain ?posttags))) …sub-pattern to get dimensions of ?op…)

RHS

LHS

PreRoutine PostRoutine)

Page 24: A Characterization of Reuse Technologies

Example Loop Opt. Transform

(=> compositeleaf fusion2 image

Refine Image to BWPixel with loop shorthand tags

Name, Phase, Location

RHS

enablecompositeleaf nil)

Enablecompositeleaf creates ?newleaf, ?idx1, ?idx2

Pre &Post Routines

`$(pand $(por (leaf ?op) ?op)) ($(spanto ?pre (tags)) (tags $(spanto ?pretags (itype ?itype))

?spaceover $(remain ?posttags))) …sub-pattern to get dimensions of ?op…)

LHS

Page 25: A Characterization of Reuse Technologies

Example Loop Opt. Transform

(=> compositeleaf fusion2 image

Refine Image to BWPixel with loop shorthand tags

Name, Phase, Location

`(leaf ?newleaf (tags (commasplice ?pretags)

(_Q (_FORALL (?newleaf) (,arefop (?op) ?idx1 ?idx2)))

(Itype BWPixel) (commasplice ?posttags)))enablecompositeleaf nil)

Enablecompositeleaf creates ?newleaf, ?idx1, ?idx2

Pre &Post Routines

`$(pand $(por (leaf ?op) ?op)) ($(spanto ?pre (tags)) (tags $(spanto ?pretags (itype ?itype))

?spaceover $(remain ?posttags))) …sub-pattern to get dimensions of ?op…)

LHS

RHS

Page 26: A Characterization of Reuse Technologies

Loop Control Phase Traversal

b=[(a s)2 + (a s’)2]1/2

You Are Here

(leaf a (tags (itype image)))

BehindThe

Scenes

CLOS Object

PropertyList

Page 27: A Characterization of Reuse Technologies

Pattern Match Resultb=[(a s)2 + (a s’)2]1/2

(leaf a (tags (itype image)))

BehindThe

Scenes

`$(pand $(por (leaf ?op) ?op)) ($(spanto ?pre (tags)) (tags $(spanto ?pretags (itype ?itype))

?spaceover $(remain ?posttags)))…)

{ {

{

?op?spaceover

?pre?pretags ?itype ?posttags

Page 28: A Characterization of Reuse Technologies

Pattern Match Resultb=[(a s)2 + (a s’)2]1/2

(leaf a (tags (itype image)))

BehindThe

Scenes

Define enablecompositeleaf (at, bindings){?idx1 = Create iterator; ?idx2 = Create iterator; ?newleaf = Create bwpixel; return extended bindings}

{ {

{

?op?spaceover

?pre?pretags ?itype ?posttags

?idx1 idx48146?idx2 idx48149?newleaf bwpixel48143

Page 29: A Characterization of Reuse Technologies

Rewrite Resultb=[(bwpixel48143 s)2 + (a s’)2]1/2

BehindThe

Scenes

`(leaf ?newleaf (tags (commasplice ?pretags)

(_Q (_FORALL (?newleaf) (,arefop (?op) ?idx1 ?idx2)))

(itype bwpixel) (commasplice ?posttags)))

(leaf bwpixel48143 (tags (_q (_forall (bwpixel48143) (aref (a) idx48146 idx48149))) (itype bwpixel)))

Page 30: A Characterization of Reuse Technologies

Kinds of Optimization Simplification & DS OptimizationsSimplification & DS Optimizations

Key Point: DS Reductions Not CombinationsKey Point: DS Reductions Not Combinations LocalizationLocalization

Separate Parts Woven into Computational FormSeparate Parts Woven into Computational Form Architectural ShapingArchitectural Shaping

Interdependent, Composed Parts Changed per Interdependent, Composed Parts Changed per Global ConstraintsGlobal Constraints

Page 31: A Characterization of Reuse Technologies

Architectural Shaping

Computational Structure Shaped per Computational Structure Shaped per External ConstraintsExternal Constraints SIMD (MMX), DB, UI, Middleware, NetworkSIMD (MMX), DB, UI, Middleware, Network

Page 32: A Characterization of Reuse Technologies

Non-Parallel Architectural EffectsB=(A s)

Image A

B[i,j]=0

B[i,j]+

* s-1,-1

* s-1,0

* s-1,1

* s1,1

Page 33: A Characterization of Reuse Technologies

“b=[(a s)2 + (a s’)2]1/2”

INT JM1, JP1, IM1, IP1; FOR (I=0; I < (M-1); ++I)

{ IM1=I-1; IP1= I+1; FOR (J=0; J < (N-1); ++J)

{ JM1= J-1; JP1 = J+1; IF(I==0 || J==0 || (I==(M-1)) || (J==(N-1))) THEN {B[I, J] = 0 ; } ELSE

{T1=A[IP1 , JP1] - A[IP1 , JM1] +(A[I , JP1] * 2) - (A[I , JM1] * 2) + A[IM1 , JP1] - A[IM1 , JM1];

T2 = A[IP1 , JP1] + (A[IP1 , J] * 2) +A[IP1 , JM1] - A[IM1 , JP1] -(A[IM1 , J] * 2) - A[IM1 , JM1];

B[I, J] = SQRT(T1*T1 + T2*T2 );}}}

Page 34: A Characterization of Reuse Technologies

Parallel Architectural EffectsB=(A s)

Image AB[0,j]=0

B[(m-1),j]=0B[i,0]=0

B[i, (n-1)]=0

Pixels Weights S

B[i,j]+

Pmadd3( * )

Pmadd3( * )

Pmadd3( * )

Page 35: A Characterization of Reuse Technologies

“b=[(a s)2 + (a s’)2]1/2”

{int s[(-1:1), (-1:1)]={{-1, 0, 1}, {-2, 0 , 2}, {-1, 0, 1}};int sp [(-1:1), (-1:1)]={{-1, -2, -1}, {0, 0, 0}, {-1, -2, -1}};for (j=0; j < n; j++) b[0,j] = 0 ;for (i=0; i < m; i++) b[i,0] = 0 ;for (j=0; j < n; j++) b[(m-1),j] = 0 ;for (i=0; i < m; i++) b[i,(n-1)] = 0 ;{for (i=1; i < (m-1); i++) {for (j=1; j < (n-1); j++) {t1 = UNPACKADD(PADD2

(PADD2(PMADD3 (&(a[i-1, j-1]), &(s[-1, -1])) , PMADD3 (&(a[i, j-1]), &(s[ 0, -1]))), PMADD3 (&(a[i+1,j-1]), &(s[ 1, -1])));

t2 = UNPACKADD(PADD2 (PADD2(PMADD3 (&(a[i-1, j-1]), &(sp[-1, -1])),

PMADD3 (&(a[i, j-1]), &(sp[ 0, -1]))), PMADD3 (&(a[i+1, j-1]), &(sp[ 1, -1])))));

b[i,j] = sqrt(t1*t1 + t2*t2);}}}

Page 36: A Characterization of Reuse Technologies

Architectural Shaping Computational Structure Shaped per External Computational Structure Shaped per External

ConstraintsConstraints SIMD (MMX), DB, UI, Middleware, NetworkSIMD (MMX), DB, UI, Middleware, Network

Central MetaProgram Combinatorial ComplexityCentral MetaProgram Combinatorial Complexity O(100) Transforms To Parallelize ExampleO(100) Transforms To Parallelize Example Must Recognize Opportunity and PlaceMust Recognize Opportunity and Place Must Rediscover Domain Knowledge (DK)Must Rediscover Domain Knowledge (DK)

Much DK Known About Parts at Creation TimeMuch DK Known About Parts at Creation Time Optimization Trajectories of Parts Known at Optimization Trajectories of Parts Known at

CreationCreation

Page 37: A Characterization of Reuse Technologies

Explosion Control Constraint Propagation NP CompleteConstraint Propagation NP Complete Simplify Constraint PropagationSimplify Constraint Propagation

MetaPrograms Exploit DS KnowledgeMetaPrograms Exploit DS Knowledge Global Constraints (MMX) Determine Cooperating, Global Constraints (MMX) Determine Cooperating,

Distributed MetaProgramsDistributed MetaPrograms Pre-Propagation of Constraints via TagsPre-Propagation of Constraints via Tags Pre-Plan Ordering Constraints on Distributed Pre-Plan Ordering Constraints on Distributed

MetaProgramsMetaPrograms Result: Tag-Directed TransformationsResult: Tag-Directed Transformations

Page 38: A Characterization of Reuse Technologies

Explosion Control Tag-Directed TransformationsTag-Directed Transformations MetaPrograms Tagged onto Reusable PartsMetaPrograms Tagged onto Reusable Parts

WHATWHAT Transformation Transformation (SplitLoopOnCases)(SplitLoopOnCases)

WHENWHEN to Fire to Fire (on (on EventNameEventName (SplitLoopOnCases)) (SplitLoopOnCases))

WHEREWHERE to Apply to Apply (if (if CaseTestCaseTest then SpecialCase then SpecialCase

else else GeneralCaseGeneralCase (Tags (on … (Tags (on …

(SplitLoopOnCases))))(SplitLoopOnCases))))

Page 39: A Characterization of Reuse Technologies

Example: SplitLoopOnCases

for(i=0, j=0; i<m && j<n; i++, j++)if(i==0 || j==0 || i==(m-1) ||

j==(n-1)) ...then case...; ...else case...;

  for(j=0; j<n; j++)...then case with i=0...;for(j=0; j<n; j++)...then case with i=(m-1)...;for(i=0; i<m; i++)...then case with j=0...;for(i=0; i<m; i++)...then case with j=(n-1)...;for(i=1, j=1; i<(m-1) && j<(n-1); i++, j++)

...else case...;

Page 40: A Characterization of Reuse Technologies

Cooperating TD Transforms

Generate Weight MatricesGenerate Weight Matrices Create Loops, Unwrap, Partially EvaluateCreate Loops, Unwrap, Partially Evaluate

Split Loop+If into Loop CasesSplit Loop+If into Loop Cases Simplify Special Case LoopsSimplify Special Case Loops

Create Loops, Infer Control, Partially EvaluateCreate Loops, Infer Control, Partially Evaluate Reshape Image Loop BodyReshape Image Loop Body

Page 41: A Characterization of Reuse Technologies

Ordering Dependencies

Dependencies SupportedDependencies Supported Per Strategic Plan – (on PlanStep …)Per Strategic Plan – (on PlanStep …) Before & After – (on (completion Xform)…)Before & After – (on (completion Xform)…) On Local Action – (on substitutionofme …)On Local Action – (on substitutionofme …) On Signal – (on ?signalvbl …)On Signal – (on ?signalvbl …)

Page 42: A Characterization of Reuse Technologies

Explosion Control Summary Refinements – Implied DSL to DSL PhasesRefinements – Implied DSL to DSL Phases Specialized OptimizationsSpecialized Optimizations

Simplification & DS Opt. – PE & PD RulesSimplification & DS Opt. – PE & PD Rules Localization – Explicit Rule GroupingLocalization – Explicit Rule Grouping Architectural Shaping –Tag-Directed ControlArchitectural Shaping –Tag-Directed Control

Distributed MetaPrograms on Reusable PartsDistributed MetaPrograms on Reusable Parts Avoid General NP Complete ProblemAvoid General NP Complete Problem

Specialized Sub-Problems & Use DKSpecialized Sub-Problems & Use DK

Page 43: A Characterization of Reuse Technologies

References Katz & Volper, Constraint Propagation in Software Katz & Volper, Constraint Propagation in Software

Libraries of Transformation Systems, Libraries of Transformation Systems, IJSE&KE 2,3, IJSE&KE 2,3, 19921992..

Biggerstaff, Fixing Some Transformation Problems, Biggerstaff, Fixing Some Transformation Problems, Proc. Of Automated Software Engineering, 1999.Proc. Of Automated Software Engineering, 1999.

Biggerstaff, A New Control Structure for Biggerstaff, A New Control Structure for Transformation-Based GeneratorsTransformation-Based Generators, ICSR 2000ICSR 2000.

Neighbors, Draco: A Method for Engineering Neighbors, Draco: A Method for Engineering Reusable Software Systems, inReusable Software Systems, in Software Software Reusability, 1989. Reusability, 1989.

Page 44: A Characterization of Reuse Technologies
Page 45: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

e.g., Functions, OOP, Frameworks, DCOM, …e.g., Functions, OOP, Frameworks, DCOM, … Compositionally Derived Components Compositionally Derived Components

e.g., Templates, GenVoca, …e.g., Templates, GenVoca, …

Page 46: A Characterization of Reuse Technologies

Essence of The Technology

ClassClass ElementsElements OperationsOperationsConcrete Reuse PL Struct. Concrete Reuse PL Struct. Hand Assem.Hand Assem.CompositionComposition Abstract PL Abstract PL InliningInlining

Page 47: A Characterization of Reuse Technologies

The scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

Feature variabilityOne-sizefits all

Customized

Small, lowpayoff

Large, highpayoff

Reu

se P

ayof

f

Page 48: A Characterization of Reuse Technologies

Reorganizing Generators

Benefits:Benefits: Inter-component optimizations (reweavings)Inter-component optimizations (reweavings) Small search space = reasonably fastSmall search space = reasonably fast

Shortcomings:Shortcomings: Technology immatureTechnology immature Unclear how far it can be pushedUnclear how far it can be pushed

Page 49: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

e.g., Functions, OOP, Frameworks, DCOM, …e.g., Functions, OOP, Frameworks, DCOM, …

Page 50: A Characterization of Reuse Technologies

Essence of The Technology

ClassClass ElementsElements OperationsOperationsConcrete Reuse PL Struct. Concrete Reuse PL Struct. Hand Assem.Hand Assem.

Page 51: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

PatternDirected

ReorganizingSubsystem

LevelComponents

DerivedComponents

ConventionalComponents

Page 52: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

SubsystemLevel

Components

DerivedComponents

PatternDirected

ConventionalComponents

Page 53: A Characterization of Reuse Technologies

Concrete Components Small components don’t work wellSmall components don’t work well

Assembly work per unit payoff is lowAssembly work per unit payoff is low Small components specialized niches OKSmall components specialized niches OK

Overhead masked by human response (e.g., UI)Overhead masked by human response (e.g., UI) Standards or domain narrowness mitigateStandards or domain narrowness mitigate

Big components work wellBig components work well Programs or subsystemsPrograms or subsystems High programming leverageHigh programming leverage Payoff dominates overhead costsPayoff dominates overhead costs

Page 54: A Characterization of Reuse Technologies

Example: UI Controls

Page 55: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

SubsystemLevel

Components

ConventionalComponents

Page 56: A Characterization of Reuse Technologies

GenVoca derives a container

deque_usm = deq_sync [ deque2c [ dlist [ avail [ heap [ transient ]]]]];

ContainerClass

ElementClass

dlist

heap

deq-sync

deque2c

avail

transient

Refinements

List elements from heap

Deque

Synchronized deque

Container

Doubly linked list

Managed linked list

Transient elements

TypeEquation

Page 57: A Characterization of Reuse Technologies

Compositional Derivation Example domain: Data structuresExample domain: Data structures Benefits:Benefits:

Improve reuse by raising level of abstractionImprove reuse by raising level of abstraction Combinatorial amplification of library (horz.)Combinatorial amplification of library (horz.) Generation is fastGeneration is fast

Shortcomings:Shortcomings: Level of abstraction still lowLevel of abstraction still low Large grain components mitigate horz. scalingLarge grain components mitigate horz. scaling Dependencies limit extensibilityDependencies limit extensibility Inter-component optimization difficultInter-component optimization difficult

Page 58: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

SubsystemLevel

Components

DerivedComponents

ConventionalComponents

Page 59: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

e.g., Functions, OOP, Frameworks, DCOM, …e.g., Functions, OOP, Frameworks, DCOM, … Compositionally Derived Components Compositionally Derived Components

e.g., Templates, GenVoca, …e.g., Templates, GenVoca, … Pattern-directed transformation systemsPattern-directed transformation systems

e.g., Draco, CAPE, IP, DMS, ...e.g., Draco, CAPE, IP, DMS, ... Reorganizing generator systemsReorganizing generator systems

AO generator, AOP, ...AO generator, AOP, ...

Inference-driven generator systemsInference-driven generator systems Kids, Synapse, ...Kids, Synapse, ...

Page 60: A Characterization of Reuse Technologies

Inference-Based Generators

Paradigm: Schema + rules of inferenceParadigm: Schema + rules of inference Example: Divide-and-conquer schemaExample: Divide-and-conquer schema

Broad framework for solutionBroad framework for solution User specification: Formal specification User specification: Formal specification

(e.g., predicate calculus)(e.g., predicate calculus)

Page 61: A Characterization of Reuse Technologies

Inference-Based Generators Example: Kids generatorExample: Kids generator Benefits:Benefits:

Highest levels of horizontal scalingHighest levels of horizontal scaling Shortcomings:Shortcomings:

Formal specifications require ultra-stable Formal specifications require ultra-stable applicationapplication

Requires well-understood domain with deep theoryRequires well-understood domain with deep theory Immaturity and narrow => low vertical scaling Immaturity and narrow => low vertical scaling

Page 62: A Characterization of Reuse Technologies

Essence of The Technology

ClassClass ElementsElements OperationsOperationsConcrete Reuse PL Struct. Concrete Reuse PL Struct. Hand Assem.Hand Assem.CompositionComposition Abstract PL Abstract PL InliningInliningPD GeneratorPD Generator DSL Struct. DSL Struct. PD XformsPD XformsReorg Generator Tagged DSLReorg Generator Tagged DSL PDX & PDX &

TDXTDXInfer GeneratorInfer Generator DSL+Logic DSL+Logic InferenceInference

Page 63: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

SubsystemLevel

Components

DerivedComponents

PatternDirected

Reorganizing

InferenceBasedConventional

Components

Page 64: A Characterization of Reuse Technologies

Reuse Technologies Concrete componentsConcrete components

Limited islands of successful reuseLimited islands of successful reuse Compositionally Derived Components Compositionally Derived Components

More horizontal scaling but no inter-part reweavingMore horizontal scaling but no inter-part reweaving Pattern-directed transformation systemsPattern-directed transformation systems

Extends both but big search space for reweavingExtends both but big search space for reweaving Reorganizing generator systemsReorganizing generator systems

Reweavings gain horiz. scaling but immature Reweavings gain horiz. scaling but immature

Inference-driven generator systemsInference-driven generator systems Greatest horiz. scaling but formality limits useGreatest horiz. scaling but formality limits use

Page 65: A Characterization of Reuse Technologies

Essence of The Technology

ClassClass ElementsElements OperationsOperationsConcrete Reuse PL Struct. Concrete Reuse PL Struct. Hand Assem.Hand Assem.CompositionComposition Abstract PL Abstract PL InliningInliningPD GeneratorPD Generator DSL Struct. DSL Struct. PD XformsPD XformsReorg Generator Tagged DSLReorg Generator Tagged DSL PDX & PDX &

TDXTDX

Page 66: A Characterization of Reuse Technologies

Niches in the scaling plane

Vertical(Programming

leverage)

Horizontal (Optimality of fit)

SubsystemLevel

Components

DerivedComponents

PatternDirected

Reorganizing

InferenceBasedConventional

Components

Page 67: A Characterization of Reuse Technologies

Operators with Implicit ControlB=(A s)

Image A

B[i,j]=0

B[i,j]+

* s-1,-1

* s-1,0

* s-1,1

* s1,1

Page 68: A Characterization of Reuse Technologies

Non-Parallel Pseudo-Code

If (Off Edge)then t1 = 0else t1 = ( a[i-1, j-1]*(-1)+

a[i-1, j]*(-2) + a[i-1, j+1]*(-1)+ a[i+1, j-1]*1 + a[i+1, j]*2 + a[i+1, j+1]*1 ) ;

. . . code for t2 . . .

b[i,j] = sqrt((t1 * t1) + (t2 * t2));

Page 69: A Characterization of Reuse Technologies

Parallel Pseudo-Code

t1 = unpackadd(padd2(padd2(pmadd3(&(a[i-1,j-1]), &(s[-1, -1])),

pmadd3(&(a[i, j-1]), &(s[0, -1]))),

pmadd3(&(a[i+1,j-1]), &(s[ 1, -1])));

. . . code for t2 . . .

b[i,j] = sqrt((t1 * t1) + (t2 * t2));

Page 70: A Characterization of Reuse Technologies

AOG Features Schema language foundationSchema language foundation Pattern-driven & tag-driven transformsPattern-driven & tag-driven transforms

Organized by inheritance type and by stageOrganized by inheritance type and by stage Tags capture non-pattern-driven knowledgeTags capture non-pattern-driven knowledge Tags act like AST-localized interrupts for performing Tags act like AST-localized interrupts for performing

optimizationsoptimizations

TD’s are large-grain programmatic transformsTD’s are large-grain programmatic transforms Specialists: Partial evaluator & inference engineSpecialists: Partial evaluator & inference engine No explicit loopsNo explicit loops PerformancePerformance with small search spaceswith small search spaces

Page 71: A Characterization of Reuse Technologies

Generate Weight Matrices Create Loops, Unwrap, Partially EvaluateCreate Loops, Unwrap, Partially Evaluate dsdeclare dsarrayofint arr57391 dsdeclare dsarrayofint arr57391 [ -1, 1][ -1, 1] ((1 0 -1) (2 0 -2) (1 0 -1)) ;[ -1, 1][ -1, 1] ((1 0 -1) (2 0 -2) (1 0 -1)) ;

Page 72: A Characterization of Reuse Technologies

simplsimpl

{for (i = [0, (m – 1)], j =[0, (n – 1)], (i == 0)) {tmp1= 0; tmp2 = 0; b[i, j] = sqrt (( (tmp2 * tmp2) + (tmp1 *tmp1))) }}

{for (j =[0, (n – 1)] ) b[0, j] = 0}

Page 73: A Characterization of Reuse Technologies

Control Regimes

PD Search – Independent Local ChoicesPD Search – Independent Local Choices Strategically Blind – exploding search spaceStrategically Blind – exploding search space Biased Toward Local Syntactic StructureBiased Toward Local Syntactic Structure Rules are General & Allow Easy ExtensionRules are General & Allow Easy Extension

Page 74: A Characterization of Reuse Technologies

Results of Compositeleaf Xform

(leaf a (tags (itype image)))

(leaf bwpixel48143 (tags (_q (_forall (bwpixel48143) (aref (a) idx48146 idx48149))) (itype bwpixel)))

BeforeBefore

AfterAfter

Page 75: A Characterization of Reuse Technologies

Internal PD Transform View

See Bindings onPrevious Chart