sourceextensions/blender/demos/matmul-fly.xtl
1⍝│ Blender, 7: a 512 x 512 matrix product as a 3D construct, a
2⍝│ fly-through, arrays to video. A on the left wall, B on the ceiling,
3⍝│ C on the front wall, every item a cell colored by its value; the
4⍝│ camera starts far out (the whole cube: 134 million multiply-adds),
5⍝│ flies to one work-group's 16 by 16 tile, then one work-item -- a row
6⍝│ of A times a column of B, 512 products added into one item of C --
7⍝│ and back out while C fills in, a work-group at a time. The product is
8⍝│ X_eTaL-gpu's Accel ac:m_atmul; every place, color and time is an
9⍝│ array worked out in X_eTaL (demos/MatmulFly.xtl); Video.xtl writes
10⍝│ them into the script Blender runs. Explained in
11⍝│ docs/literate/matmul.org.
12⍝│ Run: just demo blender matmul-fly (several minutes: 541 frames)
13
14"bl:" u̲se< "Blender"
15"bp:" u̲se< "Bpy"
16"vd:" u̲se< "Video"
17"mf:" u̲se< "MatmulFly"
18
19⍝ five stills (the document's pictures), then every frame as the video
20script ← ((1920, 1080, 512) ᵐᶠs̲cene 0) c̲at ((1.0 6.0 8.5 11.5 16.5, "matmul-fly") ᵛᵈs̲tills 0) c̲at (ᵛᵈr̲ender "matmul-fly.mp4") c̲at ᵛᵈreport
21_ ← "work/explain/run.py" ᵇˡw̲rite! ᵇᵖlauncher
22_ ← "work/explain/matmul-fly.py" ᵇˡw̲rite! script
23"rendering five stills and 18 seconds (541 frames) with Blender (EEVEE) ..."
24r ← "work/explain/run.py" ᵇˡr̲un! "work/explain/matmul-fly.py work/explain/out"
25"the run, and the error lines in Blender's log:"
26lines ← (n̲ot r = f̲irst "\n") p̲artition r
27d̲isclose 1 s̲elect lines
28d̲isclose 2 s̲elect lines
29"what Blender made:"
30ᵇˡr̲ead "work/explain/out/report.txt"