FLOW ALGEBRA
Performance Optimisation Ontology
Kireth Semantic Research Archive
PAGE:
https://kirethresearch.org/booksai-core/ontologies/computing-ontologies/high-performance-computing/performance-optimisation-ontology.html
AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)
FLOW "PerformanceOptimisationOntology" v4.0
# ---------- DOMAIN ----------
DOMAIN := ComputingOntology
SUBDOMAIN := HighPerformanceComputing
ONTOLOGY := PerformanceOptimisationOntology
# ---------- PRIMARY ENTITY ----------
ENTITY PerformanceOptimisation {
definition:
"The systematic process of measuring computational behaviour,
identifying limiting factors and modifying algorithms, software,
resource use or execution configuration to improve performance while
preserving required correctness and operational constraints.";
objectives: [
ReduceExecutionTime,
IncreaseThroughput,
ImproveScalability,
ImproveResourceUtilisation,
ReduceDataMovement,
ReduceParallelOverhead
];
}
# ---------- CORE ENTITIES ----------
PerformanceMetric := {
ExecutionTime,
Throughput,
Latency,
Speedup,
ParallelEfficiency,
CPUUtilisation,
GPUUtilisation,
MemoryBandwidth,
NetworkBandwidth,
IOThroughput
};
PerformanceBottleneck := {
ComputeBottleneck,
MemoryBottleneck,
CommunicationBottleneck,
IOBottleneck,
SynchronisationBottleneck,
LoadImbalance,
SerialBottleneck
};
OptimisationTarget := {
Algorithm,
DataStructure,
MemoryAccess,
Communication,
Parallelism,
IO,
Scheduling,
HardwareUtilisation
};
# ---------- FUNDAMENTAL RELATIONSHIPS ----------
PerformanceOptimisation USES Measurement;
Measurement PRODUCES PerformanceMetric;
PerformanceMetric INDICATES SystemBehaviour;
Profiling IDENTIFIES PerformanceBottleneck;
PerformanceBottleneck LIMITS Performance;
OptimisationAction TARGETS PerformanceBottleneck;
Benchmark VALIDATES PerformanceChange;
# ---------- OPTIMISATION CYCLE ----------
OptimisationCycle :=
EstablishBaseline
-> Measure
-> Profile
-> IdentifyBottleneck
-> FormHypothesis
-> ApplyOptimisation
-> Benchmark
-> ValidateCorrectness
-> CompareResults
-> RepeatIfRequired;
PerformanceOptimisation SHOULD_BE EvidenceDriven;
# ---------- BASELINE ----------
PerformanceBaseline :=
MeasuredReferenceBehaviourBeforeChange;
Baseline MUST_DEFINE {
Workload,
InputSize,
Hardware,
SoftwareConfiguration,
MeasurementMethod
};
IF BaselineMissing
THEN OptimisationBenefit := difficult_to_validate;
# ---------- EXECUTION TIME ----------
ExecutionTime :=
EndTime - StartTime;
ExecutionTime MAY_BE_DECOMPOSED_INTO {
ComputeTime,
MemoryWaitTime,
CommunicationTime,
IOTime,
SynchronisationTime,
IdleTime
};
Optimisation MAY_TARGET DominantTimeComponent;
# ---------- THROUGHPUT ----------
Throughput :=
CompletedWork / Time;
IF CompletedWorkIncreasesForSameTime
THEN Throughput := INCREASE;
# ---------- LATENCY ----------
Latency :=
TimeFromRequestOrOperationStartToRequiredResult;
LatencyOptimisation MAY_DIFFER_FROM ThroughputOptimisation;
# ---------- PROFILING ----------
Profiling :=
ObserveRuntimeBehaviour
-> AttributeCost
-> RankHotspots;
Profiler MAY_MEASURE {
FunctionTime,
InstructionCount,
CacheMisses,
MemoryTraffic,
BranchBehaviour,
Communication,
IO
};
Hotspot :=
CodeOrOperationResponsibleForSignificantCost;
# ---------- COMPUTE BOTTLENECK ----------
ComputeBound :=
PerformanceLimitedPrimarilyByComputationRate;
IF ComputeUnitsHighlyUtilised
AND MemoryBandwidthNotSaturated
THEN ComputeBoundEvidence := INCREASE;
ComputeOptimisation MAY_INCLUDE {
AlgorithmImprovement,
Vectorisation,
Parallelisation,
AcceleratorUse,
ReducedInstructionCount
};
# ---------- MEMORY BOTTLENECK ----------
MemoryBound :=
PerformanceLimitedPrimarilyByMemoryAccess;
MemoryOptimisation MAY_INCLUDE {
ImproveDataLocality,
ReduceMemoryTraffic,
ImproveCacheReuse,
ChangeDataLayout,
IncreaseArithmeticIntensity
};
IF MemoryBandwidthNearMaximum
AND ComputeUnitsUnderutilised
THEN MemoryBoundEvidence := INCREASE;
# ---------- CACHE ----------
CacheLocality := {
TemporalLocality,
SpatialLocality
};
TemporalLocality :=
ReuseDataWithinShortTime;
SpatialLocality :=
AccessNearbyDataLocations;
ImprovedCacheLocality MAY_REDUCE MainMemoryTraffic;
# ---------- DATA LAYOUT ----------
DataLayout MAY_BE {
ArrayOfStructures,
StructureOfArrays,
TiledLayout,
ContiguousLayout
};
DataLayout AFFECTS {
CacheBehaviour,
Vectorisation,
MemoryBandwidth
};
# ---------- COMMUNICATION BOTTLENECK ----------
CommunicationBound :=
CommunicationCostDominatesUsefulComputation;
CommunicationCost :=
LatencyCost
+ DataTransferCost
+ SynchronisationCost;
CommunicationOptimisation MAY_INCLUDE {
ReduceMessageCount,
AggregateMessages,
ReduceTransferredData,
OverlapCommunicationWithCompute,
ImproveLocality
};
# ---------- IO BOTTLENECK ----------
IOBound :=
StorageOrFilesystemOperationsLimitPerformance;
IOOptimisation MAY_INCLUDE {
Buffering,
Batching,
ParallelIO,
DataCompression,
ReducedMetadataOperations,
ImprovedAccessPattern
};
# ---------- SYNCHRONISATION ----------
SynchronisationOverhead :=
TimeWaitingForCoordination;
Synchronisation MAY_INCLUDE {
Lock,
Barrier,
AtomicOperation,
CollectiveOperation
};
IF SynchronisationTimeHigh
THEN ParallelEfficiency := DECREASE;
# ---------- LOAD BALANCE ----------
LoadBalance :=
SimilarUsefulWorkAcrossParallelResources;
LoadImbalance :=
DifferenceInWorkOrCompletionTimeAcrossResources;
IF SomeResourcesIdleWhileOthersRemainBusy
THEN LoadImbalance := likely;
LoadBalancing MAY_BE {
Static,
Dynamic
};
# ---------- SERIAL FRACTION ----------
SerialFraction :=
PortionOfExecutionNotParallelised;
IF SerialFractionIncreases
THEN MaximumParallelSpeedup := DECREASE;
AmdahlSpeedup(P) :=
1 / (SerialFraction + ((1-SerialFraction)/P));
# ---------- SPEEDUP ----------
Speedup :=
BaselineExecutionTime
/ OptimisedExecutionTime;
IF Speedup > 1
THEN PerformanceImprovedForMeasuredWorkload := true;
# ---------- PARALLEL EFFICIENCY ----------
ParallelEfficiency(P) :=
Speedup(P) / P;
IF ResourceCountIncreases
AND EfficiencyFalls
THEN ScalingOverhead := INCREASE;
# ---------- STRONG SCALING ----------
StrongScaling :=
FixedProblemSize
+ IncreasingResources;
StrongScalingAnalysis MEASURES RuntimeVsResourceCount;
# ---------- WEAK SCALING ----------
WeakScaling :=
IncreaseProblemSizeWithResourceCount;
WeakScalingAnalysis MEASURES RuntimeAtApproximatelyConstantWorkPerResource;
# ---------- VECTORIZATION ----------
Vectorisation :=
ConvertScalarOperationsToVectorOperations;
IF LoopIterationsIndependent
AND MemoryAccessCompatible
THEN VectorisationPotential := INCREASE;
Vectorisation MAY_REDUCE InstructionOverhead;
# ---------- GPU / ACCELERATOR OPTIMISATION ----------
AcceleratorOptimisation MAY_INCLUDE {
IncreaseParallelOccupancy,
ImproveMemoryCoalescing,
ReduceHostDeviceTransfers,
IncreaseKernelWork,
ReduceDivergence
};
IF TransferTimeDominatesKernelTime
THEN AcceleratorBenefit := DECREASE;
# ---------- COMPILER OPTIMISATION ----------
CompilerOptimisation MAY_INCLUDE {
Inlining,
LoopTransformation,
Vectorisation,
DeadCodeElimination,
InstructionScheduling
};
CompilerOptimisation MUST_PRESERVE RequiredProgramSemantics;
# ---------- ALGORITHM OPTIMISATION ----------
AlgorithmicComplexity :=
GrowthOfResourceCostWithInputSize;
AlgorithmOptimisation MAY_PRODUCE GreaterBenefitThan LowLevelOptimisation;
IF BetterAsymptoticAlgorithmAvailable
THEN AlgorithmChange SHOULD_BE_EVALUATED;
# ---------- CONCURRENCY OPTIMISATION ----------
ConcurrencyOptimisation MAY_INCLUDE {
IncreaseIndependentWork,
ReduceLockContention,
ReduceCriticalSection,
ImproveTaskGranularity,
UseAsynchronousExecution
};
IF TaskGranularityTooFine
THEN SchedulingOverhead MAY_INCREASE;
# ---------- OVERLAP ----------
Overlap :=
ExecuteCommunicationOrIOConcurrentlyWithUsefulCompute;
IF CommunicationCanBeHiddenBehindCompute
THEN EffectiveCommunicationCost := DECREASE;
# ---------- RESOURCE UTILISATION ----------
ResourceUtilisation :=
UsedCapacity / AvailableCapacity;
HighUtilisation DOES_NOT_ALWAYS_MEAN HighEfficiency;
PerformanceOptimisation SHOULD_CONSIDER UsefulWorkPerResource;
# ---------- ENERGY PERFORMANCE ----------
EnergyToSolution :=
PowerConsumption * ExecutionTime;
EnergyEfficiency :=
UsefulWork / EnergyConsumed;
Optimisation MAY_TARGET {
TimeToSolution,
EnergyToSolution,
PerformancePerWatt
};
# ---------- BENCHMARKING ----------
Benchmark :=
ControlledWorkloadUsedToMeasurePerformance;
BenchmarkResult MUST_BE_INTERPRETED_WITH {
HardwareContext,
SoftwareContext,
InputContext,
MeasurementMethod
};
BenchmarkComparison SHOULD_USE ComparableConditions;
# ---------- CORRECTNESS ----------
OptimisedResult MUST_SATISFY RequiredCorrectness;
IF PerformanceImproves
AND ResultIncorrect
THEN Optimisation := Invalid;
# ---------- REGRESSION ----------
PerformanceRegression :=
NewExecutionPerformance WorseThanReference;
RegressionDetection :=
MeasureNewVersion
-> CompareBaseline
-> DetectSignificantDegradation;
# ---------- SEMANTIC REASONING ----------
IF ProfilingShowsSingleDominantHotspot
THEN OptimisationPriority := Hotspot;
IF MemoryBandwidthSaturated
THEN MemoryOptimisationPriority := HIGH;
IF CPUOrGPUUtilisationLow
AND WorkAvailable
THEN ParallelismOrStallIssue := evaluate;
IF CommunicationTimeHighRelativeToCompute
THEN CommunicationOptimisationPriority := HIGH;
IF LoadImbalanceHigh
THEN SchedulingOrPartitioningOptimisation := evaluate;
IF SerialFractionHigh
THEN AdditionalParallelResourcesHaveLimitedBenefit;
IF OptimisedExecutionTime < -BaselineExecutionTime
AND CorrectnessPreserved
THEN OptimisationValidated := true;
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
"performance optimisation" ~= "performance optimization";
"code optimisation" ~= "code optimization";
"performance tuning" ~= "computational performance tuning";
"hotspot" ~= "performance hotspot";
"memory bound" ~= "memory bandwidth limited" WHEN context == performance;
"compute bound" ~= "compute limited";
"load imbalance" ~= "parallel workload imbalance";
"time to solution" ~= "execution time to result";
}
# ---------- QUERY FLOW ----------
QUERY(q) ->
NORMALISE(q) ->
IDENTIFY_PERFORMANCE_METRICS(q) ->
IDENTIFY_BASELINE(q) ->
IDENTIFY_BOTTLENECK(q) ->
IDENTIFY_RESOURCE_UTILISATION(q) ->
IDENTIFY_SCALING(q) ->
IDENTIFY_OPTIMISATION_TARGET(q) ->
MAP_TO_ONTOLOGY(q) ->
APPLY_REASONING(q) ->
SCORE_CONFIDENCE(q) ->
RETURN_RELEVANT_KNOWLEDGE;
# ---------- CONFIDENCE ----------
CONFIDENCE(assertion) :=
weighted_mean(
source_reliability,
measurement_quality,
performance_consistency,
semantic_consistency,
evidence_strength,
contextual_relevance
);
CONFIDENCE >= 0.90 => HIGH;
CONFIDENCE >= 0.70 AND < 0.90 => MODERATE;
CONFIDENCE < 0.70 => REVIEW;
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION {
primary_entity: PerformanceOptimisation;
ontology: PerformanceOptimisationOntology;
parse_entities: true;
parse_relationships: true;
preserve_relationship_direction: true;
resolve_semantic_equivalence: true;
execute_reasoning_rules: true;
apply_confidence_weighting: true;
preserve_provenance: true;
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL {
new_measurement:
validate
-> identify_metric
-> identify_workload_context
-> associate_baseline
-> integrate;
new_bottleneck:
validate_evidence
-> classify
-> identify_affected_resource
-> identify_candidate_optimisations
-> integrate;
new_optimisation:
identify_target
-> record_change
-> benchmark
-> validate_correctness
-> compare_baseline
-> integrate;
performance_revision:
update_measurements
-> recompute_speedup
-> recompute_efficiency
-> update_bottleneck_model
-> regenerate_flow_hash;
conflict:
preserve_provenance
-> compare_measurement_conditions
-> adjust_confidence
-> flag_review;
}
# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
DOMAIN
+ SUBDOMAIN
+ ONTOLOGY
+ PerformanceMetric
+ PerformanceBottleneck
+ OptimisationTarget
+ OptimisationCycle
+ PerformanceBaseline
+ RELATIONSHIPS
+ SEMANTIC_REASONING
+ SEMANTIC_EQUIVALENCE
+ UPDATE_MODEL;
FLOW_HASH :=
HASH(FLOW_HASH_INPUT);
# ---------- TERMINAL ----------
PerformanceOptimisationOntology
-> EstablishPerformanceBaseline
-> MeasureExecution
-> ProfileRuntimeBehaviour
-> IdentifyDominantBottleneck
-> SelectOptimisationTarget
-> ApplyEvidenceBasedChange
-> BenchmarkOptimisedExecution
-> ValidateCorrectness
-> CompareAgainstBaseline
-> AnalyseScalingAndEfficiency
-> RepeatOptimisationCycle
-> PreserveValidatedPerformanceGain;
END FLOW
Download Code
Copy to Clipboard