-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_visualization.py
More file actions
executable file
·186 lines (167 loc) · 5.6 KB
/
Copy pathdemo_visualization.py
File metadata and controls
executable file
·186 lines (167 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env python3
"""
NeRArchSim Visualization Demo
Demonstrates all visualization capabilities including:
- Operator graph plotting
- Gantt chart visualization
- PPA dashboard creation
- Comprehensive analysis reports
"""
import json
import numpy as np
from pathlib import Path
from typing import Dict, Any
from .graph_plotter import OperatorGraphPlotter
from .gantt_plotter import GanttChartPlotter
from .ppa_dashboard import PPADashboard
from .schedule_visualizer import ScheduleVisualizer
def create_sample_data() -> Dict[str, Any]:
"""Create sample data for demonstration."""
# Sample execution DAG
execution_dag = {
'nodes': {
'op_1': {'op_type': 'HASH_ENCODE', 'hw_unit': 'hash_unit'},
'op_2': {'op_type': 'FIELD_COMPUTATION', 'hw_unit': 'mlp_engine'},
'op_3': {'op_type': 'SAMPLING', 'hw_unit': 'memory_controller'},
'op_4': {'op_type': 'BLENDING', 'hw_unit': 'rendering_unit'},
'op_5': {'op_type': 'VOLUME_RENDERING', 'hw_unit': 'rendering_unit'},
'op_6': {'op_type': 'MLP', 'hw_unit': 'mlp_engine'}
},
'edges': [
{'source': 'op_1', 'target': 'op_2'},
{'source': 'op_2', 'target': 'op_3'},
{'source': 'op_3', 'target': 'op_4'},
{'source': 'op_4', 'target': 'op_5'},
{'source': 'op_2', 'target': 'op_6'},
{'source': 'op_6', 'target': 'op_5'}
]
}
# Sample schedule data
schedule_data = {
'metadata': {
'operators_count': 6,
'total_execution_time': 150
},
'schedule': {
'operators': [
{
'op_id': 'op_1',
'hw_unit': 'hash_unit',
'start_cycle': 0,
'duration': 25
},
{
'op_id': 'op_2',
'hw_unit': 'mlp_engine',
'start_cycle': 25,
'duration': 40
},
{
'op_id': 'op_3',
'hw_unit': 'memory_controller',
'start_cycle': 65,
'duration': 15
},
{
'op_id': 'op_4',
'hw_unit': 'rendering_unit',
'start_cycle': 80,
'duration': 35
},
{
'op_id': 'op_5',
'hw_unit': 'rendering_unit',
'start_cycle': 115,
'duration': 35,
'is_critical_path': True
},
{
'op_id': 'op_6',
'hw_unit': 'mlp_engine',
'start_cycle': 65,
'duration': 30
}
]
}
}
# Sample PPA data
ppa_data = {
'system_metrics': {
'total_power_mw': 62.5,
'total_area_mm2': 8.4,
'performance_fps': 213.3,
'power_efficiency_fps_per_watt': 3413.0,
'area_efficiency_fps_per_mm2': 25.4
},
'operator_metrics': {
'op_1': {
'power_uw': 15000,
'area_um2': 850000,
'latency_cycles': 25,
'hw_unit': 'hash_unit',
'utilization': 0.167
},
'op_2': {
'power_uw': 18000,
'area_um2': 2100000,
'latency_cycles': 40,
'hw_unit': 'mlp_engine',
'utilization': 0.267
},
'op_3': {
'power_uw': 8000,
'area_um2': 450000,
'latency_cycles': 15,
'hw_unit': 'memory_controller',
'utilization': 0.1
},
'op_4': {
'power_uw': 12000,
'area_um2': 1200000,
'latency_cycles': 35,
'hw_unit': 'rendering_unit',
'utilization': 0.233
},
'op_5': {
'power_uw': 15000,
'area_um2': 1200000,
'latency_cycles': 35,
'hw_unit': 'rendering_unit',
'utilization': 0.233
},
'op_6': {
'power_uw': 10000,
'area_um2': 2100000,
'latency_cycles': 30,
'hw_unit': 'mlp_engine',
'utilization': 0.2
}
}
}
return {
'execution_dag': execution_dag,
'schedule_data': schedule_data,
'ppa_data': ppa_data
}
def demo_visualization_suite():
"""Demonstrate the complete visualization suite."""
print("🎨 NeRArchSim Visualization Suite Demo")
print("=" * 60)
# Create sample data
sample_data = create_sample_data()
# Initialize schedule visualizer
visualizer = ScheduleVisualizer(output_dir="demo_visualization_output")
# Create complete analysis
print("\n🎯 Creating Complete Analysis Report...")
output_files = visualizer.create_complete_analysis(
schedule_data=sample_data['schedule_data'],
ppa_data=sample_data['ppa_data'],
execution_dag=sample_data['execution_dag'],
report_name="demo_neural_rendering"
)
print(f"\n📈 Generated {len(output_files)} visualization files")
print("\n🎉 Demo completed successfully!")
print("📁 Check demo_visualization_output/ directory for results")
return output_files
if __name__ == "__main__":
demo_visualization_suite()