Repository navigation
Expand file tree
/
Copy pathrender_progress.py
More file actions
6811 lines (6528 loc) · 347 KB
/
Copy pathrender_progress.py
File metadata and controls
6811 lines (6528 loc) · 347 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""Render deterministic, dependency-free SVGs for the optimization log."""
from __future__ import annotations
import argparse
import csv
import html
import json
import math
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
RESULTS = ROOT / "results.tsv"
PROGRESS = ROOT / "assets" / "progress.svg"
BOTTLENECK = ROOT / "assets" / "bottleneck-map.svg"
BF16_RESULTS = ROOT / "bf16-results.tsv"
BF16_CHART = ROOT / "assets" / "bf16-gemm.svg"
BF16_POLICY_RESULTS = ROOT / "bf16-model-policy.tsv"
BF16_POLICY_CHART = ROOT / "assets" / "bf16-model-policy.svg"
BF16_FFN_SUMMARY = ROOT / "experiments" / "030-data" / "summary.json"
BF16_FFN_CHART = ROOT / "assets" / "bf16-ffn-island.svg"
BF16_MODEL_SUMMARY = ROOT / "experiments" / "031-data" / "summary.json"
BF16_MODEL_CHART = ROOT / "assets" / "bf16-model-inference.svg"
BF16_PREFILL_SUMMARY = ROOT / "experiments" / "032-data" / "summary.json"
BF16_PREFILL_CHART = ROOT / "assets" / "bf16-prefill-allocator.svg"
BF16_ATTENTION_SUMMARY = ROOT / "experiments" / "034-data" / "summary.json"
BF16_ATTENTION_PILOT = ROOT / "experiments" / "034-data" / "naive-pilot.jsonl"
BF16_ATTENTION_CHART = ROOT / "assets" / "bf16-attention.svg"
BF16_PLAN_SUMMARY = ROOT / "experiments" / "036-data" / "summary.json"
BF16_PLAN_CHART = ROOT / "assets" / "bf16-plan-cache.svg"
BF16_TRAINING_SUMMARY = ROOT / "experiments" / "037-data" / "summary.json"
BF16_TRAINING_CHART = ROOT / "assets" / "bf16-training.svg"
BF16_TRAINING_QKV_SUMMARY = ROOT / "experiments" / "039-data" / "summary.json"
BF16_TRAINING_QKV_CHART = ROOT / "assets" / "bf16-training-qkv-discard.svg"
BF16_TRAINING_MIRROR_SUMMARY = ROOT / "experiments" / "040-data" / "summary.json"
BF16_TRAINING_MIRROR_CHART = ROOT / "assets" / "bf16-training-mirrors.svg"
BF16_TRAINING_ISLAND_SUMMARY = ROOT / "experiments" / "041-data" / "summary.json"
BF16_TRAINING_ISLAND_CHART = ROOT / "assets" / "bf16-training-ffn-island-discard.svg"
BF16_TRAINING_SHAPE_SUMMARY = ROOT / "experiments" / "042-data" / "summary.json"
BF16_TRAINING_SHAPE_CHART = ROOT / "assets" / "bf16-training-shape-matrix.svg"
BF16_WEIGHT_GRADIENT_COMPARISON = ROOT / "experiments" / "043-data" / "comparison.json"
BF16_WEIGHT_GRADIENT_CHART = ROOT / "assets" / "bf16-weight-gradient-routing.svg"
FUSED_CAUSAL_GQA_COMPARISON = ROOT / "experiments" / "044-data" / "comparison.json"
FUSED_CAUSAL_GQA_CHART = ROOT / "assets" / "fused-causal-gqa-training.svg"
DEEPSEEK_SHAPE_SUMMARY = ROOT / "experiments" / "045-data" / "candidate" / "summary.json"
DEEPSEEK_LOAD_SUMMARY = ROOT / "experiments" / "045-data" / "load-summary.json"
DEEPSEEK_SHAPE_CHART = ROOT / "assets" / "deepseek-training-shapes.svg"
DEEPSEEK_PROFILE_SUMMARY = ROOT / "experiments" / "046-data" / "profile-summary.json"
DEEPSEEK_PROFILE_CHART = ROOT / "assets" / "deepseek-context128-profile.svg"
STABLE_GRADIENT_COMPARISON = ROOT / "experiments" / "047-data" / "comparison.json"
STABLE_GRADIENT_CHART = ROOT / "assets" / "stable-gradient-buffer-discard.svg"
CHUNKED_ADAMW_COMPARISON = ROOT / "experiments" / "048-data" / "comparison.json"
CHUNKED_ADAMW_CHART = ROOT / "assets" / "chunked-adamw-discard.svg"
VECTORIZED_ADAMW_COMPARISON = ROOT / "experiments" / "049-data" / "comparison.json"
VECTORIZED_ADAMW_CHART = ROOT / "assets" / "vectorized-adamw-explicit.svg"
STREAMING_LOAD_COMPARISON = ROOT / "experiments" / "050-data" / "comparison.json"
STREAMING_LOAD_CHART = ROOT / "assets" / "streaming-safetensors-load.svg"
CONTEXT512_COMPARISON = ROOT / "experiments" / "051-data" / "comparison.json"
CONTEXT512_PROFILE = ROOT / "experiments" / "051-data" / "profile-summary.json"
CONTEXT512_CHART = ROOT / "assets" / "context512-training-profile.svg"
SPLIT_KV_COMPARISON = ROOT / "experiments" / "052-data" / "comparison.json"
SPLIT_KV_CHART = ROOT / "assets" / "split-kv-backward-discard.svg"
BATCHED_GEMM_COMPARISON = ROOT / "experiments" / "053-data" / "comparison.json"
BATCHED_GEMM_CHART = ROOT / "assets" / "strided-batched-hipblaslt.svg"
BATCHED_BACKWARD_COMPARISON = ROOT / "experiments" / "054-data" / "comparison.json"
BATCHED_BACKWARD_PROFILE = ROOT / "experiments" / "054-data" / "profile-summary.json"
BATCHED_BACKWARD_CHART = ROOT / "assets" / "batched-attention-backward.svg"
SAVED_ATTENTION_COMPARISON = ROOT / "experiments" / "055-data" / "comparison.json"
SAVED_ATTENTION_PROFILE = ROOT / "experiments" / "055-data" / "profile-summary.json"
SAVED_ATTENTION_CHART = ROOT / "assets" / "saved-attention-probabilities.svg"
BF16_ADAMW_SUMMARY = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-bf16-adamw-moments" / "formal" /
"summary.json")
BF16_ADAMW_CHART = ROOT / "assets" / "bf16-adamw-moments.svg"
HYBRID_ADAMW_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-hybrid-bf16-adamw")
HYBRID_ADAMW_CHART = ROOT / "assets" / "hybrid-bf16-adamw.svg"
POST_HYBRID_PROFILE_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-post-hybrid-training-profile")
POST_HYBRID_PROFILE_CHART = ROOT / "assets" / "post-hybrid-training-profile.svg"
GROUPED_WGRAD_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-grouped-weight-gradient-discard")
GROUPED_WGRAD_CHART = ROOT / "assets" / "grouped-weight-gradient-discard.svg"
PACKED_WGRAD_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-packed-weight-gradient-discard")
PACKED_WGRAD_CHART = ROOT / "assets" / "packed-weight-gradient-discard.svg"
FP32_WGRAD_SOLUTION_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-fp32-weight-gradient-solutions")
FP32_WGRAD_SOLUTION_CHART = (
ROOT / "assets" / "fp32-weight-gradient-solutions-discard.svg")
TRAINING_GRAPH_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-training-graph-capture")
TRAINING_GRAPH_CHART = ROOT / "assets" / "training-graph-capture-boundary.svg"
ADAMW_GRAPH_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-adamw-graph-replay")
ADAMW_GRAPH_CHART = ROOT / "assets" / "adamw-graph-replay.svg"
ADAMW_GRAPH_MULTI_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-adamw-graph-multi")
ADAMW_GRAPH_MULTI_CHART = ROOT / "assets" / "adamw-graph-multi.svg"
GRADIENT_ADDRESS_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-gradient-address-stability")
GRADIENT_ADDRESS_CHART = ROOT / "assets" / "gradient-address-stability.svg"
OPTIMIZER_GRAPH_PREFLIGHT_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-optimizer-graph-model-preflight")
OPTIMIZER_GRAPH_PREFLIGHT_CHART = (
ROOT / "assets" / "optimizer-graph-model-preflight.svg")
QUIESCENT_HANDOFF_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-quiescent-allocator-handoff")
QUIESCENT_HANDOFF_CHART = ROOT / "assets" / "quiescent-allocator-handoff.svg"
OPTIMIZER_GRAPH_MODEL_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-24-optimizer-graph-model-gate")
OPTIMIZER_GRAPH_MODEL_CHART = ROOT / "assets" / "optimizer-graph-model-gate.svg"
ROCWMMA_QK_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-rocwmma-qk-tile")
ROCWMMA_QK_CHART = ROOT / "assets" / "rocwmma-qk-tile.svg"
ROCWMMA_ONLINE_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-rocwmma-online-attention")
ROCWMMA_ONLINE_CHART = ROOT / "assets" / "rocwmma-online-attention.svg"
ROCWMMA_OPERATOR_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-rocwmma-online-operator")
ROCWMMA_OPERATOR_CHART = ROOT / "assets" / "rocwmma-online-operator.svg"
ROCWMMA_MODEL_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-rocwmma-online-model-gate")
ROCWMMA_MODEL_CHART = ROOT / "assets" / "rocwmma-online-model-discard.svg"
ROCWMMA_DIRECT_MODEL_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-rocwmma-direct-bf16-model-gate")
ROCWMMA_DIRECT_MODEL_CHART = (
ROOT / "assets" / "rocwmma-direct-bf16-model-discard.svg")
CURRENT_INFERENCE_PROFILE_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-current-inference-profile")
CURRENT_INFERENCE_PROFILE_CHART = (
ROOT / "assets" / "current-inference-profile.svg")
FP32_ATTENTION_T1024_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-fp32-attention-t1024-solutions")
FP32_ATTENTION_T1024_MODEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-fp32-attention-t1024-qk-model-gate")
FP32_ATTENTION_T1024_CHART = (
ROOT / "assets" / "fp32-attention-t1024-discard.svg")
BF16_SWIGLU_VECTOR_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-swiglu-vector-operator")
BF16_SWIGLU_VECTOR_MODEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-swiglu-vector-model-gate")
BF16_SWIGLU_VECTOR_CHART = ROOT / "assets" / "bf16-swiglu-vector-discard.svg"
BF16_GROUPED_SWISH_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-grouped-swish-operator")
BF16_GROUPED_SWISH_MODEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-grouped-swish-model-gate")
BF16_GROUPED_SWISH_CHART = ROOT / "assets" / "bf16-grouped-swish-discard.svg"
BF16_RMS_NORM_OUTPUT_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-rms-norm-output-operator")
BF16_RMS_NORM_OUTPUT_CHART = ROOT / "assets" / "bf16-rms-norm-output.svg"
BF16_FFN_NORM_MODEL_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-ffn-norm-model-gate")
BF16_FFN_NORM_MODEL_CHART = ROOT / "assets" / "bf16-ffn-norm-model.svg"
POST_BF16_FFN_NORM_PROFILE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-post-bf16-ffn-norm-profile")
POST_BF16_FFN_NORM_PROFILE_CHART = (
ROOT / "assets" / "post-bf16-ffn-norm-profile.svg")
BF16_ATTENTION_NORM_MODEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-attention-norm-model-gate")
BF16_ATTENTION_NORM_MODEL_CHART = (
ROOT / "assets" / "bf16-attention-norm-model.svg")
POST_BF16_ATTENTION_NORM_PROFILE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-post-bf16-attention-norm-profile")
POST_BF16_ATTENTION_NORM_PROFILE_CHART = (
ROOT / "assets" / "post-bf16-attention-norm-profile.svg")
BF16_PV_OUTPUT_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-pv-output-capability")
BF16_PV_OUTPUT_CHART = ROOT / "assets" / "bf16-pv-output-discard.svg"
BF16_VALUE_PV_ROOT = (ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-value-pv-capability")
BF16_VALUE_PV_CHART = ROOT / "assets" / "bf16-value-pv-discard.svg"
INFERENCE_LOCAL_SATURATION_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-inference-local-saturation")
INFERENCE_LOCAL_SATURATION_CHART = (
ROOT / "assets" / "inference-local-saturation.svg")
CURRENT_TRAINING_PROFILE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-current-training-profile")
CURRENT_TRAINING_PROFILE_CHART = (
ROOT / "assets" / "current-training-profile.svg")
BF16_WGRAD_SHAPE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-weight-gradient-operator")
BF16_WGRAD_SHAPE_CHART = (
ROOT / "assets" / "bf16-weight-gradient-shapes.svg")
BF16_WGRAD_MODEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-weight-gradient-model-gate")
BF16_WGRAD_MODEL_CHART = (
ROOT / "assets" / "bf16-weight-gradient-model.svg")
BF16_WGRAD_TRAJECTORY_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-weight-gradient-trajectory")
BF16_WGRAD_TRAJECTORY_CHART = (
ROOT / "assets" / "bf16-weight-gradient-trajectory-discard.svg")
BF16_WGRAD_ALLOCATION_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-weight-gradient-allocation-attribution")
BF16_WGRAD_ALLOCATION_CHART = (
ROOT / "assets" / "bf16-weight-gradient-allocation-attribution.svg")
BF16_WGRAD_WORKSPACE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-bf16-weight-gradient-workspace-gate")
BF16_WGRAD_WORKSPACE_CHART = (
ROOT / "assets" / "bf16-weight-gradient-workspace-discard.svg")
TRAINING_LOCAL_SATURATION_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-training-local-saturation")
TRAINING_LOCAL_SATURATION_CHART = (
ROOT / "assets" / "training-local-saturation.svg")
CURRENT_DATA_PARALLEL_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-current-data-parallel")
CURRENT_DATA_PARALLEL_CHART = (
ROOT / "assets" / "current-data-parallel-audit.svg")
DATA_PARALLEL_VERIFICATION_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-verification-matrix")
DATA_PARALLEL_VERIFICATION_CHART = (
ROOT / "assets" / "data-parallel-verification-interval.svg")
DATA_PARALLEL_BUCKET_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-bucket-matrix")
DATA_PARALLEL_BUCKET_CHART = (
ROOT / "assets" / "data-parallel-bucket-matrix.svg")
DATA_PARALLEL_MODEL_S_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-model-s-bucket-matrix")
DATA_PARALLEL_MODEL_S_CHART = (
ROOT / "assets" / "data-parallel-model-s-buckets.svg")
DATA_PARALLEL_COPY_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-bucket-copy-attribution")
DATA_PARALLEL_COPY_CHART = (
ROOT / "assets" / "data-parallel-bucket-copy-attribution.svg")
DATA_PARALLEL_INPLACE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-inplace-average")
DATA_PARALLEL_INPLACE_CHART = (
ROOT / "assets" / "data-parallel-inplace-average.svg")
DATA_PARALLEL_PERSISTENT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-persistent-buckets")
DATA_PARALLEL_PERSISTENT_CHART = (
ROOT / "assets" / "data-parallel-persistent-buckets.svg")
DATA_PARALLEL_GRADIENT_VIEW_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-gradient-views")
DATA_PARALLEL_GRADIENT_VIEW_CHART = (
ROOT / "assets" / "data-parallel-gradient-bucket-views.svg")
DATA_PARALLEL_DIRECT_GRADIENT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-direct-bucket-gradients")
DATA_PARALLEL_DIRECT_GRADIENT_CHART = (
ROOT / "assets" / "data-parallel-direct-bucket-gradient-discard.svg")
GRADIENT_PRODUCER_OUT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-gradient-producer-out-matrix")
GRADIENT_PRODUCER_OUT_CHART = (
ROOT / "assets" / "gradient-producer-out-matrix.svg")
AUTOGRAD_GRADIENT_PRODUCER_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-autograd-gradient-producer-matrix")
AUTOGRAD_GRADIENT_PRODUCER_CHART = (
ROOT / "assets" / "scoped-autograd-gradient-producer-discard.svg")
DATA_PARALLEL_GRADIENT_READY_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-gradient-ready-audit")
DATA_PARALLEL_GRADIENT_READY_CHART = (
ROOT / "assets" / "data-parallel-gradient-ready-order.svg")
DATA_PARALLEL_GRADIENT_OVERLAP_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-data-parallel-gradient-overlap")
DATA_PARALLEL_GRADIENT_OVERLAP_CHART = (
ROOT / "assets" / "data-parallel-gradient-overlap.svg")
RANKED_TRAINING_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-training-bootstrap")
RANKED_TRAINING_CHART = (
ROOT / "assets" / "one-process-per-gpu-bootstrap.svg")
RANKED_BUCKET_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-gradient-buckets")
RANKED_BUCKET_CHART = ROOT / "assets" / "ranked-gradient-buckets.svg"
RANKED_MODEL_S_BUCKET_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-model-s-buckets")
RANKED_MODEL_S_BUCKET_CHART = (
ROOT / "assets" / "ranked-model-s-buckets.svg")
RANKED_STEADY_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-model-s-steady-reducer")
RANKED_STEADY_CHART = (
ROOT / "assets" / "ranked-steady-reducer-discard.svg")
RANKED_PERSISTENT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-persistent-buckets")
RANKED_PERSISTENT_CHART = (
ROOT / "assets" / "ranked-persistent-buckets.svg")
RANKED_VIEW_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-gradient-views")
RANKED_VIEW_CHART = (
ROOT / "assets" / "ranked-gradient-bucket-views.svg")
RANKED_OVERLAP_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-gradient-overlap")
RANKED_OVERLAP_CHART = (
ROOT / "assets" / "ranked-gradient-overlap-discard.svg")
RANKED_CONTEXT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-overlap-contexts")
RANKED_CONTEXT_CHART = (
ROOT / "assets" / "ranked-overlap-context-scale.svg")
RANKED_CHECKPOINT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-checkpoint-resume")
RANKED_CHECKPOINT_CHART = (
ROOT / "assets" / "ranked-checkpoint-resume.svg")
RANKED_MODEL_S_CHECKPOINT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-model-s-checkpoint")
RANKED_MODEL_S_CHECKPOINT_CHART = (
ROOT / "assets" / "ranked-model-s-checkpoint.svg")
RANKED_WORLD_SIZE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-world-size")
RANKED_WORLD_SIZE_CHART = (
ROOT / "assets" / "ranked-world-size-boundary.svg")
RANKED_PREFLIGHT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-rccl-preflight")
RANKED_PREFLIGHT_CHART = (
ROOT / "assets" / "ranked-rccl-preflight.svg")
RANKED_INPUT_WEIGHT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-input-weighting")
RANKED_INPUT_WEIGHT_CHART = (
ROOT / "assets" / "ranked-input-weighting.svg")
RANKED_MODEL_S_INPUT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-model-s-input-weighting")
RANKED_MODEL_S_INPUT_CHART = (
ROOT / "assets" / "ranked-model-s-input-weighting.svg")
RANKED_WEIGHTED_OVERLAP_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-weighted-overlap")
RANKED_WEIGHTED_OVERLAP_CHART = (
ROOT / "assets" / "ranked-weighted-overlap-discard.svg")
RANKED_BUCKET_WEIGHT_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-bucket-weighting")
RANKED_BUCKET_WEIGHT_CHART = (
ROOT / "assets" / "ranked-bucket-weighting.svg")
RANKED_GATHER_SCALE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-ranked-gather-scale")
RANKED_GATHER_SCALE_CHART = (
ROOT / "assets" / "ranked-gather-scale-discard.svg")
CURRENT_DEEPSEEK_T2048_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-current-deepseek-t2048")
CURRENT_DEEPSEEK_T2048_PROFILE_ROOT = (
ROOT.parents[1] / "benchmarks" / "results" /
"2026-08-25-current-deepseek-t2048-profile")
CURRENT_DEEPSEEK_T2048_CHART = (
ROOT / "assets" / "current-deepseek-t2048-profile.svg")
def rows() -> list[dict]:
with RESULTS.open(encoding="utf-8", newline="") as stream:
return list(csv.DictReader(stream, delimiter="\t"))
def esc(value: object) -> str:
return html.escape(str(value), quote=True)
def text(x: float, y: float, value: object, size: int = 18, color: str = "#172033",
anchor: str = "start", weight: int = 400, rotate: int | None = None) -> str:
transform = f' transform="rotate({rotate} {x:.1f} {y:.1f})"' if rotate else ""
return (f'<text x="{x:.1f}" y="{y:.1f}" font-family="Inter,Arial,sans-serif" '
f'font-size="{size}" fill="{color}" text-anchor="{anchor}" '
f'font-weight="{weight}"{transform}>{esc(value)}</text>')
def progress_svg(data: list[dict]) -> str:
width, height = 1600, 900
chart_x, chart_y, chart_w, chart_h = 90, 130, 930, 500
bar_x, bar_y, bar_w, bar_h = 1100, 165, 420, 420
max_experiment = max(12, max(int(row["experiment"]) for row in data) + 1)
y_max = max(1.0, math.ceil(max(float(row["score"]) for row in data) * 2.0) / 2.0)
def px(experiment: int) -> float:
return chart_x + chart_w * experiment / max_experiment
def py(score: float) -> float:
return chart_y + chart_h * (y_max - score) / y_max
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "microLLM-rocm Optimization Progress", 30, anchor="middle", weight=700),
text(width / 2, 79,
f'{len(data)} measured experiment(s) · target: selected-matrix PyTorch parity',
17, "#5b6474", anchor="middle"),
]
# Main running-best plot.
parts.append(f'<rect x="{chart_x}" y="{chart_y}" width="{chart_w}" height="{chart_h}" '
'fill="#ffffff" stroke="#cbd3df" rx="8"/>')
tick_step = 0.5 if y_max > 1.5 else 0.25
for index in range(int(round(y_max / tick_step)) + 1):
tick = index * tick_step
y = py(tick)
parts.append(f'<line x1="{chart_x}" y1="{y:.1f}" x2="{chart_x + chart_w}" '
f'y2="{y:.1f}" stroke="#e5e9f0"/>')
parts.append(text(chart_x - 14, y + 6, f"{tick:.2f}", 15, "#5b6474", anchor="end"))
for tick in range(0, max_experiment + 1, 2):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="{chart_y}" x2="{x:.1f}" '
f'y2="{chart_y + chart_h}" stroke="#f0f2f6"/>')
parts.append(text(x, chart_y + chart_h + 28, tick, 14, "#5b6474", anchor="middle"))
parity_y = py(1.0)
parts.append(f'<line x1="{chart_x}" y1="{parity_y:.1f}" x2="{chart_x + chart_w}" '
f'y2="{parity_y:.1f}" stroke="#2563eb" stroke-width="2" '
'stroke-dasharray="9 7"/>')
parts.append(text(chart_x + chart_w - 12, parity_y - 10, "PyTorch parity 1.0×", 15,
"#2563eb", anchor="end", weight=600))
best_points: list[tuple[float, float]] = []
running_best = -1.0
colors = {"baseline": "#18a558", "keep": "#18a558", "discard": "#c8ced8",
"crash": "#dc2626", "invalid": "#f97316"}
for row in data:
experiment = int(row["experiment"])
score = float(row["score"])
status = row["status"]
x, y = px(experiment), py(score)
if status in {"baseline", "keep"} and score > running_best:
if best_points:
old_x, old_y = best_points[-1]
parts.append(f'<path d="M {old_x:.1f} {old_y:.1f} H {x:.1f} V {y:.1f}" '
'fill="none" stroke="#4ec27e" stroke-width="4"/>')
best_points.append((x, y))
running_best = score
if status in {"crash", "invalid"}:
parts.append(f'<path d="M {x-7:.1f} {y-7:.1f} L {x+7:.1f} {y+7:.1f} '
f'M {x+7:.1f} {y-7:.1f} L {x-7:.1f} {y+7:.1f}" '
f'stroke="{colors[status]}" stroke-width="4"/>')
else:
stroke = "#0e6938" if status in {"baseline", "keep"} else "#aeb6c2"
parts.append(f'<circle cx="{x:.1f}" cy="{y:.1f}" r="8" '
f'fill="{colors[status]}" stroke="{stroke}" stroke-width="2"/>')
if status in {"baseline", "keep"}:
parts.append(text(x + 12, y - 12, row["description"], 14, "#16834a",
rotate=-24))
parts.append(text(chart_x + chart_w / 2, chart_y + chart_h + 65, "Experiment #", 17,
anchor="middle", weight=600))
parts.append(text(28, chart_y + chart_h / 2, "Geometric throughput parity score", 17,
anchor="middle", weight=600, rotate=-90))
# Legend.
legend_y = 105
for offset, (label, color) in enumerate((("Kept", "#18a558"),
("Discarded", "#c8ced8"),
("Crash / invalid", "#dc2626"))):
x = 720 + offset * 150
parts.append(f'<circle cx="{x}" cy="{legend_y}" r="6" fill="{color}"/>')
parts.append(text(x + 12, legend_y + 5, label, 14, "#5b6474"))
# Current workload bars use the latest kept/baseline row.
current = next(row for row in reversed(data) if row["status"] in {"baseline", "keep"})
workloads = (
("Qwen train", float(current["qwen_train"])),
("Qwen generate", float(current["qwen_generate"])),
("DeepSeek train", float(current["deepseek_train"])),
("DeepSeek generate", float(current["deepseek_generate"])),
)
parts.append(text(bar_x, 126, "Current workload parity", 21, weight=700))
for index, (label, value) in enumerate(workloads):
y = bar_y + index * 92
parts.append(text(bar_x, y, label, 16, weight=600))
parts.append(f'<rect x="{bar_x}" y="{y+14}" width="{bar_w}" height="24" '
'rx="5" fill="#e7ebf1"/>')
parts.append(f'<rect x="{bar_x}" y="{y+14}" width="{bar_w*min(value,1.0):.1f}" '
'height="24" rx="5" fill="#4ec27e"/>')
parts.append(text(bar_x + bar_w, y + 33, f"{value:.3f}×", 15, "#172033",
anchor="end", weight=700))
parts.append(f'<line x1="{bar_x+bar_w}" y1="{bar_y+5}" x2="{bar_x+bar_w}" '
f'y2="{bar_y+bar_h}" stroke="#2563eb" stroke-width="2" '
'stroke-dasharray="6 5"/>')
# Roadmap ribbon: labels are plans, not measured points.
roadmap = (("M0", "Baseline", "complete"), ("M1", "Serial kernels", "complete"),
("M2", "Data movement", "complete"), ("M3", "Fused ops", "active"),
("M4", "BF16 / FP8", "planned"), ("M5", "HIP Graph", "planned"))
box_w, gap, start_x, y = 220, 24, 90, 735
parts.append(text(start_x, y - 25, "Roadmap (planned boxes are not results)", 18,
weight=700))
for index, (milestone, label, status) in enumerate(roadmap):
x = start_x + index * (box_w + gap)
fill = "#e0f6e9" if status == "complete" else "#fff1dc" if status == "active" else "#f0f2f6"
stroke = "#18a558" if status == "complete" else "#f97316" if status == "active" else "#c4cbd6"
parts.append(f'<rect x="{x}" y="{y}" width="{box_w}" height="88" rx="10" '
f'fill="{fill}" stroke="{stroke}" stroke-width="2"/>')
parts.append(text(x + 18, y + 31, milestone, 18,
"#16834a" if status == "complete" else "#d45d00" if status == "active" else "#6b7280", weight=700))
parts.append(text(x + 18, y + 61, label, 16, "#172033", weight=600))
parts.append(text(90, 875, "Generated from docs/optimization-log/results.tsv · higher is better",
14, "#6b7280"))
parts.append("</svg>\n")
return "\n".join(parts)
def bottleneck_svg() -> str:
parts = [
'<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="760" viewBox="0 0 1600 760">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(800, 45, "Baseline Bottleneck Map → Target Architecture", 30,
anchor="middle", weight=700),
text(400, 95, "Training: measured Qwen kernel share", 21, anchor="middle", weight=700),
text(1200, 95, "Generation: measured Qwen kernel share", 21, anchor="middle", weight=700),
]
def box(x, y, w, h, title, subtitle, fill, stroke):
parts.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="12" '
f'fill="{fill}" stroke="{stroke}" stroke-width="2"/>')
parts.append(text(x + 18, y + 32, title, 18, "#172033", weight=700))
parts.append(text(x + 18, y + 61, subtitle, 15, "#5b6474"))
# Training column.
box(90, 130, 620, 82, "CrossEntropy forward + backward", "75.7% · single GPU thread over vocabulary",
"#fee2e2", "#dc2626")
box(90, 232, 620, 82, "Weight/view strided copies", "8.4% · transpose().contiguous()",
"#ffedd5", "#f97316")
box(90, 334, 620, 82, "RMSNorm forward + backward", "10.2% · one thread per row",
"#ffedd5", "#f97316")
box(90, 436, 620, 82, "AdamW", "1.5% · already device native",
"#e0f6e9", "#18a558")
# Generation column.
box(890, 130, 620, 82, "Tied output transpose copy", "43.4% · about 544 MB per cached forward",
"#fee2e2", "#dc2626")
box(890, 232, 620, 82, "RMSNorm", "37.7% · 539 serial row kernels in trace",
"#fee2e2", "#dc2626")
box(890, 334, 620, 82, "KV Cache + physical GQA expansion", "CPU concatenate / expand / copy back",
"#ffedd5", "#f97316")
box(890, 436, 620, 82, "Allocator and launch churn", "7407 alloc · 7403 free · 4099 launches",
"#ffedd5", "#f97316")
parts.append('<path d="M 400 545 V 590 H 600 V 618" fill="none" stroke="#64748b" '
'stroke-width="3" marker-end="url(#arrow)"/>')
parts.append('<path d="M 1200 545 V 590 H 1000 V 618" fill="none" stroke="#64748b" '
'stroke-width="3" marker-end="url(#arrow)"/>')
parts.append('<defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" '
'refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" fill="#64748b"/>'
'</marker></defs>')
box(300, 625, 1000, 92, "Target", "parallel reductions · transpose-aware GEMM · device KV/GQA · pooled memory · fused ops",
"#dbeafe", "#2563eb")
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_svg() -> str:
with BF16_RESULTS.open(encoding="utf-8", newline="") as stream:
data = list(csv.DictReader(stream, delimiter="\t"))
width = 1500
height = max(700, 220 + len(data) * 96)
left, top, chart_w = 360, 125, 980
chart_bottom = top + len(data) * 96 - 40
axis_y = chart_bottom + 30
minimum, maximum = 0.75, 1.20
px = lambda value: left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "MI300X BF16 Mixed GEMM · M=1", 30,
anchor="middle", weight=700),
text(width / 2, 80, "Includes FP32→BF16 activation cast · FP32 output", 16,
"#5b6474", anchor="middle"),
]
for tick in (0.8, 0.9, 1.0, 1.1, 1.2):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="105" x2="{x:.1f}" y2="{chart_bottom}" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>' )
parts.append(text(x, axis_y, f"{tick:.1f}×", 14, "#5b6474", anchor="middle"))
for index, row in enumerate(data):
y = top + index * 96
speedup = float(row["speedup"])
x0, x1 = px(1.0), px(speedup)
color = "#18a558" if speedup >= 1.0 else "#dc6b5a"
label = f'{row["case"]} 1×{row["k"]}×{row["n"]}'
parts.append(text(left - 24, y + 24, label, 16, "#172033", anchor="end", weight=600))
parts.append(f'<rect x="{min(x0,x1):.1f}" y="{y}" '
f'width="{max(abs(x1-x0),2):.1f}" height="34" rx="5" fill="{color}"/>')
parts.append(text(x1 + (10 if speedup >= 1.0 else -10), y + 24,
f"{speedup:.3f}×", 15, color,
anchor="start" if speedup >= 1.0 else "end", weight=700))
parts.append(text(width / 2, height - 15,
"Generated from docs/optimization-log/bf16-results.tsv · higher is better",
14, "#6b7280", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_policy_svg() -> str:
with BF16_POLICY_RESULTS.open(encoding="utf-8", newline="") as stream:
data = list(csv.DictReader(stream, delimiter="\t"))
width, height = 1500, 560
left, top, chart_w = 360, 150, 980
minimum, maximum = 0.75, 1.05
px = lambda value: left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 015 · BF16 Shape Policy", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"3-process median decode throughput relative to retained FP32 path",
16, "#5b6474", anchor="middle"),
]
for tick in (0.8, 0.9, 1.0):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="120" x2="{x:.1f}" y2="390" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 420, f"{tick:.1f}×", 14, "#5b6474", anchor="middle"))
for index, row in enumerate(data):
y = top + index * 120
ratio = float(row["throughput_ratio"])
x0, x1 = px(1.0), px(ratio)
parts.append(text(left - 24, y + 24, row["model"], 16, "#172033",
anchor="end", weight=600))
parts.append(f'<rect x="{min(x0,x1):.1f}" y="{y}" '
f'width="{max(abs(x1-x0),2):.1f}" height="34" rx="5" '
'fill="#dc6b5a"/>')
parts.append(text(x1 - 10, y + 24, f"{ratio:.3f}×", 15, "#b83f32",
anchor="end", weight=700))
gib = int(row["extra_engine_bytes"]) / (1024 ** 3)
parts.append(text(left - 24, y + 52, f"extra engine memory +{gib:.2f} GiB",
14, "#6b7280", anchor="end"))
parts.append(text(width / 2, 485,
"Both models generated the same token IDs; speed and memory gates failed",
16, "#b83f32", anchor="middle", weight=600))
parts.append(text(width / 2, 535,
"Generated from docs/optimization-log/bf16-model-policy.tsv · higher is better",
14, "#6b7280", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_ffn_svg() -> str:
summary = json.loads(BF16_FFN_SUMMARY.read_text(encoding="utf-8"))
data = summary["rows"]
width, height = 1600, 760
left, top, chart_w = 370, 145, 980
minimum, maximum = 1.0, 1.65
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 030 · Continuous BF16 FFN Island", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"MI300X · median of 3 process medians · device Event time · higher is better",
16, "#5b6474", anchor="middle"),
]
for tick in (1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="115" x2="{x:.1f}" y2="620" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 650, f"{tick:.1f}×", 14, "#5b6474", anchor="middle"))
for index, row in enumerate(data):
y = top + index * 118
label = f'{row["model"].capitalize()} M={row["tokens"]}'
parts.append(text(left - 24, y + 26, label, 17, "#172033",
anchor="end", weight=700))
for offset, (key, title, color) in enumerate((
("island_speedup_vs_fp32", "vs FP32", "#18a558"),
("island_speedup_vs_per_linear", "vs per-Linear BF16", "#2563eb"),
)):
ratio = float(row[key])
bar_y = y + offset * 40
x0, x1 = px(1.0), px(ratio)
parts.append(f'<rect x="{x0:.1f}" y="{bar_y}" '
f'width="{max(x1-x0,2):.1f}" height="28" rx="5" fill="{color}"/>')
parts.append(text(x1 + 10, bar_y + 21, f"{ratio:.3f}× {title}", 14,
color, weight=700))
error = row["paths"]["island"]["relative_l2_error_vs_fp32"] * 100.0
parts.append(text(left - 24, y + 66, f"relative L2 {error:.2f}%", 13,
"#6b7280", anchor="end"))
parts.append(text(width / 2, 705,
"The FP32 running-best curve is unchanged; this is a separate BF16 operator track",
16, "#9a4f00", anchor="middle", weight=600))
parts.append(text(width / 2, 738,
"Generated from experiments/030-data/summary.json",
14, "#6b7280", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_model_inference_svg() -> str:
summary = json.loads(BF16_MODEL_SUMMARY.read_text(encoding="utf-8"))
data = summary["rows"]
width, height = 1600, 760
left, top, chart_w = 420, 150, 930
minimum, maximum = 0.45, 1.25
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 031 · Official-model BF16 FFN Inference", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"median of 3 processes · exact greedy tokens · mixed policy vs two references",
16, "#5b6474", anchor="middle"),
]
for tick in (0.5, 0.75, 1.0, 1.25):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="118" x2="{x:.1f}" y2="600" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 630, f"{tick:.2f}×", 14, "#5b6474", anchor="middle"))
metrics = (
("decode_speedup", "decode vs microLLM FP32", "#18a558"),
("prefill_speedup", "prefill vs microLLM FP32", "#4ec27e"),
("microllm_bf16_ffn_decode_ratio_vs_pytorch_bf16",
"decode vs PyTorch BF16", "#2563eb"),
("microllm_bf16_ffn_prefill_ratio_vs_pytorch_bf16",
"prefill vs PyTorch BF16", "#7c3aed"),
)
for row_index, row in enumerate(data):
y = top + row_index * 220
label = "Qwen2.5-0.5B" if row["model"].startswith("qwen") else "DeepSeek Distill 1.5B"
parts.append(text(left - 26, y + 26, label, 18, "#172033",
anchor="end", weight=700))
for offset, (key, title, base_color) in enumerate(metrics):
ratio = float(row[key])
bar_y = y + offset * 40
x0, x1 = px(minimum), px(ratio)
color = base_color if ratio >= 1.0 or "PyTorch" not in title else "#dc6b5a"
parts.append(f'<rect x="{x0:.1f}" y="{bar_y}" width="{max(x1-x0,2):.1f}" '
f'height="27" rx="5" fill="{color}" opacity="0.9"/>')
parts.append(text(x1 + 9, bar_y + 20, f"{ratio:.3f}× {title}", 14,
color, weight=700))
saved = (1.0 - float(row["current_memory_ratio"])) * 100.0
parts.append(text(left - 26, y + 66, f"engine current −{saved:.1f}%", 14,
"#16834a", anchor="end", weight=600))
parts.append(text(width / 2, 685,
"Green: improves retained microLLM FP32 · red: selected PyTorch BF16 gate still fails",
16, "#5b6474", anchor="middle", weight=600))
parts.append(text(width / 2, 728,
"microLLM uses BF16 only for FFN weights/activations; PyTorch reference is full BF16",
14, "#9a4f00", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_prefill_allocator_svg() -> str:
before = json.loads(BF16_MODEL_SUMMARY.read_text(encoding="utf-8"))["rows"]
after = json.loads(BF16_PREFILL_SUMMARY.read_text(encoding="utf-8"))["rows"]
before_by_model = {row["model"]: row for row in before}
pytorch = {row["model"]: row for row in before}
width, height = 1600, 720
left, top, chart_w = 420, 150, 930
minimum, maximum = 0.45, 1.30
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 032 · Enable the Allocator for Prefill", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"microLLM BF16-FFN throughput relative to the fixed PyTorch full-BF16 reference",
16, "#5b6474", anchor="middle"),
]
for tick in (0.5, 0.75, 1.0, 1.25):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="118" x2="{x:.1f}" y2="575" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 605, f"{tick:.2f}×", 14, "#5b6474", anchor="middle"))
for row_index, candidate in enumerate(after):
model = candidate["model"]
baseline = before_by_model[model]
reference = pytorch[model]
values = (
(baseline["microllm_bf16_ffn_decode_ratio_vs_pytorch_bf16"],
"Exp031 decode", "#9ca3af"),
(candidate["bf16_ffn_decode_tokens_per_second"] /
reference["pytorch_bf16_decode_tokens_per_second"],
"Exp032 decode", "#18a558"),
(baseline["microllm_bf16_ffn_prefill_ratio_vs_pytorch_bf16"],
"Exp031 prefill", "#c8ced8"),
(candidate["bf16_ffn_prefill_tokens_per_second"] /
reference["pytorch_bf16_prefill_tokens_per_second"],
"Exp032 prefill", "#2563eb"),
)
y = top + row_index * 205
label = "Qwen2.5-0.5B" if model.startswith("qwen") else "DeepSeek Distill 1.5B"
parts.append(text(left - 26, y + 26, label, 18, "#172033",
anchor="end", weight=700))
for offset, (ratio, title, color) in enumerate(values):
bar_y = y + offset * 38
if ratio < 1.0 and "Exp032" in title:
color = "#dc6b5a"
x0, x1 = px(minimum), px(ratio)
parts.append(f'<rect x="{x0:.1f}" y="{bar_y}" width="{max(x1-x0,2):.1f}" '
f'height="26" rx="5" fill="{color}"/>')
parts.append(text(x1 + 9, bar_y + 19, f"{ratio:.3f}× {title}", 14,
color, weight=700))
parts.append(text(width / 2, 660,
"Three of four selected PyTorch BF16 rows now pass; DeepSeek decode remains red",
16, "#9a4f00", anchor="middle", weight=600))
parts.append(text(width / 2, 697,
"Generated from Experiment 031 PyTorch reference + Experiment 032 microLLM raw medians",
14, "#6b7280", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_attention_svg() -> str:
baseline = {row["model"]: row for row in
json.loads(BF16_PREFILL_SUMMARY.read_text(encoding="utf-8"))["rows"]}
candidate = json.loads(BF16_ATTENTION_SUMMARY.read_text(encoding="utf-8"))["rows"]
pilot = {row["model"]: row for row in
(json.loads(line) for line in BF16_ATTENTION_PILOT.read_text(
encoding="utf-8").splitlines())}
width, height = 1600, 700
left, top, chart_w = 420, 150, 930
minimum, maximum = 0.94, 1.08
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 034 · BF16 Attention Shared Cast", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"throughput relative to retained BF16-FFN model · median candidate vs one-run pilot",
16, "#5b6474", anchor="middle"),
]
for tick in (0.95, 1.0, 1.05):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="118" x2="{x:.1f}" y2="555" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 585, f"{tick:.2f}×", 14, "#5b6474", anchor="middle"))
for row_index, row in enumerate(candidate):
model = row["model"]
old = baseline[model]
first = pilot[model]
values = (
(first["decode_tokens_per_second"] / old["bf16_ffn_decode_tokens_per_second"],
"per-Linear cast decode", "#c8ced8"),
(first["prefill_tokens_per_second"] / old["bf16_ffn_prefill_tokens_per_second"],
"per-Linear cast prefill", "#c8ced8"),
(row["decode_speedup_vs_bf16_ffn"], "shared cast decode", "#18a558"),
(row["prefill_speedup_vs_bf16_ffn"], "shared cast prefill", "#2563eb"),
)
y = top + row_index * 195
label = "Qwen2.5-0.5B" if model.startswith("qwen") else "DeepSeek Distill 1.5B"
parts.append(text(left - 26, y + 26, label, 18, "#172033",
anchor="end", weight=700))
for offset, (ratio, title, color) in enumerate(values):
bar_y = y + offset * 38
if ratio < 1.0 and "shared" in title:
color = "#f59e0b"
x0, x1 = px(1.0), px(ratio)
parts.append(f'<rect x="{min(x0,x1):.1f}" y="{bar_y}" '
f'width="{max(abs(x1-x0),2):.1f}" height="26" rx="5" fill="{color}"/>')
parts.append(text(x1 + (9 if ratio >= 1.0 else -9), bar_y + 19,
f"{ratio:.3f}× {title}", 14, color,
anchor="start" if ratio >= 1.0 else "end", weight=700))
parts.append(text(width / 2, 635,
"Shared input cast turns both decode rows positive; DeepSeek prefill stays within −5% gate",
16, "#5b6474", anchor="middle", weight=600))
parts.append(text(width / 2, 678,
"DeepSeek decode remains 0.533× PyTorch BF16 — output head / broader islands remain",
14, "#9a4f00", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_plan_cache_svg() -> str:
data = json.loads(BF16_PLAN_SUMMARY.read_text(encoding="utf-8"))["rows"]
width, height = 1600, 700
left, top, chart_w = 420, 150, 930
minimum, maximum = 1.0, 3.8
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 036 · Immutable BF16 hipBLASLt Plans", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"median of 3 processes · exact tokens · no algorithm or memory-policy change",
16, "#5b6474", anchor="middle"),
]
for tick in (1.0, 1.5, 2.0, 2.5, 3.0, 3.5):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="118" x2="{x:.1f}" y2="555" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 585, f"{tick:.1f}×", 14, "#5b6474", anchor="middle"))
metrics = (
("decode_speedup_vs_bf16_attention", "decode vs Exp034", "#18a558"),
("prefill_speedup_vs_bf16_attention", "prefill vs Exp034", "#4ec27e"),
("decode_ratio_vs_pytorch_bf16", "decode vs PyTorch BF16", "#2563eb"),
("prefill_ratio_vs_pytorch_bf16", "prefill vs PyTorch BF16", "#7c3aed"),
)
for row_index, row in enumerate(data):
y = top + row_index * 195
label = "Qwen2.5-0.5B" if row["model"].startswith("qwen") else "DeepSeek Distill 1.5B"
parts.append(text(left - 26, y + 26, label, 18, "#172033",
anchor="end", weight=700))
for offset, (key, title, color) in enumerate(metrics):
ratio = float(row[key])
bar_y = y + offset * 38
x0, x1 = px(1.0), px(ratio)
parts.append(f'<rect x="{x0:.1f}" y="{bar_y}" width="{max(x1-x0,2):.1f}" '
f'height="26" rx="5" fill="{color}"/>')
parts.append(text(x1 + 9, bar_y + 19, f"{ratio:.3f}× {title}", 14,
color, weight=700))
parts.append(text(width / 2, 635,
"All four selected PyTorch BF16 throughput gates pass",
17, "#16834a", anchor="middle", weight=700))
parts.append(text(width / 2, 678,
"Scope: pinned short-prompt MI300X inference — not training or universal-model parity",
14, "#9a4f00", anchor="middle"))
parts.append("</svg>\n")
return "\n".join(parts)
def bf16_training_svg() -> str:
data = json.loads(BF16_TRAINING_SUMMARY.read_text(encoding="utf-8"))["rows"]
width, height = 1600, 680
left, top, chart_w = 430, 160, 900
minimum, maximum = 0.75, 3.30
def px(value: float) -> float:
return left + chart_w * (value - minimum) / (maximum - minimum)
parts = [
f'<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}" '
f'viewBox="0 0 {width} {height}">',
'<rect width="100%" height="100%" fill="#fbfcfe"/>',
text(width / 2, 48, "Experiment 037 · BF16 Linear Training with FP32 Masters", 30,
anchor="middle", weight=700),
text(width / 2, 80,
"2 warm-up + 5 measured steps · median of 3 processes · lower loss in every run",
16, "#5b6474", anchor="middle"),
]
for tick in (1.0, 1.5, 2.0, 2.5, 3.0):
x = px(tick)
parts.append(f'<line x1="{x:.1f}" y1="125" x2="{x:.1f}" y2="520" '
f'stroke="{("#2563eb" if tick == 1.0 else "#e5e9f0")}" '
f'stroke-width="{2 if tick == 1.0 else 1}"/>')
parts.append(text(x, 550, f"{tick:.1f}×", 14, "#5b6474", anchor="middle"))
for index, row in enumerate(data):
y = top + index * 180
label = "Qwen2.5-0.5B" if row["model"].startswith("qwen") else "DeepSeek Distill 1.5B"
parts.append(text(left - 26, y + 26, label, 18, "#172033",
anchor="end", weight=700))
values = (