tt-model push auto_e2e-p150 (container)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+10
- README.md+9-9
- build_info.json+7-7
- code/tt_autoe2e/.omc/state/last-tool-error.jsonAdded+7
- code/tt_autoe2e/api.py+2-2
- code/tt_autoe2e/host/geometry.py+18
- code/tt_autoe2e/tests/dev_api.py+2-2
- code/tt_autoe2e/tests/dev_cm_probe.py+22-8
- code/tt_autoe2e/tests/dev_eval.py+2-2
- code/tt_autoe2e/tests/dev_front_ab.pyAdded+90
- code/tt_autoe2e/tests/dev_prof.py+2-2
- code/tt_autoe2e/tests/dev_runner.py+2-2
- code/tt_autoe2e/tests/dev_sm_order.pyAdded+42
- code/tt_autoe2e/tests/dev_step.py+2-2
- code/tt_autoe2e/tests/dev_tsa_probe.pyAdded+81
- code/tt_autoe2e/tests/dev_tsa_riscs.pyAdded+109
- code/tt_autoe2e/tt/encoder.py+30-9
- code/tt_autoe2e/tt/fusion.py+44-4
- code/tt_autoe2e/tt/kernels/cm_anchors.cppAdded+77
- code/tt_autoe2e/tt/kernels/msda_cm_compute.cpp+202-80
- code/tt_autoe2e/tt/kernels/msda_cm_reader.cpp+127-89
- code/tt_autoe2e/tt/msda_cm.py+86-16
- code/tt_autoe2e/tt/runner.py+9-4
- image/blobs/sha256/05fe53b1920092f2394a302fd1ad844c61a4377dfc993bfa3c21980316f56954Added+1
- image/blobs/sha256/11948ed4e000c13d17fe32e39a0a382c7f2e02670fd73d3dded903bef16b9b57Added+1
- image/blobs/sha256/122f74c4611b412bdb9e96059c6beb3f33df22b242919e10d81f38fa88c97d31Added+3
- image/blobs/sha256/160f2a85f0e18f88bcf53273dd22b85af2f85f82833ae2b4e686b3e0b88bbf29Added+1
- image/blobs/sha256/1b22e4f0d312bea10bb20ea934a2ae3a85b737ae72352e86a2c97a8982b5764fAdded+1
- image/blobs/sha256/1e10b19cc8edb8b9ac4382a32b71f743b50b483973c58f6758ab0c3af427f4c0Added+1
- image/blobs/sha256/33201052828cb60f166a2bda5f6a4a94ed90881dce98c04469a2278adb1b026cAdded
- image/blobs/sha256/409e120542c429d74653ae90c4140707aeae78e653422ca6953cb25a2011cfccAdded
- image/blobs/sha256/410b3bc3520b8dabd4858e3090249af85826a4642633b2c7f15e48f0f0f4a4f2Added+3
- image/blobs/sha256/46c342db0831c94fb121b42c81080aae176692e0fb4c4ad14e831311c1bc31b2Added+1
- image/blobs/sha256/4f160023014e5c2d8ed58182b1196b2d190d4303e9488556924cf91eaf361205Added+1
- image/blobs/sha256/593cf9bc169ff9c1785e7e6dcc2a901632e26de42ab3042fd70c998282e47d5eAdded+3
- image/blobs/sha256/6473731dc6fbc1f1667ea8018264c7535abcb67616f24e5cb99a101a91c4c1fbAdded+1
- image/blobs/sha256/6d73b977a09663ac3118d88d2ce1e9caf7909d215fc8af68c82e9dd3b50d1cf2Added+1
- image/blobs/sha256/7088d24bf5ccedbaa4042c50cbc54feac1ae4a1d9faf1e04b586ca685bdacc27Added+1
- image/blobs/sha256/74d6a13eebdc8dc0819b0639e43e4b7b10b9af42f1d0f04d0199723146ed3c49Added+3
- image/blobs/sha256/754df2dddeeccf60ca0b2ba34824b1609d93dce3c6cccb412bf1afa989c9287eAdded+3
- image/blobs/sha256/77e72f75c7fe3d36ae9740c957174a07bf2e01533883469041c117151d595571Added+3
- image/blobs/sha256/7e5dd20b817a2dc9b3dce65cef504b584add7a3c99b94c034e740336a46b415fAdded
- image/blobs/sha256/806a105d73446c361812fbdfbce523388f342580134ada94468b1394539ffd22Added+1
- image/blobs/sha256/94f01b2815f8135c34fcf7bb381c074fc13bc60aeec30564c0750d8b728039f4Added+1
- image/blobs/sha256/94f8839bbc267cf878a7f9f1aaac97d57eb1a49771a69dc317fd747ff6bc785eAdded+3
- image/blobs/sha256/9a0c3a39622845b21e8cdf6170975a0dc797834f7a98eba60fef294bd81eaae8Added+3
- image/blobs/sha256/9c488e0676bc827ac4ea1431e0dc374fed4853e3c2c22ed02eca381292711f36Added+1
- image/blobs/sha256/a9376c283112f1f976ccde62254dc1976c3fe9e4141be293c61e9c144fea22cbAdded
- image/blobs/sha256/b1cdd2231416ef48bc696f6c409d54d9421212a105ef876deab076dc5782fff4Added
- image/blobs/sha256/b2145ed62ee8ee7b341eb866b89fd3bd38276b8c05666fb0200d5981422cd2a2Added
58 unmodified lines59606158 unmodified linesimage/blobs/sha256/eafd2f0c5ccfc07ea4fc93c0763b5b6b72eaa55f8cf8535f5c7d6e90a09cb988 filter=lfs diff=lfs merge=lfs -textmedia/auto_e2e_p150_kitscenes_demo.mp4 filter=lfs diff=lfs merge=lfs -textmedia/auto_e2e_p150_kitscenes_demo.jpg filter=lfs diff=lfs merge=lfs -text58 unmodified lines5960616263646566676869707158 unmodified linesimage/blobs/sha256/eafd2f0c5ccfc07ea4fc93c0763b5b6b72eaa55f8cf8535f5c7d6e90a09cb988 filter=lfs diff=lfs merge=lfs -textmedia/auto_e2e_p150_kitscenes_demo.mp4 filter=lfs diff=lfs merge=lfs -textmedia/auto_e2e_p150_kitscenes_demo.jpg filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/122f74c4611b412bdb9e96059c6beb3f33df22b242919e10d81f38fa88c97d31 filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/410b3bc3520b8dabd4858e3090249af85826a4642633b2c7f15e48f0f0f4a4f2 filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/593cf9bc169ff9c1785e7e6dcc2a901632e26de42ab3042fd70c998282e47d5e filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/74d6a13eebdc8dc0819b0639e43e4b7b10b9af42f1d0f04d0199723146ed3c49 filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/754df2dddeeccf60ca0b2ba34824b1609d93dce3c6cccb412bf1afa989c9287e filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/77e72f75c7fe3d36ae9740c957174a07bf2e01533883469041c117151d595571 filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/94f8839bbc267cf878a7f9f1aaac97d57eb1a49771a69dc317fd747ff6bc785e filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/9a0c3a39622845b21e8cdf6170975a0dc797834f7a98eba60fef294bd81eaae8 filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/d90cf6b3754dda9cf5a4f4d720f9a962e4bc14949c27f065caafac7ceb89dd8b filter=lfs diff=lfs merge=lfs -textimage/blobs/sha256/eb726478969caf303c2a39cbaf6c4faeb89f1b5caccdea9fe00f297ba49179c8 filter=lfs diff=lfs merge=lfs -text
101 unmodified lines1021031041051061071081091103 unmodified lines1141151161171181191201211221 unmodified line12412512612712812913013129 unmodified lines161162163164165166101 unmodified lines| | this package (p150) | upstream's own bf16 autocast (CUDA) || --- | --- | --- || Controls (acceleration, curvature), relative L2 to the fp32 reference, median / p95 | 0.97% / 4.38% | 1.40% / 5.08% || Trajectory distance to the fp32 reference's at 1 / 3 / 5 s, median (m) | 0.001 / 0.011 / 0.034 | 0.004 / 0.036 / 0.103 || Same, p95 (m) | 0.006 / 0.034 / 0.107 | 0.013 / 0.097 / 0.272 || ADE against the logged trajectory at 1 / 3 / 5 s (m) | value || --- | --- |3 unmodified lines| speed (one stream, warm) | value || --- | --- || One step on the device (traced replay: image branch, 8 BEV frames, fusion) | 0.81 s || Python API call of a streaming step (pre-processing / device with uploads / planner) | 1.05 s (158 / 883 / 22 ms) || API call after a reset (the 7 history steps pushed, then the step) | 1.47 s |The spread of upstream's own bf16 run from fp32 is the scale of a bf16 implementation's differences. Measured with this package's code on one p150a (32-thread AMD host shared with an Autoware simulation).1 unmodified line- Do not use it to drive or control a vehicle or as any safety function: AutoE2E is research software and thisis not a certified component.- About 1.05 s per streaming step on one p150 (the model's design cadence is 2 Hz): the 8 BEVframes are recomputed every step (each step rebuilds the history BEVs in the current ego frame), 0.81 s ofdevice time.- One stream at a time (a new stream id restarts the history); batch 1.- Trained on KITScenes (Karlsruhe, Frankfurt): other rigs and regions are out of distribution.29 unmodified lines| component | built from || --- | --- || tt-metal | a local checkout — commit not published *(dirty tree — the image includes uncommitted changes)* || `code/` digest | `7fd49e16113dbe1c` (sha256, first 16 hex digits) || built | 2026-12-05T13:54:00+00:00 by tt-model 0.1.0 |101 unmodified lines1021031041051061071081091103 unmodified lines1141151161171181191201211221 unmodified line12412512612712812913013129 unmodified lines161162163164165166101 unmodified lines| | this package (p150) | upstream's own bf16 autocast (CUDA) || --- | --- | --- || Controls (acceleration, curvature), relative L2 to the fp32 reference, median / p95 | 0.98% / 4.35% | 1.40% / 5.08% || Trajectory distance to the fp32 reference's at 1 / 3 / 5 s, median (m) | 0.001 / 0.011 / 0.034 | 0.004 / 0.036 / 0.103 || Same, p95 (m) | 0.006 / 0.034 / 0.106 | 0.013 / 0.097 / 0.272 || ADE against the logged trajectory at 1 / 3 / 5 s (m) | value || --- | --- |3 unmodified lines| speed (one stream, warm) | value || --- | --- || One step on the device (traced replay: image branch, 8 BEV frames, fusion) | 0.64 s || Python API call of a streaming step (pre-processing / device with uploads / planner) | 0.86 s (130 / 708 / 20 ms) || API call after a reset (the 7 history steps pushed, then the step) | 1.03 s |The spread of upstream's own bf16 run from fp32 is the scale of a bf16 implementation's differences. Measured with this package's code on one p150a (32-thread AMD host shared with an Autoware simulation).1 unmodified line- Do not use it to drive or control a vehicle or as any safety function: AutoE2E is research software and thisis not a certified component.- About 0.86 s per streaming step on one p150 (the model's design cadence is 2 Hz): the 8 BEVframes are recomputed every step (each step rebuilds the history BEVs in the current ego frame), 0.64 s ofdevice time.- One stream at a time (a new stream id restarts the history); batch 1.- Trained on KITScenes (Karlsruhe, Frankfurt): other rigs and regions are out of distribution.29 unmodified lines| component | built from || --- | --- || tt-metal | a local checkout — commit not published *(dirty tree — the image includes uncommitted changes)* || `code/` digest | `a70f8cf705d86a45` (sha256, first 16 hex digits) || built | 2026-12-05T20:43:01+00:00 by tt-model 0.1.0 |
1234567891011121314{"schema": "ttaw-build-info/1","bundle": "auto_e2e-p150","recorded_at": "2026-12-05T14:10:04Z","image": {"tag": "tt-model/auto_e2e-p150:0f4b5bb0adf1","digest": "sha256:0f4b5bb0adf19a18c065d16e0056ab8b28f2982602edbe333d5f45d51b47f3fe","digest_kind": "image config (classic Docker image store); the OCI manifest that names it: sha256:30e958a3682167e11e043ef27b0bba08a720570a9a5a848b6afb9c97b1db44db","built_at": "2026-12-05T13:59:45Z","code_sha256": "7fd49e16113dbe1c24aa9be624e03bdb857fd86d53077c5ffc3b8878e8c535cd","size_bytes": 2995233011,"layers": 23},"base_images": {1234567891011121314{"schema": "ttaw-build-info/1","bundle": "auto_e2e-p150","recorded_at": "2026-12-05T20:59:22Z","image": {"tag": "tt-model/auto_e2e-p150:94f01b2815f8","digest": "sha256:94f01b2815f8135c34fcf7bb381c074fc13bc60aeec30564c0750d8b728039f4","digest_kind": "image config (classic Docker image store); the OCI manifest that names it: sha256:b59bb6b8470b15661619a5d48c8c68b9340637d50d952fb90e4fa96f417dc13c","built_at": "2026-12-05T20:48:29Z","code_sha256": "a70f8cf705d86a45d9da27e36eb6def8c7379a721cf79f1f65395b6b20554e38","size_bytes": 2995268165,"layers": 23},"base_images": {
1234567{ "tool_name": "Bash", "tool_input_preview": "{\"command\":\"ls ~/tt-autoware/METEOR-2-p150/bin ~/tt-autoware/auto_e2e-p150/bin ~/tt-autoware/visionpilot-p150/bin; ls ~/tt-autoware/METEOR-2-p150/packaging 2>/dev/null\",\"description\":\"List helper scri...", "error": "Exit code 2\n/home/deepgadget/tt-autoware/auto_e2e-p150/bin:\nbuilt_smoke.sh\nchip_session.sh\ndevrun\ndevserve_smoke.sh\n\n/home/deepgadget/tt-autoware/METEOR-2-p150/bin:\nchip_session.sh\ndemo_session.sh\ndevrun\n\n/home/deepgadget/tt-autoware/visionpilot-p150/bin:\nbuilt_smoke.sh\nchip_session.sh\ndevrun\ndevserve_smoke.sh", "timestamp": "2026-12-05T20:22:36.553Z", "retry_count": 1}141 unmodified lines14214314414514614714850 unmodified lines199200201202203204205141 unmodified linesdef _prepare(self, *, images: Any = None, calibration: Any = None, stream: Optional[Mapping] = None,inputs: Any = None, **_: Any) -> Dict[str, Any]:from .host import head as Hfrom .host.geometry import bev_geometry, frame_geometryfrom .tt.fusion import FRONT_CAPfrom .tt.image import backbone_input50 unmodified linesfor m in mats:if m.tobytes() not in uniq:uniq[m.tobytes()] = pool.submit(bev_geometry, m, 512)front_f = pool.submit(frame_geometry, P_front.astype(np.float32), 1024, r_cap=FRONT_CAP, k_cams=1)geos = [uniq[m.tobytes()].result() for m in mats]geo_front = front_f.result()ego = np.asarray(inputs["egomotion_history"], np.float32).reshape(64, 4).copy()141 unmodified lines14214314414514614714850 unmodified lines199200201202203204205141 unmodified linesdef _prepare(self, *, images: Any = None, calibration: Any = None, stream: Optional[Mapping] = None,inputs: Any = None, **_: Any) -> Dict[str, Any]:from .host import head as Hfrom .host.geometry import bev_geometry, frame_geometry, front_geometryfrom .tt.fusion import FRONT_CAPfrom .tt.image import backbone_input50 unmodified linesfor m in mats:if m.tobytes() not in uniq:uniq[m.tobytes()] = pool.submit(bev_geometry, m, 512)front_f = pool.submit(front_geometry, P_front.astype(np.float32))geos = [uniq[m.tobytes()].result() for m in mats]geo_front = front_f.result()ego = np.asarray(inputs["egomotion_history"], np.float32).reshape(64, 4).copy()
152 unmodified lines153154155156157158152 unmodified linesreturn os.environ.get("AE_CM", "1") != "0"def bev_geometry(P: np.ndarray, image: int = 512):"""The geometry of one BEV frame for the encoder's form: :class:`CmGeometry` (cell-major) or:class:`FrameGeometry` (rebatched)."""152 unmodified lines153154155156157158159160161162163164165166167168169170171172173174175176152 unmodified linesreturn os.environ.get("AE_CM", "1") != "0"FRONT_CAP = 40_960 # rebatched front fusion: row capacity of the front camera's visible cellsdef use_front_cm() -> bool:"""The front fusion's form: cell-major (``msda_cm`` with one camera slot, default) or rebatched(``AE_FRONT_CM=0``, or the rebatched encoder)."""import osreturn use_cm() and os.environ.get("AE_FRONT_CM", "1") != "0"def front_geometry(P_front: np.ndarray):"""The 1024 px front camera's geometry for the front fusion's form: :class:`CmGeometry` (one slot) or:class:`FrameGeometry` (rebatched, ``FRONT_CAP`` rows)."""P = np.asarray(P_front, np.float32).reshape(-1, 3, 4)return cm_geometry(P, 1024, slots=1) if use_front_cm() else frame_geometry(P, 1024, r_cap=FRONT_CAP, k_cams=1)def bev_geometry(P: np.ndarray, image: int = 512):"""The geometry of one BEV frame for the encoder's form: :class:`CmGeometry` (cell-major) or:class:`FrameGeometry` (rebatched)."""
48 unmodified lines4950515253545527 unmodified lines8384858687888948 unmodified linesargs = ap.parse_args(argv)from ..api import AutoE2E, COLUMNSfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometryfrom ..tt.fusion import FRONT_CAPfrom ..tt.image import backbone_input27 unmodified linesfor _ in range(7):model.dev.push(cams)geo = bev_geometry(P, 512)gf = frame_geometry(g["front_camera_projection_matrix"][0], 1024, r_cap=FRONT_CAP, k_cams=1)nav, _ = H.navigation(model.state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),bool(g["route_valid"][0]))fused = model.dev.step(cams, backbone_input(g["front_camera_tile"]), [geo] * 8, gf,48 unmodified lines4950515253545527 unmodified lines8384858687888948 unmodified linesargs = ap.parse_args(argv)from ..api import AutoE2E, COLUMNSfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometry, front_geometryfrom ..tt.fusion import FRONT_CAPfrom ..tt.image import backbone_input27 unmodified linesfor _ in range(7):model.dev.push(cams)geo = bev_geometry(P, 512)gf = front_geometry(g["front_camera_projection_matrix"][0])nav, _ = H.navigation(model.state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),bool(g["route_valid"][0]))fused = model.dev.step(cams, backbone_input(g["front_camera_tile"]), [geo] * 8, gf,
6 unmodified lines7891011121320 unmodified lines343536373839404123 unmodified lines65666768697071727374757677781 unmodified line80818283848586878889908 unmodified lines991001011021031041053 unmodified lines1091101111121131141151161176 unmodified lineswithout work (reader alone); ``noread``: no value reads;- with ``rdnone``: ``now`` (no weights), ``notl`` (no tilize), ``nomul`` (no product),``nosteps``;- ``new_hifi3``: HiFi3 products (compared with the HiFi4 output).bin/devrun python -m tt_autoe2e.tests.dev_cm_probe [--out /logs/x.json] [--variants a,b,..]"""20 unmodified lines"rdnone_notl": ("rdnone", "notl"),"rdnone_nomul": ("rdnone", "nomul"),"rdnone_nosteps": ("rdnone", "nosteps"),}EXACT = ("new", "new_hifi3")def main(argv=None) -> int:23 unmodified linesorig = E.msda_cmstate = {"n": 0}def run(maps, loc, att, table, dbg):fid = next((d[4:] for d in dbg if d.startswith("fid:")), None)dbg = tuple(d for d in dbg if not d.startswith("fid:"))old = os.environ.get("AE_MSDA_FIDELITY")if fid:os.environ["AE_MSDA_FIDELITY"] = fidtry:return orig(maps, loc, att, table, debug=dbg)finally:if fid:if old is None:1 unmodified lineelse:os.environ["AE_MSDA_FIDELITY"] = olddef variants(maps, loc, att, table):ref = Nonefor name in names:dbg = VARIANTS[name]o = run(maps, loc, att, table, dbg)ttnn.synchronize_device(dev)if name in EXACT:a = ttnn.to_torch(o).float().numpy()8 unmodified linests = []for _ in range(args.reps):t = time.perf_counter()o = run(maps, loc, att, table, dbg)ttnn.synchronize_device(dev)ts.append(time.perf_counter() - t)ttnn.deallocate(o)3 unmodified linesdef hook(maps, loc, att, table, **kw):state["n"] += 1if state["n"] == 2: # layer 1: offsets / weights from the real queryvariants(maps, loc, att, table)return orig(maps, loc, att, table, **kw)try:enc = TtBevEncoder(dev, tree)up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a, np.float32)), dtype=ttnn.bfloat16,6 unmodified lines78910111213141520 unmodified lines3637383940414243444523 unmodified lines69707172737475767778798081828384858687888990911 unmodified line939495969798991001011021038 unmodified lines1121131141151161171183 unmodified lines1221231241251261271281291301316 unmodified lineswithout work (reader alone); ``noread``: no value reads;- with ``rdnone``: ``now`` (no weights), ``notl`` (no tilize), ``nomul`` (no product),``nosteps``;- ``new_hifi3``: HiFi3 products (compared with the HiFi4 output);- ``unfused`` (when the encoder runs the fused form, AE_SCA_FUSE=1): the separate 256 -> 768 linear + the kernel onits fp32 output (compared with the fused output; ``unfused_proj`` times the linear alone).bin/devrun python -m tt_autoe2e.tests.dev_cm_probe [--out /logs/x.json] [--variants a,b,..]"""20 unmodified lines"rdnone_notl": ("rdnone", "notl"),"rdnone_nomul": ("rdnone", "nomul"),"rdnone_nosteps": ("rdnone", "nosteps"),"unfused": ("unfused",),"unfused_proj": ("unfused_proj",),}EXACT = ("new", "new_hifi3", "unfused")def main(argv=None) -> int:23 unmodified linesorig = E.msda_cmstate = {"n": 0}def run(maps, loc, att, table, dbg, proj=None, anchors=None):if "unfused" in dbg or "unfused_proj" in dbg:if proj is None:raise SystemExit("unfused: the encoder runs the unfused form already")off = enc.layers[1].sca_proj(loc)if "unfused_proj" in dbg:return offo = orig(maps, off, None, table, anchors=anchors)ttnn.deallocate(off)return ofid = next((d[4:] for d in dbg if d.startswith("fid:")), None)dbg = tuple(d for d in dbg if not d.startswith("fid:"))old = os.environ.get("AE_MSDA_FIDELITY")if fid:os.environ["AE_MSDA_FIDELITY"] = fidtry:return orig(maps, loc, att, table, debug=dbg, proj=proj, anchors=anchors)finally:if fid:if old is None:1 unmodified lineelse:os.environ["AE_MSDA_FIDELITY"] = olddef variants(maps, loc, att, table, proj, anchors):ref = Nonefor name in names:dbg = VARIANTS[name]o = run(maps, loc, att, table, dbg, proj, anchors)ttnn.synchronize_device(dev)if name in EXACT:a = ttnn.to_torch(o).float().numpy()8 unmodified linests = []for _ in range(args.reps):t = time.perf_counter()o = run(maps, loc, att, table, dbg, proj, anchors)ttnn.synchronize_device(dev)ts.append(time.perf_counter() - t)ttnn.deallocate(o)3 unmodified linesdef hook(maps, loc, att, table, **kw):state["n"] += 1if state["n"] == 2: # layer 1: offsets / weights from the real queryvariants(maps, loc, att, table, kw.get("proj"), kw.get("anchors"))return orig(maps, loc, att, table, **kw)enc = Nonetry:enc = TtBevEncoder(dev, tree)up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a, np.float32)), dtype=ttnn.bfloat16,
35 unmodified lines3637383940414231 unmodified lines7475767778798035 unmodified linesimport torchfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometryfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAPfrom ..tt.image import state_dict_of31 unmodified linestm["primes"] += 1t = time.perf_counter()geos = [bev_geometry(z["P_hist"][k], 512) for k in range(7)] + [bev_geometry(z["P"], 512)]gf = frame_geometry(z["P_front"], 1024, r_cap=FRONT_CAP, k_cams=1)nav, _ = H.navigation(state, z["map_context"], z["route_mask"], bool(z["map_valid"]),bool(z["route_valid"]))t1 = time.perf_counter()35 unmodified lines3637383940414231 unmodified lines7475767778798035 unmodified linesimport torchfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometry, front_geometryfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAPfrom ..tt.image import state_dict_of31 unmodified linestm["primes"] += 1t = time.perf_counter()geos = [bev_geometry(z["P_hist"][k], 512) for k in range(7)] + [bev_geometry(z["P"], 512)]gf = front_geometry(z["P_front"])nav, _ = H.navigation(state, z["map_context"], z["route_mask"], bool(z["map_valid"]),bool(z["route_valid"]))t1 = time.perf_counter()
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990# SPDX-License-Identifier: Apache-2.0"""The front fusion's two forms on the golden sample (bin/devrun): the rebatched form (gather, 4 level calls of msda,scatter) and the cell-major one (``msda_cm`` with one camera slot), on the golden current BEV and the golden 1024 pxfront FPN: the attention output before the gate (``part``), the fused BEV, and the time of each (eager, synchronized).
bin/devrun python -m tt_autoe2e.tests.dev_front_ab [--out /logs/x.json]"""from __future__ import annotations
import argparseimport globimport jsonimport time
import numpy as np
CKPT = "/ae2e/881e6a8367746da1eaae044a68077d0e7ce6fc1b/models/kitscenes-epoch-5/checkpoint.pt"
def main(argv=None) -> int: ap = argparse.ArgumentParser() ap.add_argument("--out", default="/logs/front_ab.json") ap.add_argument("--reps", type=int, default=5) args = ap.parse_args(argv) import torch import ttnn
from ..host.geometry import FRONT_CAP, cm_geometry, frame_geometry from ..reference.port_form import Q from ..reference.tree import load_tree from ..tt.encoder import TtBevEncoder from ..tt.fusion import TtFrontFusion from ..ttaw.device import DeviceConfig, close_device
gpath = glob.glob("/ae2e/ref/autoe2e_kitscenes_epoch5_*f000045.npz")[0] g = np.load(gpath) it = np.load(gpath.replace(".npz", "_intermediates.npz")) tree = load_tree(CKPT) Pf = g["front_camera_projection_matrix"][0].astype(np.float32).reshape(-1, 3, 4) dev = DeviceConfig(trace_region_size=32 << 20).open() res = {} try: enc = TtBevEncoder(dev, tree) ff = TtFrontFusion(dev, tree) up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a, np.float32)), dtype=ttnn.bfloat16, layout=ttnn.TILE_LAYOUT, device=dev) bev = up(it["frame_bev_current_base"][0].reshape(256, Q).T.reshape(1, 1, Q, 256)) levels = [up(it[f"fpn_front_native_l{i}"][0].transpose(1, 2, 0).reshape(1, 1, -1, 256)) for i in range(4)] geos = {"rebatched": enc.upload_geometry(frame_geometry(Pf, 1024, r_cap=FRONT_CAP, k_cams=1)), "cell_major": enc.upload_geometry(cm_geometry(Pf, 1024, slots=1))} cap = {} orig = TtFrontFusion._gate
def gate(self, bev_, part, observed): cap["part"] = ttnn.to_torch(part).float().numpy().reshape(Q, 256) return orig(self, bev_, part, observed)
outs = {} for name, gd in geos.items(): TtFrontFusion._gate = gate o = ff(bev, levels, gd) TtFrontFusion._gate = orig outs[name] = (cap.pop("part"), ttnn.to_torch(o).float().numpy().reshape(Q, 256)) ttnn.deallocate(o) ts = [] for _ in range(args.reps): t = time.perf_counter() o = ff(bev, levels, gd) ttnn.synchronize_device(dev) ts.append(time.perf_counter() - t) ttnn.deallocate(o) res[f"{name}_ms"] = round(float(np.median(ts)) * 1e3, 2) (pa, oa), (pb, ob) = outs["rebatched"], outs["cell_major"] seen = cm_geometry(Pf, 1024, slots=1).table[:, 18] > 0 rel = lambda a, b: float(np.linalg.norm(a - b) / max(np.linalg.norm(b), 1e-30)) res.update({"cells_seen": int(seen.sum()), "part_rel_l2": rel(pb, pa), "part_max_abs": float(np.abs(pb - pa).max()), "part_unseen_max_abs": [float(np.abs(pa[~seen]).max()), float(np.abs(pb[~seen]).max())], "out_rel_l2": rel(ob, oa), "out_identical": bool(np.array_equal(oa, ob)), "out_vs_golden": [rel(x, it["frame_bev_current_with_front"][0].reshape(256, Q).T) for x in (oa, ob)]}) print(json.dumps(res, indent=1), flush=True) finally: close_device(dev) with open(args.out, "w") as f: json.dump(res, f, indent=1) return 0
if __name__ == "__main__": raise SystemExit(main())37 unmodified lines3839404142434410 unmodified lines5556575859606137 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometryfrom ..reference.port_form import E, Qfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAP10 unmodified linesPs = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]t = time.perf_counter()geos = [bev_geometry(P, 512) for P in Ps]gf = frame_geometry(g["front_camera_projection_matrix"][0], 1024, r_cap=FRONT_CAP, k_cams=1)res = {"host_geometry_9_s": time.perf_counter() - t}t = time.perf_counter()nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),37 unmodified lines3839404142434410 unmodified lines5556575859606137 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometry, front_geometryfrom ..reference.port_form import E, Qfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAP10 unmodified linesPs = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]t = time.perf_counter()geos = [bev_geometry(P, 512) for P in Ps]gf = front_geometry(g["front_camera_projection_matrix"][0])res = {"host_geometry_9_s": time.perf_counter() - t}t = time.perf_counter()nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),
28 unmodified lines2930313233343517 unmodified lines5354555657585928 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometryfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAPfrom ..tt.image import backbone_input, state_dict_of17 unmodified linest0 = time.perf_counter()Ps = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]geos = [bev_geometry(P, 512) for P in Ps]gf = frame_geometry(g["front_camera_projection_matrix"][0], 1024, r_cap=FRONT_CAP, k_cams=1)nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),bool(g["route_valid"][0]))t1 = time.perf_counter()28 unmodified lines2930313233343517 unmodified lines5354555657585928 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometry, front_geometryfrom ..reference.tree import load_treefrom ..tt.fusion import FRONT_CAPfrom ..tt.image import backbone_input, state_dict_of17 unmodified linest0 = time.perf_counter()Ps = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]geos = [bev_geometry(P, 512) for P in Ps]gf = front_geometry(g["front_camera_projection_matrix"][0])nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),bool(g["route_valid"][0]))t1 = time.perf_counter()
123456789101112131415161718192021222324252627282930313233343536373839404142# SPDX-License-Identifier: Apache-2.0"""How much the column order of a 32-column fp32 softmax changes its result on the device (bin/devrun): ttnn.softmax(numeric stable, fp32, HiFi4, fp32 DEST) on random logits and on the same logits with permuted columns, comparedafter undoing the permutation."""import json
import numpy as np
def main() -> int: import torch import ttnn
from ..ttaw.device import DeviceConfig, close_device
dev = DeviceConfig().open() try: rng = np.random.default_rng(0) x = (rng.standard_normal((1, 8, 4096, 32)) * 2).astype(np.float32) perm = rng.permutation(32) cfg = ttnn.init_device_compute_kernel_config(dev.arch(), math_fidelity=ttnn.MathFidelity.HiFi4, math_approx_mode=False, fp32_dest_acc_en=True) up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a)), dtype=ttnn.float32, layout=ttnn.TILE_LAYOUT, device=dev) a = ttnn.to_torch(ttnn.softmax(up(x), dim=-1, compute_kernel_config=cfg)).numpy() b = ttnn.to_torch(ttnn.softmax(up(x[..., perm]), dim=-1, compute_kernel_config=cfg)).numpy() inv = np.argsort(perm) b = b[..., inv] ref = np.exp(x.astype(np.float64) - x.max(-1, keepdims=True)) ref /= ref.sum(-1, keepdims=True) r = lambda u, v: float(np.median(np.abs(u - v) / np.abs(v))) res = {"identical": bool(np.array_equal(a, b)), "frac_diff": float((a != b).mean()), "median_rel_a_b": r(a, b), "max_rel_a_b": float((np.abs(a - b) / np.abs(b)).max()), "median_rel_a_fp64": r(a, ref), "median_rel_b_fp64": r(b, ref)} print(json.dumps(res, indent=1)) finally: close_device(dev) return 0
if __name__ == "__main__": raise SystemExit(main())35 unmodified lines3637383940414214 unmodified lines5758596061626335 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometryfrom ..reference.port_form import Qfrom ..reference.tree import load_treefrom ..tt.encoder import TtBevEncoder14 unmodified linest = time.perf_counter()Ps = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]geos = [bev_geometry(P, 512) for P in Ps]gfront = frame_geometry(g["front_camera_projection_matrix"][0], 1024, r_cap=FRONT_CAP, k_cams=1)T["host_geometry"] = time.perf_counter() - tt = time.perf_counter()nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),35 unmodified lines3637383940414214 unmodified lines5758596061626335 unmodified linesimport ttnnfrom ..host import head as Hfrom ..host.geometry import bev_geometry, frame_geometry, front_geometryfrom ..reference.port_form import Qfrom ..reference.tree import load_treefrom ..tt.encoder import TtBevEncoder14 unmodified linest = time.perf_counter()Ps = [g["camera_history_projection_matrix"][0, k] for k in range(7)] + [g["camera_projection_matrix"][0]]geos = [bev_geometry(P, 512) for P in Ps]gfront = front_geometry(g["front_camera_projection_matrix"][0])T["host_geometry"] = time.perf_counter() - tt = time.perf_counter()nav, _ = H.navigation(state, g["map_context"][0], g["route_mask"][0], bool(g["map_valid"][0]),
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081# SPDX-License-Identifier: Apache-2.0"""Where the t1 self-attention kernel's time goes (bin/devrun): layer 1's real TSA inputs on the golden frame (msdacaptured while the encoder runs), timed as is, without the value reads (NOREAD) and with one accumulate step per half(NOSTEPS); wrong outputs by design for the probes, only the times matter.
bin/devrun python -m tt_autoe2e.tests.dev_tsa_probe [--out /logs/x.json]"""from __future__ import annotations
import argparseimport globimport jsonimport time
import numpy as np
CKPT = "/ae2e/881e6a8367746da1eaae044a68077d0e7ce6fc1b/models/kitscenes-epoch-5/checkpoint.pt"VARIANTS = {"new": (), "noread": ("noread",), "nosteps": ("nosteps",), "noread_nosteps": ("noread", "nosteps")}
def main(argv=None) -> int: ap = argparse.ArgumentParser() ap.add_argument("--out", default="/logs/tsa_probe.json") ap.add_argument("--reps", type=int, default=5) args = ap.parse_args(argv) import torch import ttnn
from ..host.geometry import bev_geometry from ..reference.tree import load_tree from ..tt import encoder as E from ..tt.encoder import TtBevEncoder from ..ttaw.device import DeviceConfig, close_device
gpath = glob.glob("/ae2e/ref/autoe2e_kitscenes_epoch5_*f000045.npz")[0] g = np.load(gpath) inter = np.load(gpath.replace(".npz", "_intermediates.npz")) tree = load_tree(CKPT) geo = bev_geometry(g["camera_projection_matrix"][0], 512) feats = [inter[f"fpn_current_l{i}"] for i in range(4)] dev = DeviceConfig(trace_region_size=64 << 20).open() orig = E.msda res = {"variants_ms": {}} state = {"n": 0}
def hook(*a, **kw): state["n"] += 1 if state["n"] == 1 and kw.get("softmax") is True: # layer 1's TSA (layer 0's is a constant) for name, dbg in VARIANTS.items(): ts = [] for i in range(args.reps + 1): t = time.perf_counter() o = orig(*a, **dict(kw, debug=dbg)) ttnn.synchronize_device(dev) if i: ts.append(time.perf_counter() - t) ttnn.deallocate(o) res["variants_ms"][name] = round(float(np.median(ts)) * 1e3, 3) print(name, res["variants_ms"][name], flush=True) return orig(*a, **kw)
try: enc = TtBevEncoder(dev, tree) up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a, np.float32)), dtype=ttnn.bfloat16, layout=ttnn.TILE_LAYOUT, device=dev) levels = [up(f.transpose(0, 2, 3, 1).reshape(1, 1, -1, 256)) for f in feats] gd = enc.upload_geometry(geo) E.msda = hook out = enc.frame(levels, gd) ttnn.synchronize_device(dev) ttnn.deallocate(out) finally: E.msda = orig close_device(dev) with open(args.out, "w") as f: json.dump(res, f, indent=1) return 0
if __name__ == "__main__": raise SystemExit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109# SPDX-License-Identifier: Apache-2.0"""Per-RISC time of the t1 self-attention kernel on layer 1's real inputs of the golden frame (bin/devrun withTT_METAL_DEVICE_PROFILER=1): the device profiler's kernel zones of the reader (NCRISC), writer (BRISC) and the threecompute TRISCs (max / mean over cores), and the kernels' own phase timers (``debug=("timing",)``).
TT_METAL_DEVICE_PROFILER=1 bin/devrun python -m tt_autoe2e.tests.dev_tsa_riscs [--tag tsa_riscs]"""from __future__ import annotations
import argparseimport csvimport globimport jsonimport shutilfrom collections import defaultdict
import numpy as np
CKPT = "/ae2e/881e6a8367746da1eaae044a68077d0e7ce6fc1b/models/kitscenes-epoch-5/checkpoint.pt"
def main(argv=None) -> int: ap = argparse.ArgumentParser() ap.add_argument("--tag", default="tsa_riscs") args = ap.parse_args(argv) import torch import ttnn
from ..host.geometry import bev_geometry from ..reference.tree import load_tree from ..tt import encoder as E from ..tt.encoder import TtBevEncoder from ..ttaw.device import DeviceConfig, close_device
gpath = glob.glob("/ae2e/ref/autoe2e_kitscenes_epoch5_*f000045.npz")[0] g = np.load(gpath) inter = np.load(gpath.replace(".npz", "_intermediates.npz")) tree = load_tree(CKPT) geo = bev_geometry(g["camera_projection_matrix"][0], 512) feats = [inter[f"fpn_current_l{i}"] for i in range(4)] dev = DeviceConfig(trace_region_size=64 << 20).open() orig = E.msda res = {} state = {"n": 0}
def hook(*a, **kw): state["n"] += 1 if state["n"] == 1 and kw.get("softmax") is True: for _ in range(3): o = orig(*a, **dict(kw, debug=("timing",))) ttnn.synchronize_device(dev) ttnn.deallocate(o) ttnn.ReadDeviceProfiler(dev) return orig(*a, **kw)
try: enc = TtBevEncoder(dev, tree) up = lambda a: ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(a, np.float32)), dtype=ttnn.bfloat16, layout=ttnn.TILE_LAYOUT, device=dev) levels = [up(f.transpose(0, 2, 3, 1).reshape(1, 1, -1, 256)) for f in feats] gd = enc.upload_geometry(geo) E.msda = hook out = enc.frame(levels, gd) ttnn.synchronize_device(dev) ttnn.deallocate(out) finally: E.msda = orig close_device(dev) logs = glob.glob("/opt/tt-metal/generated/profiler/.logs/profile_log_device.csv") if not logs: print("no profiler log") return 1 shutil.copy(logs[0], f"/logs/{args.tag}_profile_log_device.csv") # rows: PCIe slot, core_x, core_y, RISC processor type, timer_id, time[cycles since reset], data, run host ID, # zone name, type (ZONE_START / ZONE_END), source line, source file, meta starts, spans, data = {}, defaultdict(list), defaultdict(list) with open(logs[0]) as f: f.readline() # ARCH / chip freq line rd = csv.reader(f) hdr = [h.strip() for h in next(rd)] ix = {h: i for i, h in enumerate(hdr)} for row in rd: row = [c.strip() for c in row] zone = row[ix.get("zone name", 8)] if zone in ("res", "hdr", "loop", "bar", "out", "geo", "in", "w", "tl", "st", "fin"): data[(row[ix["RISC processor type"]], zone, row[ix.get("run host ID", 7)])].append(int(row[ix["data"]])) continue if not zone.endswith("-KERNEL"): continue key = (row[ix["core_x"]], row[ix["core_y"]], row[ix["RISC processor type"]], zone, row[ix.get("run host ID", 7)]) t = int(row[ix["time[cycles since reset]"]]) if row[ix.get("type", 9)] == "ZONE_START": starts[key] = t elif key in starts: spans[(key[2], key[4])].append(t - starts.pop(key)) runs = sorted({k[1] for k in spans}, key=lambda s: int(s) if s.isdigit() else s) last = runs[-1] if runs else None res["per_risc_cycles_last_run"] = {k[0]: {"max": int(max(v)), "mean": int(np.mean(v)), "cores": len(v)} for k, v in spans.items() if k[1] == last} res["timing_cycles_mean_last_run"] = {f"{k[0]}.{k[1]}": int(np.mean(v)) for k, v in data.items() if k[2] == last} res["data_types_seen"] = sorted({k[2] for k in data})[:3] print(json.dumps(res, indent=1)) with open(f"/logs/{args.tag}.json", "w") as f: json.dump(res, f, indent=1) return 0
if __name__ == "__main__": raise SystemExit(main())30 unmodified lines31323334353637194 unmodified lines2322332342352362372382392402411 unmodified line243244245246247248249250251100 unmodified lines352353354355356357188 unmodified lines5465475485495505515525538 unmodified lines56256356456556656756856957015 unmodified lines58658758858959059134 unmodified lines62662762862930 unmodified linesfrom ..host.geometry import K_CAMS, R_CAP, CmGeometry, level_sizes, tsa_base, use_cmfrom ..reference.port_form import BEV_H, BEV_W, E, HEADS, LEVELS, LN_EPS, Qfrom ..ttaw.models.second import RowLinearfrom .msda_cm import msda_cmfrom .msda_k import PAD_LOGIT, msdaPREC = "HiFi4+fp32+l1acc:w=fp32"194 unmodified linesdef cm_column_orders():"""Column orders of the sampling offsets / attention logits for ``msda_cm`` (its reader RISC h reads only its ownpoints 4 h .. 4 h + 3): offsets ``j * 64 + h * 32 + l * 8 + 2 q + xy`` (upstream ``j * 64 + l * 16 + 2 p + xy``,``p = 4 h + q``), logits ``j * 32 + h * 16 + l * 4 + q`` (upstream ``j * 32 + l * 8 + p``; the softmax over ahead's 32 columns does not depend on their order). Returns the two index arrays ``new -> upstream``."""po = np.zeros(HEADS * 64, np.int64)pa = np.zeros(HEADS * 32, np.int64)for j in range(HEADS):1 unmodified linefor l in range(LEVELS):for q in range(4):p = 4 * h + qfor xy in range(2):po[j * 64 + h * 32 + l * 8 + 2 * q + xy] = j * 64 + l * 16 + 2 * p + xypa[j * 32 + h * 16 + l * 4 + q] = j * 32 + l * 8 + preturn po, pa100 unmodified linesnp.concatenate([L.sca_off.bias_host, L.sca_att.bias_host]),precision=L.sca_off.precision, output_dtype="float32",name=f"l{L.i}.sca.proj")L0 = self.layers[0]# the raw projections (msda_cm converts them in the kernel)if self.sca_merge:188 unmodified linest0 = self._t('-', time.perf_counter())const = L.i == 0 and self._cm0 is not Noneif const:loc, att = self._cm0else:# raw fp32 projections: msda_cm makes the offsets int32 and runs the softmax per head in the kernelif self.sca_merge:8 unmodified linesmaps.append(self._maps(vproj, HEADS * 6, h, w, quad=True))_free(vproj)t0 = self._t('sca.value_maps', t0)o = msda_cm(maps, loc, att, g["table"], memory_config=self._mid_sca)_free(*maps)if not const:_free(loc, att)t0 = self._t('sca.msda', t0)y = L.sca_out(o)15 unmodified linesown_obs = Trueelse:own_obs = Falseown_base = not cm and "base512" not in gif own_base:g["base512"] = ttnn.repeat(g["base"], ttnn.Shape([1, 1, 1, HEADS]), memory_config=ttnn.DRAM_MEMORY_CONFIG)34 unmodified lines_free(query)if own_obs:_free(g["observed"])return out30 unmodified lines31323334353637194 unmodified lines2322332342352362372382392402412422431 unmodified line245246247248249250251252253254255100 unmodified lines356357358359360361362363364365366367368188 unmodified lines5575585595605615625635645655665678 unmodified lines57657757857958058158258358458515 unmodified lines60160260360460560660760860961034 unmodified lines64564664764864965030 unmodified linesfrom ..host.geometry import K_CAMS, R_CAP, CmGeometry, level_sizes, tsa_base, use_cmfrom ..reference.port_form import BEV_H, BEV_W, E, HEADS, LEVELS, LN_EPS, Qfrom ..ttaw.models.second import RowLinearfrom .msda_cm import cm_anchors, fused_projection, msda_cmfrom .msda_k import PAD_LOGIT, msdaPREC = "HiFi4+fp32+l1acc:w=fp32"194 unmodified linesdef cm_column_orders():"""Column orders of the sampling offsets / attention logits for ``msda_cm``: its reader RISC h reads only its ownpoints ``p = 4 h + q`` (one 32-column tile per head and RISC), and its compute kernel's SFPU finds level l's point qin lane ``s = (2 q + 7 (l & 1)) & 7`` of a face (the broadcast lanes 2 q after one rotation for odd levels):offsets ``j * 64 + h * 32 + 16 (l >> 1) + 2 s + xy`` (upstream ``j * 64 + l * 16 + 2 p + xy``), logits``j * 32 + 16 h + 2 s + (l >> 1)`` (upstream ``j * 32 + l * 8 + p``; the softmax over a head's 32 columns does notdepend on their order). Returns the two index arrays ``new -> upstream``."""po = np.zeros(HEADS * 64, np.int64)pa = np.zeros(HEADS * 32, np.int64)for j in range(HEADS):1 unmodified linefor l in range(LEVELS):for q in range(4):p = 4 * h + qs = (2 * q + 7 * (l & 1)) & 7for xy in range(2):po[j * 64 + h * 32 + 16 * (l >> 1) + 2 * s + xy] = j * 64 + l * 16 + 2 * p + xypa[j * 32 + 16 * h + 2 * s + (l >> 1)] = j * 32 + l * 8 + passert sorted(po) == list(range(HEADS * 64)) and sorted(pa) == list(range(HEADS * 32))return po, pa100 unmodified linesnp.concatenate([L.sca_off.bias_host, L.sca_att.bias_host]),precision=L.sca_off.precision, output_dtype="float32",name=f"l{L.i}.sca.proj")# the projection of layers 1.. inside the kernel (its compute kernel has room for it: the reader RISC-Vs# bound the kernel), AE_SCA_FUSE=0: a separate linearself.sca_fuse = self.sca_merge and os.environ.get("AE_SCA_FUSE", "1") != "0"if self.sca_fuse:for L in self.layers[1:]:L.sca_wb = up(fused_projection(L.sca_proj.weight_host, L.sca_proj.bias_host, HEADS).reshape(1, 1, 288, 96 * HEADS), ttnn.float32)L0 = self.layers[0]# the raw projections (msda_cm converts them in the kernel)if self.sca_merge:188 unmodified linest0 = self._t('-', time.perf_counter())const = L.i == 0 and self._cm0 is not Nonefused = not const and getattr(L, "sca_wb", None) is not Noneif const:loc, att = self._cm0elif fused:loc, att = query, None # projected in the kernelelse:# raw fp32 projections: msda_cm makes the offsets int32 and runs the softmax per head in the kernelif self.sca_merge:8 unmodified linesmaps.append(self._maps(vproj, HEADS * 6, h, w, quad=True))_free(vproj)t0 = self._t('sca.value_maps', t0)o = msda_cm(maps, loc, att, g["table"], memory_config=self._mid_sca, proj=L.sca_wb if fused else None,anchors=g.get("anchors"))_free(*maps)if not const and not fused:_free(loc, att)t0 = self._t('sca.msda', t0)y = L.sca_out(o)15 unmodified linesown_obs = Trueelse:own_obs = Falseown_anchors = cm and "anchors" not in gif own_anchors:# the frame's anchor terms in the offsets' column layout (all heads and layers add them)g = dict(g, anchors=cm_anchors(g["table"]))own_base = not cm and "base512" not in gif own_base:g["base512"] = ttnn.repeat(g["base"], ttnn.Shape([1, 1, 1, HEADS]), memory_config=ttnn.DRAM_MEMORY_CONFIG)34 unmodified lines_free(query)if own_obs:_free(g["observed"])if own_anchors:_free(g["anchors"])return out
15 unmodified lines161718192021222324252627282915 unmodified lines4546474849505 unmodified lines56575859606139 unmodified lines1011021031041051064 unmodified lines11111211311411511611715 unmodified linesimport numpy as npfrom ..host.geometry import level_sizesfrom ..reference.port_form import BEV_H, BEV_W, E, HEADS, LN_EPS, Qfrom .encoder import PREC, SCALE, _free, _lin, _LN, _npfrom .image import _arrfrom .msda_k import PAD_LOGIT, msdafrom .pairmap import pair_mapsFRONT_CAP = 40_960MAP = "Reactive_E2E.MapBEVFusion"15 unmodified linesself.norm = _LN(vf.layers[-1].norms[1])gate = np.tanh(_np(vf.front_residual_gate).astype(np.float64)).astype(np.float32).reshape(1, 1, 1, E)self.gate = ttnn.from_torch(torch.from_numpy(gate), dtype=ttnn.float32, layout=ttnn.TILE_LAYOUT, device=device)self.cfg = ttnn.init_device_compute_kernel_config(device.arch(), math_fidelity=ttnn.MathFidelity.HiFi4,math_approx_mode=False, fp32_dest_acc_en=True,packer_l1_acc=True)5 unmodified linesfrom ..ttaw.ops.gather import with_zero_rowscap = int(g["base"].shape[2])table = with_zero_rows(bev)rows = ttnn.embedding(g["sca_index"], table, layout=ttnn.TILE_LAYOUT, padding_idx=Q,39 unmodified linesembeddings_type=ttnn.EmbeddingsType.PADDED)_free(st)part = ttnn.reshape(part, (1, 1, Q, E))delta = self.out(part) # fp32, no bias (count <= 1)_free(part)q32 = ttnn.typecast(bev, ttnn.float32)4 unmodified linesb = self.norm(q32, cfg=self.cfg)res = ttnn.subtract(a, b)_free(a, b)obs32 = ttnn.typecast(g["observed"], ttnn.float32)r1 = ttnn.multiply(res, obs32)_free(res, obs32)r2 = ttnn.multiply(r1, self.gate)15 unmodified lines161718192021222324252627282915 unmodified lines45464748495051525354555657585 unmodified lines646566676869707139 unmodified lines1111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451464 unmodified lines15115215315415515615715 unmodified linesimport numpy as npfrom ..host.geometry import FRONT_CAP, level_sizesfrom ..reference.port_form import BEV_H, BEV_W, E, HEADS, LN_EPS, Qfrom .encoder import PREC, SCALE, _free, _lin, _LN, _np, _permuted, cm_column_ordersfrom .image import _arrfrom .msda_cm import cm_anchors, fused_projection, msda_cmfrom .msda_k import PAD_LOGIT, msdafrom .pairmap import pair_mapsMAP = "Reactive_E2E.MapBEVFusion"15 unmodified linesself.norm = _LN(vf.layers[-1].norms[1])gate = np.tanh(_np(vf.front_residual_gate).astype(np.float64)).astype(np.float32).reshape(1, 1, 1, E)self.gate = ttnn.from_torch(torch.from_numpy(gate), dtype=ttnn.float32, layout=ttnn.TILE_LAYOUT, device=device)# the cell-major form (host.geometry.front_geometry: one camera slot): the projection inside msda_cmpo, pa = cm_column_orders()off, att_ = _permuted(self.off, po), _permuted(self.att, pa)wb = fused_projection(np.concatenate([off.weight_host, att_.weight_host], axis=1),np.concatenate([off.bias_host, att_.bias_host]), HEADS)self.wb = ttnn.from_torch(torch.from_numpy(np.ascontiguousarray(wb.reshape(1, 1, 288, 96 * HEADS))),dtype=ttnn.float32, layout=ttnn.TILE_LAYOUT, device=device,memory_config=ttnn.DRAM_MEMORY_CONFIG)self.cfg = ttnn.init_device_compute_kernel_config(device.arch(), math_fidelity=ttnn.MathFidelity.HiFi4,math_approx_mode=False, fp32_dest_acc_en=True,packer_l1_acc=True)5 unmodified linesfrom ..ttaw.ops.gather import with_zero_rowsif "table" in g:return self._cm(bev, levels, g)cap = int(g["base"].shape[2])table = with_zero_rows(bev)rows = ttnn.embedding(g["sca_index"], table, layout=ttnn.TILE_LAYOUT, padding_idx=Q,39 unmodified linesembeddings_type=ttnn.EmbeddingsType.PADDED)_free(st)part = ttnn.reshape(part, (1, 1, Q, E))return self._gate(bev, part, g["observed"])def _cm(self, bev, levels: Sequence[Any], g: Dict[str, Any]):"""The cell-major form: the BEV cells as rows (no gather / scatter), the front camera's 4 levels as quad maps,offsets / weights projected in the kernel; zero on cells the front camera does not see."""import ttnntable = g["table"]anchors = cm_anchors(table)maps = []for l, (h, w) in enumerate(self.sizes):vp = self.v(levels[l])v1 = ttnn.to_memory_config(vp, ttnn.L1_MEMORY_CONFIG)_free(vp)maps.append(pair_maps(v1, heads=HEADS, sub=1, hw=(h, w), quad=True))_free(v1)part = msda_cm(maps, bev, None, table, ncam=1, slots=1, proj=self.wb, anchors=anchors)_free(*maps)_free(anchors)cnt = ttnn.typecast(ttnn.slice(table, [0, 0, 0, 18], [1, 1, Q, 19]), ttnn.bfloat16)observed = ttnn.gtz(cnt)_free(cnt)out = self._gate(bev, part, observed)_free(observed)return outdef _gate(self, bev, part, observed):"""``tanh(gate) * (LN(q + out(part)) - LN(q))`` on the cells the front camera sees, added to ``bev``."""import ttnndelta = self.out(part) # fp32, no bias (count <= 1)_free(part)q32 = ttnn.typecast(bev, ttnn.float32)4 unmodified linesb = self.norm(q32, cfg=self.cfg)res = ttnn.subtract(a, b)_free(a, b)obs32 = ttnn.typecast(observed, ttnn.float32)r1 = ttnn.multiply(res, obs32)_free(res, obs32)r2 = ttnn.multiply(r1, self.gate)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677// SPDX-License-Identifier: Apache-2.0// cm_anchors (tt/msda_cm.py): the frame's per-cell terms for msda_cm, once per frame (all heads and layers use them).// In: the cell table (int32 TILE [1, 1, NQ, 32], host.geometry.cm_table: per slot k the 4 anchors as// round(uv * 2^(16 + SMAX)) in columns 8 k + 2 a + (x, y), the slot's camera in 16 + k (-1: none), the count in 18).// Out: int32 TILE [1, 1, NQ, 96], per block b three tiles:// 3 b + k (k = 0, 1): in column 16 (l >> 1) + 2 ((2 a + 7 (l & 1)) & 7) + (x, y) (the offsets' column layout,// tt/encoder.py cm_column_orders) the term (anchor_{k, a} >> l) - 2^15 (level l, Q16.16 pixels with the// half-pixel shift) that msda_cm's compute kernel adds to the offsets of both reader RISCs (point 4 h + a uses// anchor a); rows without slot k and rows past NQ get -2^30 (every position far outside every map);// 3 b + 2: the fp32 factor of the cell's softmax weights in every column: 1 / 2 on 2-camera rows (upstream's mean// over the cameras that see the cell), else 1.// Blocks strided over the cores; one data-movement RISC per core.#include <stdint.h>
#include "api/dataflow/dataflow_api.h"
constexpr uint32_t NB = get_compile_time_arg_val(0);constexpr uint32_t NC = get_compile_time_arg_val(1);constexpr uint32_t GX = get_compile_time_arg_val(2);constexpr uint32_t cb_s = get_compile_time_arg_val(3);constexpr uint32_t NQ = get_compile_time_arg_val(4);constexpr auto t_args = TensorAccessorArgs<5>();constexpr auto o_args = TensorAccessorArgs<t_args.next_compile_time_args_offset()>();constexpr uint32_t TB32 = 4096;constexpr int32_t SENT = -(1 << 30);constexpr uint32_t ONE = 0x3F800000u, HALF = 0x3F000000u;
// the element offset of (level l, anchor a) inside a row of a tile (x; y = + 1)constexpr uint32_t col_of(uint32_t l, uint32_t a) { return (l >> 1) * 256 + 2 * ((2 * a + 7 * (l & 1)) & 7); }
void kernel_main() { const uint32_t ci = get_absolute_logical_y() * GX + get_absolute_logical_x(); if (ci >= NC || ci >= NB) { return; } const auto t_acc = TensorAccessor(t_args, get_common_arg_val<uint32_t>(0), TB32); const auto o_acc = TensorAccessor(o_args, get_common_arg_val<uint32_t>(1), TB32); cb_reserve_back(cb_s, 4); const uint32_t tin = get_write_ptr(cb_s); const int32_t* T = reinterpret_cast<const int32_t*>(tin); int32_t* A0 = reinterpret_cast<int32_t*>(tin + TB32); uint32_t* F = reinterpret_cast<uint32_t*>(tin + 3 * TB32); for (uint32_t b = ci; b < NB; b += NC) { noc_async_read(t_acc.get_noc_addr(b), tin, TB32); noc_async_read_barrier(); noc_async_write_barrier(); // the previous block's tiles left the scratch pages for (uint32_t r = 0; r < 32; ++r) { const uint32_t rb = ((r >> 4) << 9) + ((r & 15) << 4); // element of (r, 0) in a tile const bool valid_row = b * 32 + r < NQ; for (uint32_t k = 0; k < 2; ++k) { int32_t* A = A0 + k * 1024 + rb; const bool on = valid_row && T[rb + 256 + k] >= 0;#pragma GCC unroll 4 for (uint32_t a = 0; a < 4; ++a) { const int32_t tx = T[rb + 8 * k + 2 * a]; const int32_t ty = T[rb + 8 * k + 2 * a + 1];#pragma GCC unroll 4 for (uint32_t l = 0; l < 4; ++l) { A[col_of(l, a)] = on ? (tx >> l) - 32768 : SENT; A[col_of(l, a) + 1] = on ? (ty >> l) - 32768 : SENT; } } } const uint32_t f = valid_row && T[rb + 256 + 2] >= 2 ? HALF : ONE; uint32_t* fr = F + rb;#pragma GCC unroll 16 for (uint32_t c = 0; c < 16; ++c) { fr[c] = f; fr[256 + c] = f; } } for (uint32_t i = 0; i < 3; ++i) { noc_async_write(tin + (1 + i) * TB32, o_acc.get_noc_addr(3 * b + i), TB32); } } noc_async_write_barrier();}1234567814 unmodified lines2324252627288 unmodified lines373839404142434445464748495051525354555616 unmodified lines73747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211319 unmodified lines1331341351361371381391401411421431441451461471481491501511521531544 unmodified lines1591601611621631641651661672 unmodified lines1701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162171 unmodified line21922022122222322422522622732 unmodified lines2602612622632642652662672685 unmodified lines2742752762772782792802812822832842852862874 unmodified lines2922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213225 unmodified lines32832933033133233316 unmodified lines350351352353354355356// SPDX-License-Identifier: Apache-2.0// msda_cm (tt/msda_cm.py), compute: per work item (32 cells x one head; see msda_cm_reader.cpp) the chunk count from// cb_ctl (read_tile_value: the same value on the three TRISCs), then per chunk (slot, level):// 1. for each half h (the points of RISC h): DEST0..2 <- cb_geo_h (fx, fy, attn; fp32); SFPU: W_c = a * wx * wy for// the 4 corners (fx / fy decoded from 2^23 + q) -> cb_w pages 4h .. 4h + 3 (fp32; own point q in column 4 q);// 2. the [32 x 128] quad staging blocks tilized into the 4 corner tiles per point;// 3. for each (point q, corner c): DEST = V * (column 4 q of W_{h,c} broadcast over the 32 channels: an FPU// multiply with the weight tile read 16 q bytes on), packer L1 accumulation into cb_acc (fp32) over ALL chunks14 unmodified lines#include "api/compute/eltwise_unary/typecast.h"#include "api/compute/reduce.h"#include "api/compute/softmax.h"#include "ttnn/cpp/ttnn/kernel_lib/reduce_helpers_compute.hpp"#include "ttnn/cpp/ttnn/kernel_lib/eltwise/api/chain.hpp"#include "ttnn/cpp/ttnn/kernel_lib/eltwise/api/convenience.hpp"8 unmodified lines#include "sfpi.h"namespace ckernel::sfpu {// DEST tiles 0, 1, 2 = fx, fy (as 2^23 + q), attn -> tiles 0..3 = the NW, NE, SW, SE weights (one face per call)inline void msda_cm_w_face() {#pragma GCC unroll 2for (int d = 0; d < 8; d++) {sfpi::vFloat fx = (sfpi::dst_reg[0] - 8388608.0f) * 0.0000152587890625f;sfpi::vFloat fy = (sfpi::dst_reg[32] - 8388608.0f) * 0.0000152587890625f;sfpi::vFloat a = sfpi::dst_reg[64];sfpi::vFloat gx = 1.0f - fx;sfpi::vFloat ay0 = a * (1.0f - fy);sfpi::vFloat ay1 = a * fy;sfpi::dst_reg[0] = gx * ay0;sfpi::dst_reg[32] = fx * ay0;sfpi::dst_reg[64] = gx * ay1;sfpi::dst_reg[96] = fx * ay1;sfpi::dst_reg++;}}16 unmodified linesconstexpr uint32_t NWORK = get_compile_time_arg_val(0);constexpr uint32_t NC = get_compile_time_arg_val(1);constexpr uint32_t GX = get_compile_time_arg_val(2);constexpr uint32_t P = 8;constexpr uint32_t PH = P / 2;constexpr uint32_t NS = PH * 4;constexpr uint32_t BW = 4; // tiles per quad staging blockconstexpr uint32_t cb_in0 = 0, cb_in1 = 1, cb_geo0 = 2, cb_geo1 = 3, cb_w = 5, cb_acc = 6, cb_ctl = 9,cb_out = 16, cb_tl0 = 19, cb_tl1 = 20;namespace ckl = compute_kernel_lib;// the per-item conversions (msda_cm_reader.cpp): the raw sampling projection tiles -> int32 (Q16.16; the same SFPU// typecast as ttnn.typecast), the logit tile -> softmax over the head's 32 columns (the LLK sequence of// ttnn.softmax(numeric_stable) on one fp32 tile, as msda_k_compute.cpp: row max -> exp(x - max) -> row sum -> 1 / sum// -> x * (1 / sum)), packed once per reader RISCconstexpr uint32_t cb_scmax = 10, cb_scsum = 11, cb_lg = 12, cb_max = 13, cb_exps = 14, cb_rsum = 15, cb_raw0 = 17,cb_raw1 = 18, cb_off0 = 21, cb_off1 = 22, cb_sm0 = 23, cb_sm1 = 24;static inline void convert_item() {for (uint32_t h = 0; h < 2; ++h) {const uint32_t cr = h ? cb_raw1 : cb_raw0;const uint32_t co = h ? cb_off1 : cb_off0;cb_wait_front(cr, 1);cb_reserve_back(co, 1);tile_regs_acquire();reconfig_data_format_srca(cr);copy_init(cr);copy_tile(cr, 0, 0);typecast_tile_init<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>();typecast_tile<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>(0);tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(co);pack_tile(0, co);tile_regs_release();cb_push_back(co, 1);cb_pop_front(cr, 1);}reconfig_data_format(cb_lg, cb_lg);pack_reconfig_data_format(cb_exps);copy_init(cb_lg);19 unmodified linesrecip_tile<ReciprocalDestAcc::FP32, ReciprocalApproxMode::Precise>(0);});cb_wait_front(cb_rsum, 1);cb_reserve_back(cb_sm0, 1);cb_reserve_back(cb_sm1, 1);tile_regs_acquire();reconfig_data_format(cb_exps, cb_rsum);mul_bcast_cols_init(cb_exps, cb_rsum);mul_tiles_bcast_cols(cb_exps, cb_rsum, 0, 0, 0);tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(cb_sm0);pack_tile(0, cb_sm0);pack_tile(0, cb_sm1);tile_regs_release();cb_push_back(cb_sm0, 1);cb_push_back(cb_sm1, 1);cb_pop_front(cb_exps, 1);cb_pop_front(cb_rsum, 1);}void kernel_main() {4 unmodified linescompute_kernel_hw_startup(cb_lg, cb_scmax, cb_exps);cb_wait_front(cb_scmax, 1);cb_wait_front(cb_scsum, 1);convert_item(); // the first item; then one item ahead#ifdef MSDA_K_TIMINGuint32_t t_geo = 0, t_w = 0, t_tl = 0, t_st = 0, t_fin = 0, t_acq = 0, t_pw = 0, t0, t1;#endiffor (uint32_t w = ci; w < NWORK; w += NC) {if (w + NC < NWORK) {2 unmodified linescb_wait_front(cb_ctl, 1);const uint32_t nch = read_tile_value(cb_ctl, 0, 0);cb_pop_front(cb_ctl, 1);cb_reserve_back(cb_acc, 1);for (uint32_t ch = 0; ch < nch; ++ch) {#ifdef MSDA_K_TIMINGt1 = TNOW();#endif// ---- 1. corner weights per half (exact fp32 copies into DEST: an FPU add would round the 2^23 + q// fractions to tf32), the SFPU on the left faces only (the point columns 0..7)#ifdef MSDA_K_CPNONE// probe: consume the chunk's inputs without any workfor (uint32_t h = 0; h < 2; ++h) {cb_wait_front(h ? cb_geo1 : cb_geo0, 3);cb_pop_front(h ? cb_geo1 : cb_geo0, 3);cb_wait_front(h ? cb_in1 : cb_in0, NS);cb_pop_front(h ? cb_in1 : cb_in0, NS);}continue;#endifcb_reserve_back(cb_w, 8);#ifdef MSDA_K_NOWfor (uint32_t h = 0; h < 2; ++h) {cb_wait_front(h ? cb_geo1 : cb_geo0, 3);cb_pop_front(h ? cb_geo1 : cb_geo0, 3);}#elsefor (uint32_t h = 0; h < 2; ++h) {const uint32_t cg = h ? cb_geo1 : cb_geo0;#ifdef MSDA_K_TIMINGt0 = TNOW();#endifcb_wait_front(cg, 3);#ifdef MSDA_K_TIMINGt_geo += TNOW() - t0;#endiftile_regs_acquire();reconfig_data_format_srca(cg);copy_init(cg);copy_tile(cg, 0, 0);copy_tile(cg, 1, 1);copy_tile(cg, 2, 2);MATH((SFPU_UNARY_INIT(unused)));MATH((SFPU_UNARY_CALL_NO_TEMPLATE_ARGS(DST_SYNC_MODE, DST_ACCUM_MODE, msda_cm_w_face, 0,VectorMode::C)));tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(cb_w);1 unmodified linepack_tile<true>(c, cb_w, h * 4 + c);}tile_regs_release();cb_pop_front(cg, 3);}#endifcb_push_back(cb_w, 8);cb_wait_front(cb_w, 8);#ifdef MSDA_K_TIMING32 unmodified linesconst uint32_t ci_ = h ? cb_tl1 : cb_tl0;cb_wait_front(ci_, NS);#ifdef MSDA_K_NOSTEPSfor (uint32_t k = 0; k < 4; k += 4) {#elsefor (uint32_t k = 0; k < NS; k += 4) {#endif#ifdef MSDA_K_TIMINGuint32_t ta = TNOW();5 unmodified lines// DEST[c] = V_{q, c} * (W_{h, c} column 4 q broadcast over the 32 channels): one FPU product per// (point, corner); the weight tf32 in srcB, as the earlier broadcast matmul gave it (bit for bit)#ifndef MSDA_K_NOMULif (k == 0) {mul_bcast_cols_init(ci_, cb_w);}for (uint32_t c = 0; c < 4; ++c) {MATH((llk_math_eltwise_binary<EltwiseBinaryType::ELWMUL, BroadcastType::COL,DST_ACCUM_MODE, MATH_FIDELITY,EltwiseBinaryReuseDestType::NONE>(ci_, cb_w, c, true)));UNPACK((unpack_ab_col_ofs(ci_, cb_w, k + c, h * 4 + c, k >> 2)));}#endiftile_regs_commit();4 unmodified lines#ifdef MSDA_K_TIMINGt_pw += TNOW() - ta;#endif#if defined(MSDA_K_ACCOLD)for (uint32_t c = 0; c < 4; ++c) {pack_reconfig_l1_acc((ch == 0 && h == 0 && k == 0 && c == 0) ? 0 : 1);pack_tile<true>(c, cb_acc, 0);}#else// L1 accumulation switched only where its state changes (each switch stalls the packer until// it is idle): off for the item's very first pack, on for the chunk's steps, off again after// them (the weight / tilize packs of the next chunk overwrite)uint32_t c0 = 0;if (h == 0 && k == 0) {if (ch == 0) {pack_tile<true>(0, cb_acc, 0);c0 = 1;}pack_reconfig_l1_acc(1);}#ifdef MSDA_K_PACK1for (uint32_t c = c0; c < 1; ++c) {#elsefor (uint32_t c = c0; c < 4; ++c) {#endifpack_tile<true>(c, cb_acc, 0);}#endiftile_regs_release();}cb_pop_front(ci_, NS);5 unmodified linest_st += t0 - t1;#endif}#ifdef MSDA_K_CPNONEcb_reserve_back(cb_out, 1);cb_push_back(cb_out, 1);16 unmodified linescb_pop_front(cb_acc, 1);}#ifdef MSDA_K_TIMINGDeviceTimestampedData("geo", t_geo);DeviceTimestampedData("w", t_w);DeviceTimestampedData("tl", t_tl);DeviceTimestampedData("st", t_st);12345678910111213141514 unmodified lines3031323334353637388 unmodified lines4748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979816 unmodified lines11511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422519 unmodified lines2452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892904 unmodified lines2952962972982993003013023033043053063072 unmodified lines3103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493501 unmodified line35235335435535635735832 unmodified lines3913923933943953963973983995 unmodified lines4054064074084094104114124134144154164174184 unmodified lines4234244254264274284294304314324334344354364374384394404414425 unmodified lines44844945045145245345445545616 unmodified lines473474475476477478// SPDX-License-Identifier: Apache-2.0// msda_cm (tt/msda_cm.py), compute: per work item (32 cells x one head; see msda_cm_reader.cpp)// 0. one item ahead, the item's conversions: the offsets of each reader RISC h (the in-kernel projection, or the raw// projection tile typecast) + the frame's anchor terms of slot 0 / 1 -> two int32 position tiles, packed for the// reader (cb_off_h) and for this kernel (cb_pos_h); the head's softmax over its 32 logit columns, times the// cell's 1 / (camera count) (cm_anchors' factor tile: upstream's mean over the cameras) -> cb_sm;// then the chunk count from cb_ctl (read_tile_value: the same value on the three TRISCs) and per chunk (slot, level):// 1. for each half h: DEST0 <- the slot's position tile, DEST1 <- the softmax tile; SFPU: per point of level l the// fractions of x / y, the weight masked to 0 outside the map, the 4 corner weights W_c -> cb_w pages 4 h + c// (fp32; own point q in column 4 q: the column layout of tt/encoder.py cm_column_orders puts level l's point q// in SFPU lane (2 q + 7 (l & 1)) & 7 of a face, the x / y columns as the two column parities of that lane, so// odd levels need one lane rotation);// 2. the [32 x 128] quad staging blocks tilized into the 4 corner tiles per point;// 3. for each (point q, corner c): DEST = V * (column 4 q of W_{h,c} broadcast over the 32 channels: an FPU// multiply with the weight tile read 16 q bytes on), packer L1 accumulation into cb_acc (fp32) over ALL chunks14 unmodified lines#include "api/compute/eltwise_unary/typecast.h"#include "api/compute/reduce.h"#include "api/compute/softmax.h"#include "api/compute/matmul.h"#include "api/compute/add_int_sfpu.h"#include "api/compute/eltwise_binary_sfpu.h"#include "ttnn/cpp/ttnn/kernel_lib/reduce_helpers_compute.hpp"#include "ttnn/cpp/ttnn/kernel_lib/eltwise/api/chain.hpp"#include "ttnn/cpp/ttnn/kernel_lib/eltwise/api/convenience.hpp"8 unmodified lines#include "sfpi.h"namespace ckernel::sfpu {// One face row (called for faces 0 and 2 of tile 0: rows 0..15 / 16..31). DEST tile 0 = the slot's position tile// (int32 Q16.16), tile 1 = the softmax tile -> tiles 0..3 = the NW, NE, SW, SE weights of level L, half H in the// even columns 4 q (only those are read). Per row quad: x / y = the two parities of face L >> 1 (relative 8 (L >> 1)),// the logit weight = parity L >> 1 of face H of tile 1; inside the map <=> x0 + 1 in [0, wv] and y0 + 1 in [0, hv],// i.e. x in [-2^16, wv 2^16) and y in [-2^16, hv 2^16) (the reader's test); the fractions as 2^23 + q, the same// fp32 arithmetic as before.template <uint32_t L, uint32_t H, int32_t XLIM, int32_t YLIM>inline void msda_cm_w2() {constexpr int FX = 8 * (L >> 1);constexpr int FA = 32 + 8 * H + (L >> 1);#pragma GCC unroll 4for (int g = 0; g < 4; g++) {sfpi::vInt x = sfpi::dst_reg[FX].mode<sfpi::DataLayout::I32>();sfpi::vInt y = sfpi::dst_reg[FX + 1].mode<sfpi::DataLayout::I32>();sfpi::vFloat a = sfpi::dst_reg[FA];sfpi::vFloat am = 0.0f;v_if (x >= -65536) {v_and(x < XLIM);v_and(y >= -65536);v_and(y < YLIM);am = a;}v_endif;sfpi::vInt qx = (x & 0xFFFF) | 0x4B000000;sfpi::vInt qy = (y & 0xFFFF) | 0x4B000000;sfpi::vFloat fx = (sfpi::as<sfpi::vFloat>(qx) - 8388608.0f) * 0.0000152587890625f;sfpi::vFloat fy = (sfpi::as<sfpi::vFloat>(qy) - 8388608.0f) * 0.0000152587890625f;sfpi::vFloat gx = 1.0f - fx;sfpi::vFloat ay0 = am * (1.0f - fy);sfpi::vFloat ay1 = am * fy;sfpi::vFloat w0 = gx * ay0;sfpi::vFloat w1 = fx * ay0;sfpi::vFloat w2 = gx * ay1;sfpi::vFloat w3 = fx * ay1;if constexpr (L & 1) {// odd levels sit one lane below the broadcast lanes 2 q (lane 2 q - 1, mod 8)w0 = sfpi::subvec_shflror1(w0);w1 = sfpi::subvec_shflror1(w1);w2 = sfpi::subvec_shflror1(w2);w3 = sfpi::subvec_shflror1(w3);}sfpi::dst_reg[0] = w0;sfpi::dst_reg[32] = w1;sfpi::dst_reg[64] = w2;sfpi::dst_reg[96] = w3;sfpi::dst_reg++;sfpi::dst_reg++;}}16 unmodified linesconstexpr uint32_t NWORK = get_compile_time_arg_val(0);constexpr uint32_t NC = get_compile_time_arg_val(1);constexpr uint32_t GX = get_compile_time_arg_val(2);constexpr int32_t HV[4] = {get_compile_time_arg_val(3), get_compile_time_arg_val(4), get_compile_time_arg_val(5),get_compile_time_arg_val(6)};constexpr int32_t WV[4] = {get_compile_time_arg_val(7), get_compile_time_arg_val(8), get_compile_time_arg_val(9),get_compile_time_arg_val(10)};constexpr uint32_t P = 8;constexpr uint32_t PH = P / 2;constexpr uint32_t NS = PH * 4;constexpr uint32_t BW = 4; // tiles per quad staging blockconstexpr uint32_t cb_in0 = 0, cb_in1 = 1, cb_pos0 = 2, cb_pos1 = 3, cb_w = 5, cb_acc = 6, cb_ctl = 9,cb_out = 16, cb_tl0 = 19, cb_tl1 = 20;namespace ckl = compute_kernel_lib;// the per-item conversions (msda_cm_reader.cpp): the raw sampling projection tiles -> int32 (Q16.16; the same SFPU// typecast as ttnn.typecast), the logit tile -> softmax over the head's 32 columns (the LLK sequence of// ttnn.softmax(numeric_stable) on one fp32 tile, as msda_k_compute.cpp: row max -> exp(x - max) -> row sum -> 1 / sum// -> x * (1 / sum)) times the cell's factorconstexpr uint32_t cb_scmax = 10, cb_scsum = 11, cb_lg = 12, cb_max = 13, cb_exps = 14, cb_rsum = 15, cb_raw0 = 17,cb_raw1 = 18, cb_off0 = 21, cb_off1 = 22, cb_sm = 23, cb_at = 27;// DEST 0 holds the item's int32 offsets of one reader RISC: + the frame's anchor terms of slot 0 / 1 (cb_at pages 0,// 1, int32, exact copies) -> the two position tiles into cb_off_h (the reader) and cb_pos_h (step 1)static inline void add_anchors_and_pack(uint32_t co, uint32_t cp) {reconfig_data_format_srca(cb_at);copy_init(cb_at);copy_tile(cb_at, 0, 1);copy_tile(cb_at, 1, 2);add_int_tile_init();add_int_tile<DataFormat::Int32>(0, 1, 1);add_int_tile<DataFormat::Int32>(0, 2, 2);tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(co);pack_tile(1, co);pack_tile(2, co);pack_tile(1, cp);pack_tile(2, cp);tile_regs_release();}#ifdef MSDA_CM_FUSED// MSDA_CM_FUSED: the item's projection here (msda_cm_reader.cpp): DEST <- the bias rows (fp32, exact), += block b's// query (bf16) x the head's weight tiles over K = 256 (HiFi4, fp32 accumulation, the weight tf32 in srcA as in// ttnn.linear), then the offsets typecast to int32 (+ the anchors) and the logits -> cb_lg (for the softmax)constexpr uint32_t cb_q = 4, cb_wt = 25, cb_bias = 26;static inline void project_item() {cb_wait_front(cb_q, 8);for (uint32_t n = 0; n < 3; ++n) {const uint32_t co = n == 0 ? cb_off0 : (n == 1 ? cb_off1 : cb_lg);const uint32_t cp = n == 0 ? cb_pos0 : cb_pos1;cb_reserve_back(co, n < 2 ? 2 : 1);if (n < 2) {cb_reserve_back(cp, 2);}tile_regs_acquire();reconfig_data_format_srca(cb_bias);copy_init(cb_bias);copy_tile(cb_bias, n, 0);reconfig_data_format(cb_wt, cb_q); // matmul: in1 (weights) -> srcA, in0 (query) -> srcBmatmul_init(cb_q, cb_wt);for (uint32_t kt = 0; kt < 8; ++kt) {matmul_tiles(cb_q, cb_wt, kt, 3 * kt + n, 0);}if (n < 2) {typecast_tile_init<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>();typecast_tile<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>(0);add_anchors_and_pack(co, cp);cb_push_back(co, 2);cb_push_back(cp, 2);continue;}tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(co);pack_tile(0, co);tile_regs_release();cb_push_back(co, 1);}cb_pop_front(cb_q, 8);}#endifstatic inline void convert_item() {cb_wait_front(cb_at, 3);#ifdef MSDA_CM_FUSEDproject_item();#elsefor (uint32_t h = 0; h < 2; ++h) {const uint32_t cr = h ? cb_raw1 : cb_raw0;const uint32_t co = h ? cb_off1 : cb_off0;const uint32_t cp = h ? cb_pos1 : cb_pos0;cb_wait_front(cr, 1);cb_reserve_back(co, 2);cb_reserve_back(cp, 2);tile_regs_acquire();reconfig_data_format_srca(cr);copy_init(cr);copy_tile(cr, 0, 0);typecast_tile_init<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>();typecast_tile<static_cast<uint32_t>(DataFormat::Float32), static_cast<uint32_t>(DataFormat::Int32)>(0);add_anchors_and_pack(co, cp);cb_push_back(co, 2);cb_push_back(cp, 2);cb_pop_front(cr, 1);}#endifreconfig_data_format(cb_lg, cb_lg);pack_reconfig_data_format(cb_exps);copy_init(cb_lg);19 unmodified linesrecip_tile<ReciprocalDestAcc::FP32, ReciprocalApproxMode::Precise>(0);});cb_wait_front(cb_rsum, 1);cb_reserve_back(cb_sm, 1);tile_regs_acquire();reconfig_data_format(cb_exps, cb_rsum);mul_bcast_cols_init(cb_exps, cb_rsum);mul_tiles_bcast_cols(cb_exps, cb_rsum, 0, 0, 0);// x the cell's factor (1, or 1 / 2 on 2-camera rows; an exact fp32 scaling): cm_anchors' third tilereconfig_data_format_srca(cb_at);copy_init(cb_at);copy_tile(cb_at, 2, 1);mul_binary_tile_init();mul_binary_tile(0, 1, 0);tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(cb_sm);pack_tile(0, cb_sm);tile_regs_release();cb_push_back(cb_sm, 1);cb_pop_front(cb_exps, 1);cb_pop_front(cb_rsum, 1);cb_pop_front(cb_at, 3);}// step 1 for (level L, half H): the weights of the chunk's slot (cb_pos_h page k) -> DEST 0..3template <uint32_t L, uint32_t H>static inline void weights_lh() {MATH((SFPU_UNARY_CALL(DST_SYNC_MODE, DST_ACCUM_MODE, msda_cm_w2, (L, H, WV[L] * 65536, HV[L] * 65536), 0,VectorMode::C)));}template <uint32_t H>static inline void weights_h(uint32_t l) {if (l == 0) {weights_lh<0, H>();} else if (l == 1) {weights_lh<1, H>();} else if (l == 2) {weights_lh<2, H>();} else {weights_lh<3, H>();}}void kernel_main() {4 unmodified linescompute_kernel_hw_startup(cb_lg, cb_scmax, cb_exps);cb_wait_front(cb_scmax, 1);cb_wait_front(cb_scsum, 1);#ifdef MSDA_CM_FUSEDcb_wait_front(cb_wt, 24);cb_wait_front(cb_bias, 3);#endifconvert_item(); // the first item; then one item ahead#ifdef MSDA_K_TIMINGuint32_t t_w = 0, t_tl = 0, t_st = 0, t_acq = 0, t_pw = 0, t0, t1;#endiffor (uint32_t w = ci; w < NWORK; w += NC) {if (w + NC < NWORK) {2 unmodified linescb_wait_front(cb_ctl, 1);const uint32_t nch = read_tile_value(cb_ctl, 0, 0);cb_pop_front(cb_ctl, 1);cb_wait_front(cb_pos0, 2);cb_wait_front(cb_pos1, 2);cb_wait_front(cb_sm, 1);cb_reserve_back(cb_acc, 1);for (uint32_t ch = 0; ch < nch; ++ch) {const uint32_t k = ch >> 2;const uint32_t l = ch & 3;#ifdef MSDA_K_TIMINGt1 = TNOW();#endif#ifdef MSDA_K_CPNONE// probe: consume the chunk's staging blocks without any workfor (uint32_t h = 0; h < 2; ++h) {cb_wait_front(h ? cb_in1 : cb_in0, NS);cb_pop_front(h ? cb_in1 : cb_in0, NS);}continue;#endif// ---- 1. corner weights per half from the position and softmax tiles (exact fp32 / int32 copies)cb_reserve_back(cb_w, 8);for (uint32_t h = 0; h < 2; ++h) {const uint32_t cp = h ? cb_pos1 : cb_pos0;tile_regs_acquire();reconfig_data_format_srca(cp);copy_init(cp);copy_tile(cp, k, 0);reconfig_data_format_srca(cb_sm);copy_init(cb_sm);copy_tile(cb_sm, 0, 1);MATH((SFPU_UNARY_INIT(unused)));if (h == 0) {weights_h<0>(l);} else {weights_h<1>(l);}tile_regs_commit();tile_regs_wait();pack_reconfig_data_format(cb_w);1 unmodified linepack_tile<true>(c, cb_w, h * 4 + c);}tile_regs_release();}cb_push_back(cb_w, 8);cb_wait_front(cb_w, 8);#ifdef MSDA_K_TIMING32 unmodified linesconst uint32_t ci_ = h ? cb_tl1 : cb_tl0;cb_wait_front(ci_, NS);#ifdef MSDA_K_NOSTEPSfor (uint32_t kk = 0; kk < 4; kk += 4) {#elsefor (uint32_t kk = 0; kk < NS; kk += 4) {#endif#ifdef MSDA_K_TIMINGuint32_t ta = TNOW();5 unmodified lines// DEST[c] = V_{q, c} * (W_{h, c} column 4 q broadcast over the 32 channels): one FPU product per// (point, corner); the weight tf32 in srcB, as the earlier broadcast matmul gave it (bit for bit)#ifndef MSDA_K_NOMULif (kk == 0) {mul_bcast_cols_init(ci_, cb_w);}for (uint32_t c = 0; c < 4; ++c) {MATH((llk_math_eltwise_binary<EltwiseBinaryType::ELWMUL, BroadcastType::COL,DST_ACCUM_MODE, MATH_FIDELITY,EltwiseBinaryReuseDestType::NONE>(ci_, cb_w, c, true)));UNPACK((unpack_ab_col_ofs(ci_, cb_w, kk + c, h * 4 + c, kk >> 2)));}#endiftile_regs_commit();4 unmodified lines#ifdef MSDA_K_TIMINGt_pw += TNOW() - ta;#endif// L1 accumulation switched only where its state changes (each switch stalls the packer until// it is idle): off for the item's very first pack, on for the chunk's steps, off again after// them (the weight / tilize packs of the next chunk overwrite)uint32_t c0 = 0;if (h == 0 && kk == 0) {if (ch == 0) {pack_tile<true>(0, cb_acc, 0);c0 = 1;}pack_reconfig_l1_acc(1);}for (uint32_t c = c0; c < 4; ++c) {pack_tile<true>(c, cb_acc, 0);}tile_regs_release();}cb_pop_front(ci_, NS);5 unmodified linest_st += t0 - t1;#endif}cb_pop_front(cb_pos0, 2);cb_pop_front(cb_pos1, 2);cb_pop_front(cb_sm, 1);#ifdef MSDA_K_CPNONEcb_reserve_back(cb_out, 1);cb_push_back(cb_out, 1);16 unmodified linescb_pop_front(cb_acc, 1);}#ifdef MSDA_K_TIMINGDeviceTimestampedData("w", t_w);DeviceTimestampedData("tl", t_tl);DeviceTimestampedData("st", t_st);
12 unmodified lines1314151617181920212223242526272829305 unmodified lines3637383940414216 unmodified lines59606162636465666768697071722 unmodified lines757677787980818283849 unmodified lines9495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491504 unmodified lines1551561571581591601611621631641651661671681693 unmodified lines1731741751761771781 unmodified line18018118218318418518618718818919019119219319419519619728 unmodified lines22622722822923023123223323423523623723823924024124224324424524624724813 unmodified lines2622632642652662672681 unmodified line2702712722732742752762772782792802812822832842852862872882892902912922932946 unmodified lines30130230330430530630730830931031112 unmodified lines// slot's camera (or -1), column 18 = the cell's camera count (0 .. K);// and hands the compute kernel its raw projection tiles two items ahead (the compute kernel converts them and hands// them back before the item's chunks):// off fp32 TILE [1, 1, NQ, H * 64] (the sampling projection, 2^16-scaled), own tile b * 2 H + 2 j + PART: column// l * 8 + 2 q + (x, y) = the offset of point 4 PART + q of level l (tt/encoder.py orders the columns so)// -> back as int32 (Q16.16) in cb_off;// lg fp32 TILE [1, 1, NQ, H * 32] (the attention projection), tile b * H + j (PART 0 only): column// 16 h + 4 l + q = the logit of point 4 h + q of level l -> back as the softmax over the head's 32 columns// in cb_sm (one copy per RISC), whose own two faces PART, 2 + PART this RISC halves once per item on// 2-camera rows (upstream's mean over the cameras; exact for normal numbers);// and then runs the chunks (slot k, level l) for k < nslot (the block's largest camera count; one empty chunk when// no camera sees the block): per chunk cb_geo <- fx, fy, attn (fp32) of own point q in column 4 q (the compute kernel// broadcasts columns 0, 4, 8, 12 of its weight tiles) and cb_in <- per own point one [32 x 128] row-major staging// block (one 256-byte quad page read per point and row: NW | NE | SW | SE). PART 0 pushes the chunk count to cb_ctl.// value: quad maps per level l, [H * NCAM, HV_l + 1, WV_l + 1, 128] bf16 ROW_MAJOR, L1 interleaved; map j * NCAM + cam.#include <stdint.h>#include "api/dataflow/dataflow_api.h"5 unmodified linesconstexpr uint32_t PART = get_compile_time_arg_val(0);constexpr uint32_t cb_in = get_compile_time_arg_val(1);constexpr uint32_t cb_geo = get_compile_time_arg_val(2);constexpr uint32_t cb_t = get_compile_time_arg_val(3); // own scratch: 2 T pagesconstexpr uint32_t cb_out = get_compile_time_arg_val(5);constexpr uint32_t cb_ctl = get_compile_time_arg_val(6);16 unmodified linesconstexpr uint32_t OFF_C0 = get_compile_time_arg_val(25);constexpr uint32_t LG_TW = get_compile_time_arg_val(26);constexpr uint32_t LG_C0 = get_compile_time_arg_val(27);constexpr auto t_args = TensorAccessorArgs<28>();constexpr auto l_args = TensorAccessorArgs<t_args.next_compile_time_args_offset()>();constexpr auto a_args = TensorAccessorArgs<l_args.next_compile_time_args_offset()>();constexpr auto o_args = TensorAccessorArgs<a_args.next_compile_time_args_offset()>();// the conversion CBs (the compute kernel's softmax scalers / logits; own raw off tiles, converted off, softmax)constexpr uint32_t cb_scmax = 10, cb_scsum = 11, cb_lg = 12;constexpr uint32_t cb_raw = PART ? 18 : 17, cb_off = PART ? 22 : 21, cb_sm = PART ? 24 : 23;constexpr uint32_t P = 8; // points per levelconstexpr uint32_t PH = P / 2;2 unmodified linesconstexpr uint32_t NWORK = NB * H;static_assert(K >= 1 && K <= 2, "msda_cm: 1 or 2 camera slots");constexpr uint32_t FRAC0 = 0x4B000000u; // fp32 2^23: the compute kernel takes (f - 2^23) * 2^-16static inline uint32_t q16_frac(uint32_t q) { return FRAC0 | q; }// x / 2 for an fp32 softmax weight (exact for normal numbers; the tiny denormal ones become 0)static inline uint32_t half_bits(uint32_t v) { return ((v >> 23) & 0xFF) > 1 ? v - 0x800000u : 0u; }static inline void zero_l1(uint32_t addr, uint32_t bytes) {const uint64_t z = get_noc_addr(MEM_ZEROS_BASE);9 unmodified linesNOC_CMD_BUF_WRITE_REG(noc_index, read_cmd_buf, NOC_CMD_CTRL, NOC_CTRL_SEND_REQ);}// one chunk (slot k, level L) of own points: geo + reads; returns the number of reads issuedtemplate <uint32_t L>static inline uint32_t chunk(const int32_t* T, const int32_t* OFF, const uint32_t* SM, uint32_t* fx, uint32_t* fy,uint32_t* at, uint32_t k, uint32_t nslot, uint32_t rows, uint32_t jcam, uint32_t mbase,uint32_t in_base) {constexpr int32_t hv = HV[L], wv = WV[L];constexpr uint32_t wv1 = static_cast<uint32_t>(wv + 1);constexpr uint32_t plane = static_cast<uint32_t>((hv + 1) * (wv + 1));constexpr uint32_t OFFL = (L >> 1) * 256 + (L & 1) * 8; // element of (row 0, level L) in the off tileconstexpr uint32_t ATTL = L * 4; // column of level L in the own faces of cb_smuint32_t nrd = 0;for (uint32_t r = 0; r < 32; ++r) {const uint32_t rb = ((r >> 4) << 9) + ((r & 15) << 4); // element of (r, 0) in a full tileconst int32_t cam = nslot ? T[rb + 256 + k] : -1;if (!(r < rows && cam >= 0)) {#pragma GCC unroll 4for (uint32_t q = 0; q < PH; ++q) {at[rb + 4 * q] = 0; // fx / fy keep earlier finite values: the weights are 0}continue;}const uint32_t pbase = (jcam + static_cast<uint32_t>(cam)) * plane + wv1 + 1; // + (y0 * (wv + 1) + x0)const int32_t* tk = T + rb + 8 * k;const int32_t* orow = OFF + rb + OFFL;const uint32_t* arow = SM + ((((r >> 4) << 1) + PART) << 8) + ((r & 15) << 4) + ATTL;const uint32_t sbase = in_base + r * QPAGE;#pragma GCC unroll 4for (uint32_t q = 0; q < PH; ++q) {const int32_t vx = ((tk[2 * q] >> L) - 32768) + orow[2 * q];const int32_t vy = ((tk[2 * q + 1] >> L) - 32768) + orow[2 * q + 1];const int32_t x0 = vx >> 16;const int32_t y0 = vy >> 16;// all four corners outside <=> x0 + 1 not in [0, wv] or y0 + 1 not in [0, hv]if (static_cast<uint32_t>(x0 + 1) > static_cast<uint32_t>(wv) ||static_cast<uint32_t>(y0 + 1) > static_cast<uint32_t>(hv)) {at[rb + 4 * q] = 0;continue;}fx[rb + 4 * q] = q16_frac(static_cast<uint32_t>(vx) & 0xFFFF);fy[rb + 4 * q] = q16_frac(static_cast<uint32_t>(vy) & 0xFFFF);at[rb + 4 * q] = arow[q];#ifdef MSDA_K_NOREADcontinue;#endifconst uint32_t pg = pbase + static_cast<uint32_t>(y0) * wv1 + static_cast<uint32_t>(x0);const uint32_t row = udivsi3_const_divisor<NUM_L1_BANKS>(pg);const uint32_t bank = pg - row * NUM_L1_BANKS;quad_read(l1_bank_to_noc_xy[noc_index][bank], mbase + row * QPAGE + bank_to_l1_offset[bank],sbase + q * 4 * TB16);nrd += 1;}}return nrd;}4 unmodified linesreturn;}const auto t_acc = TensorAccessor(t_args, get_common_arg_val<uint32_t>(0), TB32);const auto l_acc = TensorAccessor(l_args, get_common_arg_val<uint32_t>(1), TB32);const auto a_acc = TensorAccessor(a_args, get_common_arg_val<uint32_t>(2), TB32);const auto o_acc = TensorAccessor(o_args, get_common_arg_val<uint32_t>(3), TB16);const uint32_t maddr[4] = {get_common_arg_val<uint32_t>(4), get_common_arg_val<uint32_t>(5),get_common_arg_val<uint32_t>(6), get_common_arg_val<uint32_t>(7)};// the geo pages and the staging blocks: zero once (unwritten columns stay 0 / finite)cb_reserve_back(cb_geo, 6);zero_l1(get_write_ptr(cb_geo), 6 * TB32);cb_reserve_back(cb_in, 2 * NS);zero_l1(get_write_ptr(cb_in), 2 * NS * TB16);if constexpr (PUSHES_CTL) {3 unmodified linesdataflow_kernel_lib::calculate_and_prepare_reduce_scaler<cb_scsum, ckernel::PoolType::SUM,ckernel::ReduceDim::REDUCE_ROW>();}// two T sets: the next item's T is read while this item's chunks runcb_reserve_back(cb_t, 2);const uint32_t sbuf = get_write_ptr(cb_t);1 unmodified line// the raw projection tiles of item w into the next free page of cb_raw (and cb_lg)auto raw = [&](uint32_t w) {const uint32_t b = w / H;const uint32_t j = w - b * H;cb_reserve_back(cb_raw, 1);noc_async_read(l_acc.get_noc_addr(b * OFF_TW + OFF_C0 + 2 * j + PART), get_write_ptr(cb_raw), TB32);if constexpr (PUSHES_CTL) {cb_reserve_back(cb_lg, 1);noc_async_read(a_acc.get_noc_addr(b * LG_TW + LG_C0 + j), get_write_ptr(cb_lg), TB32);}};auto raw_push = [&]() {cb_push_back(cb_raw, 1);if constexpr (PUSHES_CTL) {cb_push_back(cb_lg, 1);}};#ifdef MSDA_K_TIMING28 unmodified lines}set ^= 1;int32_t* T = reinterpret_cast<int32_t*>(tbase);cb_wait_front(cb_off, 1);cb_wait_front(cb_sm, 1);const int32_t* OFF = reinterpret_cast<const int32_t*>(get_read_ptr(cb_off));uint32_t* const SM = reinterpret_cast<uint32_t*>(get_read_ptr(cb_sm));const uint32_t rows = NQ - b * 32 < 32 ? NQ - b * 32 : 32;uint32_t nslot = 0;for (uint32_t r = 0; r < rows; ++r) {const uint32_t c = static_cast<uint32_t>(T[((r >> 4) << 9) + ((r & 15) << 4) + 256 + 2]);nslot = c > nslot ? c : nslot;if (c >= 2) {// upstream's mean over the 2 cameras: the row's 16 own weights halved once per itemuint32_t* arow = SM + ((((r >> 4) << 1) + PART) << 8) + ((r & 15) << 4);#pragma GCC unroll 16for (uint32_t i = 0; i < 16; ++i) {arow[i] = half_bits(arow[i]);}}}nslot = nslot > K ? K : nslot;const uint32_t nch = nslot ? nslot * 4 : 1;13 unmodified lines#ifdef MSDA_K_TIMINGt0 = TNOW();#endifcb_reserve_back(cb_geo, 3);cb_reserve_back(cb_in, NS);#ifdef MSDA_K_TIMINGt1 = TNOW();1 unmodified line#endif#ifdef MSDA_K_RDNONE// probe: hand the compute kernel the chunk's pages without any reader workcb_push_back(cb_geo, 3);cb_push_back(cb_in, NS);continue;#endifconst uint32_t g_addr = get_write_ptr(cb_geo);const uint32_t in_base = get_write_ptr(cb_in);uint32_t* fx = reinterpret_cast<uint32_t*>(g_addr);uint32_t* fy = reinterpret_cast<uint32_t*>(g_addr + TB32);uint32_t* at = reinterpret_cast<uint32_t*>(g_addr + 2 * TB32);noc_async_read_one_packet_set_state(get_noc_addr(MEM_ZEROS_BASE), QPAGE);uint32_t nrd;if (l == 0) {nrd = chunk<0>(T, OFF, SM, fx, fy, at, k, nslot, rows, jcam, maddr[0], in_base);} else if (l == 1) {nrd = chunk<1>(T, OFF, SM, fx, fy, at, k, nslot, rows, jcam, maddr[1], in_base);} else if (l == 2) {nrd = chunk<2>(T, OFF, SM, fx, fy, at, k, nslot, rows, jcam, maddr[2], in_base);} else {nrd = chunk<3>(T, OFF, SM, fx, fy, at, k, nslot, rows, jcam, maddr[3], in_base);}asm volatile("" ::: "memory");noc_reads_num_issued[noc_index] += nrd;6 unmodified linest1 = TNOW();t_bar += t1 - t0;#endifcb_push_back(cb_geo, 3);cb_push_back(cb_in, NS);}cb_pop_front(cb_off, 1);cb_pop_front(cb_sm, 1);if constexpr (WRITES_OUT) {if (prev != 0xFFFFFFFF) {#ifdef MSDA_K_TIMING12 unmodified lines13141516171819202122232425262728293031323334353637385 unmodified lines44454647484916 unmodified lines66676869707172737475767778798081828384858687882 unmodified lines9192939495969798999 unmodified lines1091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591604 unmodified lines1651661671681691701711721731741751761771783 unmodified lines1821831841851861871881891901911921931941951961971981992002012022032042052061 unmodified line20820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125228 unmodified lines28128228328428528628728828929029129229313 unmodified lines3073083093103113121 unmodified line3143153163173183193203213223233243253263273283293303313323333346 unmodified lines34134234334434534634734834912 unmodified lines// slot's camera (or -1), column 18 = the cell's camera count (0 .. K);// and hands the compute kernel its raw projection tiles two items ahead (the compute kernel converts them and hands// them back before the item's chunks):// off fp32 TILE [1, 1, NQ, H * 64] (the sampling projection, 2^16-scaled), own tile b * 2 H + 2 j + PART: in column// 16 (l >> 1) + 2 ((2 q + 7 (l & 1)) & 7) + (x, y) the offset of point 4 PART + q of level l (tt/encoder.py// cm_column_orders: the compute kernel's SFPU lane layout) -> back in cb_off as two int32 tiles, slot k = 0,// 1: the offset (Q16.16) + the frame's anchor term of slot k (cm_anchors.cpp: (anchor_{k, q} >> l) - 2^15, a// far-off sentinel on rows without that slot), i.e. the sampling position in Q16.16 pixels of level l;// at int32 TILE [1, 1, NQ, 96] (cm_anchors), tiles 3 b .. 3 b + 2 (PART 0 only): the anchor terms of the two// slots and the cells' 1 / camera count, for the compute kernel;// lg fp32 TILE [1, 1, NQ, H * 32] (the attention projection), tile b * H + j (PART 0 only): the logits of the// head, softmaxed in the compute kernel;// and then runs the chunks (slot k, level l) for k < nslot (the block's largest camera count; one empty chunk when// no camera sees the block): per chunk cb_in <- per own point one [32 x 128] row-major staging block (one 256-byte// quad page read per point and row inside the map: NW | NE | SW | SE; rows without the slot and points outside the// map read nothing, their weights are 0: the compute kernel makes the weights from the same positions). PART 0 pushes// the chunk count to cb_ctl.// value: quad maps per level l, [H * NCAM, HV_l + 1, WV_l + 1, 128] bf16 ROW_MAJOR, L1 interleaved; map j * NCAM + cam.// MSDA_CM_FUSED: the projection runs in the compute kernel. Then the "off" tensor is the layer's query (bf16 TILE// [1, 1, NQ, 256], 8 tiles per block: PART 0 hands block b's 8 tiles to cb_q, two items ahead, instead of the raw// tiles) and the "logits" tensor the projection [W; bias] (fp32 TILE [1, 1, 288, H * 96]: rows 0..255 the weight// with head j's 96 columns at 96 j = offsets of RISC 0, of RISC 1, logits; rows 256..287 the bias on every row),// whose 24 + 3 tiles of the core's head (NC % H == 0: every item of a core has head ci % H) PART 0 loads once.#include <stdint.h>#include "api/dataflow/dataflow_api.h"5 unmodified linesconstexpr uint32_t PART = get_compile_time_arg_val(0);constexpr uint32_t cb_in = get_compile_time_arg_val(1);constexpr uint32_t cb_t = get_compile_time_arg_val(3); // own scratch: 2 T pagesconstexpr uint32_t cb_out = get_compile_time_arg_val(5);constexpr uint32_t cb_ctl = get_compile_time_arg_val(6);16 unmodified linesconstexpr uint32_t OFF_C0 = get_compile_time_arg_val(25);constexpr uint32_t LG_TW = get_compile_time_arg_val(26);constexpr uint32_t LG_C0 = get_compile_time_arg_val(27);#ifdef MSDA_CM_FUSEDconstexpr bool FUSED = true;#elseconstexpr bool FUSED = false;#endifconstexpr uint32_t L_PAGE = FUSED ? 2048 : 4096;constexpr uint32_t cb_q = 4, cb_wt = 25, cb_bias = 26;constexpr auto t_args = TensorAccessorArgs<28>();constexpr auto l_args = TensorAccessorArgs<t_args.next_compile_time_args_offset()>();constexpr auto a_args = TensorAccessorArgs<l_args.next_compile_time_args_offset()>();constexpr auto o_args = TensorAccessorArgs<a_args.next_compile_time_args_offset()>();constexpr auto at_args = TensorAccessorArgs<o_args.next_compile_time_args_offset()>();constexpr uint32_t cb_at = 27;// the conversion CBs (the compute kernel's softmax scalers / logits; own raw off tiles, the positions)constexpr uint32_t cb_scmax = 10, cb_scsum = 11, cb_lg = 12;constexpr uint32_t cb_raw = PART ? 18 : 17, cb_off = PART ? 22 : 21;constexpr uint32_t P = 8; // points per levelconstexpr uint32_t PH = P / 2;2 unmodified linesconstexpr uint32_t NWORK = NB * H;static_assert(K >= 1 && K <= 2, "msda_cm: 1 or 2 camera slots");// the element of (row 0, level L, own point q, x) in a position tile (y: + 1)template <uint32_t L, uint32_t Q>constexpr uint32_t pos_col() { return (L >> 1) * 256 + 2 * ((2 * Q + 7 * (L & 1)) & 7); }static inline void zero_l1(uint32_t addr, uint32_t bytes) {const uint64_t z = get_noc_addr(MEM_ZEROS_BASE);9 unmodified linesNOC_CMD_BUF_WRITE_REG(noc_index, read_cmd_buf, NOC_CMD_CTRL, NOC_CTRL_SEND_REQ);}// one chunk (slot k, level L) of own points: the reads; returns the number of reads issuedtemplate <uint32_t L, uint32_t Q>static inline uint32_t point(const int32_t* prow, uint32_t pbase, uint32_t mbase, uint32_t dst) {constexpr int32_t hv = HV[L], wv = WV[L];constexpr uint32_t wv1 = static_cast<uint32_t>(wv + 1);const int32_t vx = prow[pos_col<L, Q>()];const int32_t vy = prow[pos_col<L, Q>() + 1];const int32_t x0 = vx >> 16;const int32_t y0 = vy >> 16;// all four corners outside <=> x0 + 1 not in [0, wv] or y0 + 1 not in [0, hv]if (static_cast<uint32_t>(x0 + 1) > static_cast<uint32_t>(wv) ||static_cast<uint32_t>(y0 + 1) > static_cast<uint32_t>(hv)) {return 0;}#ifdef MSDA_K_NOREADreturn 0;#endifconst uint32_t pg = pbase + static_cast<uint32_t>(y0) * wv1 + static_cast<uint32_t>(x0);const uint32_t row = udivsi3_const_divisor<NUM_L1_BANKS>(pg);const uint32_t bank = pg - row * NUM_L1_BANKS;quad_read(l1_bank_to_noc_xy[noc_index][bank], mbase + row * QPAGE + bank_to_l1_offset[bank], dst);return 1;}template <uint32_t L>static inline uint32_t chunk(const int32_t* T, const int32_t* POS, uint32_t k, uint32_t nslot, uint32_t rows,uint32_t jcam, uint32_t mbase, uint32_t in_base) {constexpr uint32_t plane = static_cast<uint32_t>((HV[L] + 1) * (WV[L] + 1));constexpr uint32_t wv1 = static_cast<uint32_t>(WV[L] + 1);uint32_t nrd = 0;if (!nslot) {return 0;}for (uint32_t r = 0; r < rows; ++r) {const uint32_t rb = ((r >> 4) << 9) + ((r & 15) << 4); // element of (r, 0) in a full tileconst int32_t cam = T[rb + 256 + k];if (cam < 0) {continue;}const uint32_t pbase = (jcam + static_cast<uint32_t>(cam)) * plane + wv1 + 1; // + (y0 * (wv + 1) + x0)const int32_t* prow = POS + rb;const uint32_t sbase = in_base + r * QPAGE;nrd += point<L, 0>(prow, pbase, mbase, sbase);nrd += point<L, 1>(prow, pbase, mbase, sbase + 4 * TB16);nrd += point<L, 2>(prow, pbase, mbase, sbase + 8 * TB16);nrd += point<L, 3>(prow, pbase, mbase, sbase + 12 * TB16);}return nrd;}4 unmodified linesreturn;}const auto t_acc = TensorAccessor(t_args, get_common_arg_val<uint32_t>(0), TB32);const auto l_acc = TensorAccessor(l_args, get_common_arg_val<uint32_t>(1), L_PAGE);const auto a_acc = TensorAccessor(a_args, get_common_arg_val<uint32_t>(2), TB32);const auto o_acc = TensorAccessor(o_args, get_common_arg_val<uint32_t>(3), TB16);const auto at_acc = TensorAccessor(at_args, get_common_arg_val<uint32_t>(8), TB32);const uint32_t maddr[4] = {get_common_arg_val<uint32_t>(4), get_common_arg_val<uint32_t>(5),get_common_arg_val<uint32_t>(6), get_common_arg_val<uint32_t>(7)};// the staging blocks: zero once (rows that read nothing keep earlier finite values; their weights are 0)cb_reserve_back(cb_in, 2 * NS);zero_l1(get_write_ptr(cb_in), 2 * NS * TB16);if constexpr (PUSHES_CTL) {3 unmodified linesdataflow_kernel_lib::calculate_and_prepare_reduce_scaler<cb_scsum, ckernel::PoolType::SUM,ckernel::ReduceDim::REDUCE_ROW>();}if constexpr (FUSED && PUSHES_CTL) {// the projection of head ci % H: weight tiles (kt, n) -> cb_wt page 3 kt + n, bias tiles -> cb_bias page nconst uint32_t j0 = ci % H;cb_reserve_back(cb_wt, 24);cb_reserve_back(cb_bias, 3);const uint32_t wa = get_write_ptr(cb_wt);const uint32_t ba = get_write_ptr(cb_bias);for (uint32_t kt = 0; kt < 8; ++kt) {for (uint32_t n = 0; n < 3; ++n) {noc_async_read(a_acc.get_noc_addr(kt * LG_TW + 3 * j0 + n), wa + (3 * kt + n) * TB32, TB32);}}for (uint32_t n = 0; n < 3; ++n) {noc_async_read(a_acc.get_noc_addr(8 * LG_TW + 3 * j0 + n), ba + n * TB32, TB32);}noc_async_read_barrier();cb_push_back(cb_wt, 24);cb_push_back(cb_bias, 3);}// two T sets: the next item's T is read while this item's chunks runcb_reserve_back(cb_t, 2);const uint32_t sbuf = get_write_ptr(cb_t);1 unmodified line// the raw projection tiles of item w into the next free page of cb_raw (and cb_lg)auto raw = [&](uint32_t w) {const uint32_t b = w / H;if constexpr (FUSED) {// block b's query tiles for the compute kernel's projection (PART 0 only)if constexpr (PUSHES_CTL) {cb_reserve_back(cb_q, 8);const uint32_t qa = get_write_ptr(cb_q);for (uint32_t kt = 0; kt < 8; ++kt) {noc_async_read(l_acc.get_noc_addr(b * OFF_TW + kt), qa + kt * L_PAGE, L_PAGE);}cb_reserve_back(cb_at, 3);for (uint32_t i = 0; i < 3; ++i) {noc_async_read(at_acc.get_noc_addr(3 * b + i), get_write_ptr(cb_at) + i * TB32, TB32);}}return;}const uint32_t j = w - b * H;cb_reserve_back(cb_raw, 1);noc_async_read(l_acc.get_noc_addr(b * OFF_TW + OFF_C0 + 2 * j + PART), get_write_ptr(cb_raw), TB32);if constexpr (PUSHES_CTL) {cb_reserve_back(cb_lg, 1);noc_async_read(a_acc.get_noc_addr(b * LG_TW + LG_C0 + j), get_write_ptr(cb_lg), TB32);cb_reserve_back(cb_at, 3);for (uint32_t i = 0; i < 3; ++i) {noc_async_read(at_acc.get_noc_addr(3 * b + i), get_write_ptr(cb_at) + i * TB32, TB32);}}};auto raw_push = [&]() {if constexpr (FUSED) {if constexpr (PUSHES_CTL) {cb_push_back(cb_q, 8);cb_push_back(cb_at, 3);}return;}cb_push_back(cb_raw, 1);if constexpr (PUSHES_CTL) {cb_push_back(cb_lg, 1);cb_push_back(cb_at, 3);}};#ifdef MSDA_K_TIMING28 unmodified lines}set ^= 1;int32_t* T = reinterpret_cast<int32_t*>(tbase);cb_wait_front(cb_off, 2);const int32_t* POS = reinterpret_cast<const int32_t*>(get_read_ptr(cb_off));const uint32_t rows = NQ - b * 32 < 32 ? NQ - b * 32 : 32;uint32_t nslot = 0;for (uint32_t r = 0; r < rows; ++r) {const uint32_t c = static_cast<uint32_t>(T[((r >> 4) << 9) + ((r & 15) << 4) + 256 + 2]);nslot = c > nslot ? c : nslot;}nslot = nslot > K ? K : nslot;const uint32_t nch = nslot ? nslot * 4 : 1;13 unmodified lines#ifdef MSDA_K_TIMINGt0 = TNOW();#endifcb_reserve_back(cb_in, NS);#ifdef MSDA_K_TIMINGt1 = TNOW();1 unmodified line#endif#ifdef MSDA_K_RDNONE// probe: hand the compute kernel the chunk's pages without any reader workcb_push_back(cb_in, NS);continue;#endifconst uint32_t in_base = get_write_ptr(cb_in);noc_async_read_one_packet_set_state(get_noc_addr(MEM_ZEROS_BASE), QPAGE);uint32_t nrd;const int32_t* PK = POS + k * 1024;if (l == 0) {nrd = chunk<0>(T, PK, k, nslot, rows, jcam, maddr[0], in_base);} else if (l == 1) {nrd = chunk<1>(T, PK, k, nslot, rows, jcam, maddr[1], in_base);} else if (l == 2) {nrd = chunk<2>(T, PK, k, nslot, rows, jcam, maddr[2], in_base);} else {nrd = chunk<3>(T, PK, k, nslot, rows, jcam, maddr[3], in_base);}asm volatile("" ::: "memory");noc_reads_num_issued[noc_index] += nrd;6 unmodified linest1 = TNOW();t_bar += t1 - t0;#endifcb_push_back(cb_in, NS);}cb_pop_front(cb_off, 2);if constexpr (WRITES_OUT) {if (prev != 0xFFFFFFFF) {#ifdef MSDA_K_TIMING
17 unmodified lines181920212223242 unmodified lines27282930313233343536373839404142434445467 unmodified lines54555657585960616263646566671 unmodified line6970717273741 unmodified line7677787980818283848586878889909192939495969798991001011021031041051061071081 unmodified line1101111121131141151164 unmodified lines12112212312412517 unmodified linesof point ``4 h + q``; the softmax over a head's 32 columns runs in the kernel. ``None``: ``off`` is ONE merged``[1, 1, Q, 768]`` projection, the offsets in columns ``[0, 512)`` and the logits in ``[512, 768)``;- ``table``: int32 TILE ``[1, 1, Q, 32]`` (``host.geometry.cm_table``): per slot k the 4 anchors as``round(uv * 2^(16 + smax))`` in columns ``8 k + 2 a + (x, y)``, the cameras in 16 + k (-1: none), the count in 18.Output ``[1, 1, Q, 256]`` bf16 TILE."""2 unmodified linesimport osfrom typing import Any, Optional, Sequence__all__ = ["msda_cm"]KDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "kernels")TB16, TB32 = 2048, 4096def msda_cm(maps: Sequence[Any], off: Any, logits: Optional[Any], table: Any, *, ncam: int = 6, slots: int = 2,memory_config: Any = None, debug: Sequence[str] = ()) -> Any:import ttnnif len(maps) != 4:raise ValueError("msda_cm: 4 levels")merged = logits is Noneif merged:# one [1, 1, Q, 96 H] projection: the offsets in columns [0, 64 H), the logits in [64 H, 96 H)logits = offheads = int(off.shape[-1]) // 967 unmodified linesraise ValueError(f"msda_cm: quad maps ({heads * ncam}, h + 1, w + 1, 128), got {tuple(m.shape)}")hv.append(h1 - 1)wv.append(w1 - 1)if off.dtype != ttnn.float32 or int(off.shape[-1]) != heads * (96 if merged else 64):raise ValueError(f"msda_cm: off fp32 [1, 1, Q, {heads * (96 if merged else 64)}], got {off.dtype} "f"{tuple(off.shape)}")if logits.dtype != ttnn.float32 or int(logits.shape[-2]) != nq:raise ValueError(f"msda_cm: logits fp32 [1, 1, Q, H * 32], got {logits.dtype} {tuple(logits.shape)}")if table.dtype != ttnn.int32 or int(table.shape[-1]) != 32 or int(table.shape[-2]) != nq:raise ValueError(f"msda_cm: table int32 [1, 1, Q, 32], got {table.dtype} {tuple(table.shape)}")dev = off.device()out = ttnn.allocate_tensor_on_device(ttnn.Shape([1, 1, nq, heads * 32]), ttnn.bfloat16, ttnn.TILE_LAYOUT, dev,memory_config or ttnn.DRAM_MEMORY_CONFIG)g = dev.compute_with_storage_grid_size()1 unmodified linenb = -(-nq // 32)nwork = nb * headsnc = gx * gycrs = ttnn.CoreRangeSet({ttnn.CoreRange(ttnn.CoreCoord(0, 0), ttnn.CoreCoord(gx - 1, gy - 1))})P, ns = 8, 161 unmodified linereturn ttnn.CBDescriptor(total_size=pages * size, core_ranges=crs, format_descriptors=[ttnn.CBFormatDescriptor(buffer_index=idx, data_format=dtype, page_size=size)])cbs = [cb(0, 2 * ns, ttnn.bfloat16, TB16), cb(1, 2 * ns, ttnn.bfloat16, TB16),cb(2, 6, ttnn.float32, TB32), cb(3, 6, ttnn.float32, TB32),cb(5, 8, ttnn.float32, TB32), cb(6, 1, ttnn.float32, TB32),cb(7, 2, ttnn.int32, TB32), cb(8, 2, ttnn.int32, TB32), cb(9, 2, ttnn.float32, TB32),cb(10, 1, ttnn.float32, TB32), cb(11, 1, ttnn.float32, TB32), cb(12, 3, ttnn.float32, TB32),cb(13, 1, ttnn.float32, TB32), cb(14, 1, ttnn.float32, TB32), cb(15, 1, ttnn.float32, TB32),cb(17, 3, ttnn.float32, TB32), cb(18, 3, ttnn.float32, TB32), cb(21, 2, ttnn.int32, TB32),cb(22, 2, ttnn.int32, TB32), cb(23, 2, ttnn.float32, TB32), cb(24, 2, ttnn.float32, TB32),cb(16, 2, ttnn.bfloat16, TB16), cb(19, ns, ttnn.bfloat16, TB16), cb(20, ns, ttnn.bfloat16, TB16)]def acc(t):return list(ttnn.TensorAccessorArgs(t).get_compile_time_args())accs = acc(table) + acc(off) + acc(logits) + acc(out)tail = [nb, nq, heads, nc, gx]lv = [int(ncam), int(slots)] + hv + wvif merged:lv += [3 * heads, 0, 3 * heads, 2 * heads]else:lv += [2 * heads, 0, heads, 0]rd_ct = [0, 0, 2, 7, 4, 16, 9] + tail + [0, 1] + lv + accswr_ct = [1, 1, 3, 8, 4, 16, 9] + tail + [1, 0] + lv + accscp_ct = [nwork, nc, gx]common = [table.buffer_address(), off.buffer_address(), logits.buffer_address(), out.buffer_address()] + \[m.buffer_address() for m in maps]um = [ttnn.UnpackToDestMode.Default] * 64for i in (2, 3, 6, 17, 18):um[i] = ttnn.UnpackToDestMode.UnpackToDestFp32# HiFi4 by default; AE_MSDA_FIDELITY=HiFi3 drops the last fidelity phase (exact for the weight broadcast against# the exact ones of E_p; ~2^-12 relative on the products)1 unmodified lineccfg = ttnn.ComputeConfigDescriptor(math_fidelity=fid, fp32_dest_acc_en=True, math_approx_mode=False)ccfg.unpack_to_dest_mode = umdbg = list(debug) + [d for d in os.environ.get("AE_MSDA_DEBUG", "").split(",") if d]defines = [(f"MSDA_K_{d.upper()}", "1") for d in dbg]SRC = ttnn.KernelDescriptor.SourceType.FILE_PATHdef kd(name, ct, common_args, config):4 unmodified linesks = [kd("msda_cm_reader.cpp", rd_ct, common, ttnn.ReaderConfigDescriptor()),kd("msda_cm_reader.cpp", wr_ct, common, ttnn.WriterConfigDescriptor()),kd("msda_cm_compute.cpp", cp_ct, [], ccfg)]ttnn.generic_op([table, off, logits] + list(maps) + [out], ttnn.ProgramDescriptor(kernels=ks, semaphores=[], cbs=cbs))return out17 unmodified lines181920212223242526272 unmodified lines303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798997 unmodified lines1071081091101111121131141151161171181191201211221231 unmodified line1251261271281291301311321 unmodified line1341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751 unmodified line1771781791801811821834 unmodified lines18818919019119219319419517 unmodified linesof point ``4 h + q``; the softmax over a head's 32 columns runs in the kernel. ``None``: ``off`` is ONE merged``[1, 1, Q, 768]`` projection, the offsets in columns ``[0, 512)`` and the logits in ``[512, 768)``;- ``table``: int32 TILE ``[1, 1, Q, 32]`` (``host.geometry.cm_table``): per slot k the 4 anchors as``round(uv * 2^(16 + smax))`` in columns ``8 k + 2 a + (x, y)``, the cameras in 16 + k (-1: none), the count in 18;- ``proj`` (fused form): fp32 TILE ``[1, 1, 288, 96 H]`` = ``[W; bias x 32]`` with head j's 96 columns at ``96 j``(:func:`fused_projection`); then ``off`` is the layer's query (bf16 TILE ``[1, 1, Q, 256]``) and the kernel'scompute runs the projection per item (no separate linear, no fp32 projection in DRAM).Output ``[1, 1, Q, 256]`` bf16 TILE."""2 unmodified linesimport osfrom typing import Any, Optional, Sequence__all__ = ["msda_cm", "fused_projection", "cm_anchors"]KDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "kernels")TB16, TB32 = 2048, 4096def fused_projection(weight, bias, heads: int):"""The fused form's ``proj`` operand (host numpy): ``weight`` ``[256, 96 H]`` / ``bias`` ``[96 H]`` of the mergedprojection (offsets in ``[0, 64 H)`` with head j's 64 at ``64 j``, logits in ``[64 H, 96 H)`` with head j's 32 at``64 H + 32 j``) -> ``[288, 96 H]`` fp32: head j's offsets / logits at ``96 j`` / ``96 j + 64``, the bias on rows256 .. 287."""import numpy as npw = np.asarray(weight, np.float32)b = np.asarray(bias, np.float32)cols = np.concatenate([np.r_[64 * j:64 * j + 64, 64 * heads + 32 * j:64 * heads + 32 * j + 32]for j in range(heads)])return np.concatenate([w[:, cols], np.tile(b[cols][None], (32, 1))], 0)def cm_anchors(table: Any) -> Any:"""The frame's per-cell terms for :func:`msda_cm` (kernel ``cm_anchors.cpp``, once per frame): ``table`` int32 TILE``[1, 1, Q, 32]`` -> int32 TILE ``[1, 1, Q, 96]``, per block the anchor terms ``(anchor_{k, a} >> l) - 2^15`` ofslot 0 / 1 in the offsets' column layout (``-2^30`` where the slot is empty) and the fp32 factor 1 / (camera count)of the softmax weights."""import ttnnnq = int(table.shape[-2])dev = table.device()out = ttnn.allocate_tensor_on_device(ttnn.Shape([1, 1, nq, 96]), ttnn.int32, ttnn.TILE_LAYOUT, dev,ttnn.DRAM_MEMORY_CONFIG)g = dev.compute_with_storage_grid_size()gx, gy = int(g.x), int(g.y)crs = ttnn.CoreRangeSet({ttnn.CoreRange(ttnn.CoreCoord(0, 0), ttnn.CoreCoord(gx - 1, gy - 1))})cbs = [ttnn.CBDescriptor(total_size=4 * TB32, core_ranges=crs, format_descriptors=[ttnn.CBFormatDescriptor(buffer_index=0, data_format=ttnn.int32, page_size=TB32)])]ct = [-(-nq // 32), gx * gy, gx, 0, nq] + list(ttnn.TensorAccessorArgs(table).get_compile_time_args()) + \list(ttnn.TensorAccessorArgs(out).get_compile_time_args())k = ttnn.KernelDescriptor(kernel_source=os.path.join(KDIR, "cm_anchors.cpp"),source_type=ttnn.KernelDescriptor.SourceType.FILE_PATH, core_ranges=crs,compile_time_args=ct, defines=[], runtime_args=ttnn.RuntimeArgs(),common_runtime_args=[table.buffer_address(), out.buffer_address()],config=ttnn.ReaderConfigDescriptor())ttnn.generic_op([table, out], ttnn.ProgramDescriptor(kernels=[k], semaphores=[], cbs=cbs))return outdef msda_cm(maps: Sequence[Any], off: Any, logits: Optional[Any], table: Any, *, ncam: int = 6, slots: int = 2,memory_config: Any = None, debug: Sequence[str] = (), proj: Any = None, anchors: Any = None) -> Any:"""``anchors``: the frame's :func:`cm_anchors` of ``table`` (made here when absent)."""import ttnnif len(maps) != 4:raise ValueError("msda_cm: 4 levels")fused = proj is not Nonemerged = logits is Noneif fused:heads = int(proj.shape[-1]) // 96if off.dtype != ttnn.bfloat16 or int(off.shape[-1]) != 256 or int(proj.shape[-2]) != 288 or \proj.dtype != ttnn.float32:raise ValueError(f"msda_cm: fused form takes the bf16 query [1, 1, Q, 256] and the fp32 [288, 96 H] "f"projection, got {tuple(off.shape)} {off.dtype} / {tuple(proj.shape)} {proj.dtype}")logits = projelif merged:# one [1, 1, Q, 96 H] projection: the offsets in columns [0, 64 H), the logits in [64 H, 96 H)logits = offheads = int(off.shape[-1]) // 967 unmodified linesraise ValueError(f"msda_cm: quad maps ({heads * ncam}, h + 1, w + 1, 128), got {tuple(m.shape)}")hv.append(h1 - 1)wv.append(w1 - 1)if not fused and (off.dtype != ttnn.float32 or int(off.shape[-1]) != heads * (96 if merged else 64)):raise ValueError(f"msda_cm: off fp32 [1, 1, Q, {heads * (96 if merged else 64)}], got {off.dtype} "f"{tuple(off.shape)}")if not fused and (logits.dtype != ttnn.float32 or int(logits.shape[-2]) != nq):raise ValueError(f"msda_cm: logits fp32 [1, 1, Q, H * 32], got {logits.dtype} {tuple(logits.shape)}")if table.dtype != ttnn.int32 or int(table.shape[-1]) != 32 or int(table.shape[-2]) != nq:raise ValueError(f"msda_cm: table int32 [1, 1, Q, 32], got {table.dtype} {tuple(table.shape)}")dev = off.device()own_anchors = anchors is Noneif own_anchors:anchors = cm_anchors(table)out = ttnn.allocate_tensor_on_device(ttnn.Shape([1, 1, nq, heads * 32]), ttnn.bfloat16, ttnn.TILE_LAYOUT, dev,memory_config or ttnn.DRAM_MEMORY_CONFIG)g = dev.compute_with_storage_grid_size()1 unmodified linenb = -(-nq // 32)nwork = nb * headsnc = gx * gyif fused and nc % heads:raise ValueError(f"msda_cm: the fused form needs the core count ({nc}) to be a multiple of the heads")crs = ttnn.CoreRangeSet({ttnn.CoreRange(ttnn.CoreCoord(0, 0), ttnn.CoreCoord(gx - 1, gy - 1))})P, ns = 8, 161 unmodified linereturn ttnn.CBDescriptor(total_size=pages * size, core_ranges=crs, format_descriptors=[ttnn.CBFormatDescriptor(buffer_index=idx, data_format=dtype, page_size=size)])# 2 / 3: the compute kernel's own position tiles (2 slots x 2 items); 23: its softmax tiles (2 items)cbs = [cb(0, 2 * ns, ttnn.bfloat16, TB16), cb(1, 2 * ns, ttnn.bfloat16, TB16),cb(2, 4, ttnn.int32, TB32), cb(3, 4, ttnn.int32, TB32),cb(5, 8, ttnn.float32, TB32), cb(6, 1, ttnn.float32, TB32),cb(7, 2, ttnn.int32, TB32), cb(8, 2, ttnn.int32, TB32), cb(9, 2, ttnn.float32, TB32),cb(27, 9, ttnn.int32, TB32),cb(10, 1, ttnn.float32, TB32), cb(11, 1, ttnn.float32, TB32), cb(12, 3, ttnn.float32, TB32),cb(13, 1, ttnn.float32, TB32), cb(14, 1, ttnn.float32, TB32), cb(15, 1, ttnn.float32, TB32),cb(21, 4, ttnn.int32, TB32),cb(22, 4, ttnn.int32, TB32), cb(23, 2, ttnn.float32, TB32),cb(16, 2, ttnn.bfloat16, TB16), cb(19, ns, ttnn.bfloat16, TB16), cb(20, ns, ttnn.bfloat16, TB16)]if fused:# block b's query (3 items: two ahead), the head's weight tiles, its bias tilescbs += [cb(4, 24, ttnn.bfloat16, TB16), cb(25, 24, ttnn.float32, TB32), cb(26, 3, ttnn.float32, TB32)]else:cbs += [cb(17, 3, ttnn.float32, TB32), cb(18, 3, ttnn.float32, TB32)]def acc(t):return list(ttnn.TensorAccessorArgs(t).get_compile_time_args())accs = acc(table) + acc(off) + acc(logits) + acc(out) + acc(anchors)tail = [nb, nq, heads, nc, gx]lv = [int(ncam), int(slots)] + hv + wvif fused:lv += [8, 0, 3 * heads, 0]elif merged:lv += [3 * heads, 0, 3 * heads, 2 * heads]else:lv += [2 * heads, 0, heads, 0]rd_ct = [0, 0, 2, 7, 4, 16, 9] + tail + [0, 1] + lv + accswr_ct = [1, 1, 3, 8, 4, 16, 9] + tail + [1, 0] + lv + accscp_ct = [nwork, nc, gx] + hv + wvcommon = [table.buffer_address(), off.buffer_address(), logits.buffer_address(), out.buffer_address()] + \[m.buffer_address() for m in maps] + [anchors.buffer_address()]um = [ttnn.UnpackToDestMode.Default] * 64for i in (2, 3, 6, 23, 27) + ((26,) if fused else (17, 18)):um[i] = ttnn.UnpackToDestMode.UnpackToDestFp32# HiFi4 by default; AE_MSDA_FIDELITY=HiFi3 drops the last fidelity phase (exact for the weight broadcast against# the exact ones of E_p; ~2^-12 relative on the products)1 unmodified lineccfg = ttnn.ComputeConfigDescriptor(math_fidelity=fid, fp32_dest_acc_en=True, math_approx_mode=False)ccfg.unpack_to_dest_mode = umdbg = list(debug) + [d for d in os.environ.get("AE_MSDA_DEBUG", "").split(",") if d]defines = [(f"MSDA_K_{d.upper()}", "1") for d in dbg] + ([("MSDA_CM_FUSED", "1")] if fused else [])SRC = ttnn.KernelDescriptor.SourceType.FILE_PATHdef kd(name, ct, common_args, config):4 unmodified linesks = [kd("msda_cm_reader.cpp", rd_ct, common, ttnn.ReaderConfigDescriptor()),kd("msda_cm_reader.cpp", wr_ct, common, ttnn.WriterConfigDescriptor()),kd("msda_cm_compute.cpp", cp_ct, [], ccfg)]ttnn.generic_op([table, off, logits] + list(maps) + [anchors, out],ttnn.ProgramDescriptor(kernels=ks, semaphores=[], cbs=cbs))if own_anchors:ttnn.deallocate(anchors)return out
20 unmodified lines2122232425262745 unmodified lines7374757677787980818283848573 unmodified lines15916016116216316416514 unmodified lines18018118218318418518620 unmodified linesimport numpy as npfrom ..host.geometry import FAR, K_CAMS, R_CAP, CmGeometry, FrameGeometry, level_sizes, use_cmfrom ..reference.port_form import E, Qfrom ..ttaw.ops.conv import FeatureMapfrom ..ttaw.trace import TraceRunner, pack_outputs45 unmodified linesR.add_input("cams", shape=(1, 1, 6 * 512, 512 * 3), dtype="bfloat16", layout=RM)R.add_input("front", shape=(1, 1, 1024, 1024 * 3), dtype="bfloat16", layout=RM)R.add_input("nav", shape=(1, 1, Q, E), dtype="bfloat16", layout=RM)self.cm = self.enc.cmfor k in range(8):if self.cm:self._add_cm_geometry(f"f{k}")else:self._add_geometry(f"f{k}", R_CAP, K_CAMS, 6)self._add_geometry("front", FRONT_CAP, 1, 1)for s in range(7):for l, (h, w) in enumerate(SIZES):R.add_state(self._ring(s, l), shape=(1, 1, 6 * h * w, E), dtype="bfloat16", layout=TL,73 unmodified linesself._shift(ctx, fpn)for t in fpn:ttnn.deallocate(t)return pack_outputs({"ok": ctx["front.scale"]}, dtype="float32") # a dummy output (the ring is the result)def _step_a(self, ctx):import ttnn14 unmodified linesself._shift(ctx, fpn)for t in fpn:ttnn.deallocate(t)return pack_outputs({"ok": ctx["front.scale"]}, dtype="float32") # a dummy output (the state is the result)def _step_b(self, ctx):import ttnn20 unmodified lines2122232425262745 unmodified lines73747576777879808182838485868788899073 unmodified lines16416516616716816917014 unmodified lines18518618718818919019120 unmodified linesimport numpy as npfrom ..host.geometry import FAR, K_CAMS, R_CAP, CmGeometry, FrameGeometry, level_sizes, use_cm, use_front_cmfrom ..reference.port_form import E, Qfrom ..ttaw.ops.conv import FeatureMapfrom ..ttaw.trace import TraceRunner, pack_outputs45 unmodified linesR.add_input("cams", shape=(1, 1, 6 * 512, 512 * 3), dtype="bfloat16", layout=RM)R.add_input("front", shape=(1, 1, 1024, 1024 * 3), dtype="bfloat16", layout=RM)R.add_input("nav", shape=(1, 1, Q, E), dtype="bfloat16", layout=RM)# one tile read back by the variants whose results stay on the device (push, step_a)R.add_input("ok", np.zeros((1, 1, 32, 32), np.float32), dtype="float32", layout=TL)self.cm = self.enc.cmfor k in range(8):if self.cm:self._add_cm_geometry(f"f{k}")else:self._add_geometry(f"f{k}", R_CAP, K_CAMS, 6)if use_front_cm():self._add_cm_geometry("front")else:self._add_geometry("front", FRONT_CAP, 1, 1)for s in range(7):for l, (h, w) in enumerate(SIZES):R.add_state(self._ring(s, l), shape=(1, 1, 6 * h * w, E), dtype="bfloat16", layout=TL,73 unmodified linesself._shift(ctx, fpn)for t in fpn:ttnn.deallocate(t)return pack_outputs({"ok": ctx["ok"]}, dtype="float32") # a dummy output (the ring is the result)def _step_a(self, ctx):import ttnn14 unmodified linesself._shift(ctx, fpn)for t in fpn:ttnn.deallocate(t)return pack_outputs({"ok": ctx["ok"]}, dtype="float32") # a dummy output (the state is the result)def _step_b(self, ctx):import ttnn
1{"id":"0c6bd355059e39fb8fd16a12085b5449db53330e3d43dff150041717e1004d55","parent":"5577227c1491c639c82cdc6b8b0fe9fc9f7dac57bafbedcb3790571173bda0e8","created":"2026-12-06T05:48:29.285550465+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"config":{"Hostname":"","Domainname":"","User":"tt","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/opt/tt-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","VENV=/opt/tt-venv","VIRTUAL_ENV=/opt/tt-venv","TT_METAL_RUNTIME_ROOT=/opt/tt-metal","TT_METAL_HOME=/opt/tt-metal","PYTHONPATH=/opt/tt-metal","LD_LIBRARY_PATH=/opt/tt-metal/build/lib:/opt/openmpi-v5.0.7-ulfm/lib","EXTRA_MODELS_DIR=","TT_VLLM_BUILTIN_MODELS=","TT_MODEL_KIND=tt-dit-server","HF_HOME=/hf","TT_METAL_CACHE=/cache","HOME=/home/tt","USER=tt","LOGNAME=tt"],"Cmd":["/usr/local/bin/serve-default.sh"],"ArgsEscaped":true,"Image":"","Volumes":null,"WorkingDir":"/home/tt/work","Entrypoint":["/usr/local/bin/entrypoint.sh"],"OnBuild":null,"Labels":{"org.opencontainers.image.revision":"44d66500520fda9f2c7060c0f6b41ec48f7ab37e","org.opencontainers.image.version":"22.04","org.tenstorrent.tt-model":"auto_e2e-p150","org.tenstorrent.tt-model.arch":"blackhole","org.tenstorrent.tt-model.kind":"tt-dit-server","org.tenstorrent.tt-model.plugin":"","org.tenstorrent.tt-model.profiles":"default","org.tenstorrent.tt-model.repo":"changh95/auto_e2e-p150","org.tenstorrent.tt-model.tt-metal":"","org.tenstorrent.tt-model.weights":"AutowareFoundation/auto_e2e"}},"architecture":"amd64","os":"linux"}1{"id":"194fabf0ea29382bd20430ff905e6a985926861c1caa3f0a45cc26d5b441650d","parent":"14d494de32db8f557b3eddaa1b560d5977f40960ab0b7c7d8f574a49ec7c69a8","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}123version https://git-lfs.github.com/spec/v1oid sha256:122f74c4611b412bdb9e96059c6beb3f33df22b242919e10d81f38fa88c97d31size 10445578241{"id":"f55688f2f363b0f3a98f7f9942445f62a0742595f231a29b25c2723baf9c6242","parent":"54dbfb91087411066b686f0c89c8876a674c5a40d64b7c26ec687d346c83753b","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"id":"5577227c1491c639c82cdc6b8b0fe9fc9f7dac57bafbedcb3790571173bda0e8","parent":"e77501cf1e4ade04a6aa504af5efcdd92d16dbbbc65dd633f7f3be4981de6030","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"id":"fce9488b18f23bcac2af9ab2434bf155f72e800534e68d3c1d5964af33737abd","parent":"fa456d74ad980db54af2d5b8246b7d9024ce5a4bb502e0018d3812bfc1c8d729","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}123version https://git-lfs.github.com/spec/v1oid sha256:410b3bc3520b8dabd4858e3090249af85826a4642633b2c7f15e48f0f0f4a4f2size 4548234241{"id":"a8f973c60bf74bfdf5eaea691019c311ea65a080eeccdb0a1b7916a2bce3fc07","parent":"194fabf0ea29382bd20430ff905e6a985926861c1caa3f0a45cc26d5b441650d","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"id":"14d494de32db8f557b3eddaa1b560d5977f40960ab0b7c7d8f574a49ec7c69a8","parent":"fce9488b18f23bcac2af9ab2434bf155f72e800534e68d3c1d5964af33737abd","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}123version https://git-lfs.github.com/spec/v1oid sha256:593cf9bc169ff9c1785e7e6dcc2a901632e26de42ab3042fd70c998282e47d5esize 732257281{"id":"4496994faca1fc1bb8d4d9a7ac2ccd2a299f474834b1b3550d96f68ca5983830","parent":"ccd2c91f4a59b5373445fb39d7bd165812cae355d9ccc7d4fe826e6cb18f3027","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"id":"467c7ed1dc2e41b486904d709ec8fcf4f4cbc674a2eeec9c76a023eaea20dfdc","parent":"4496994faca1fc1bb8d4d9a7ac2ccd2a299f474834b1b3550d96f68ca5983830","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"id":"db84c6fbbaa7334e210dc4acb155a6bebc6fb34983bd5b576fe8fc0711376302","parent":"f55688f2f363b0f3a98f7f9942445f62a0742595f231a29b25c2723baf9c6242","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}123version https://git-lfs.github.com/spec/v1oid sha256:74d6a13eebdc8dc0819b0639e43e4b7b10b9af42f1d0f04d0199723146ed3c49size 144154112123version https://git-lfs.github.com/spec/v1oid sha256:754df2dddeeccf60ca0b2ba34824b1609d93dce3c6cccb412bf1afa989c9287esize 1603072123version https://git-lfs.github.com/spec/v1oid sha256:77e72f75c7fe3d36ae9740c957174a07bf2e01533883469041c117151d595571size 2416641{"id":"ccd2c91f4a59b5373445fb39d7bd165812cae355d9ccc7d4fe826e6cb18f3027","parent":"3b5da8af3648f2a741f6f73331d5b84453d5ba11c32e57aa468b41a56d445612","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}1{"architecture":"amd64","config":{"User":"tt","Env":["PATH=/opt/tt-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","VENV=/opt/tt-venv","VIRTUAL_ENV=/opt/tt-venv","TT_METAL_RUNTIME_ROOT=/opt/tt-metal","TT_METAL_HOME=/opt/tt-metal","PYTHONPATH=/opt/tt-metal","LD_LIBRARY_PATH=/opt/tt-metal/build/lib:/opt/openmpi-v5.0.7-ulfm/lib","EXTRA_MODELS_DIR=","TT_VLLM_BUILTIN_MODELS=","TT_MODEL_KIND=tt-dit-server","HF_HOME=/hf","TT_METAL_CACHE=/cache","HOME=/home/tt","USER=tt","LOGNAME=tt"],"Entrypoint":["/usr/local/bin/entrypoint.sh"],"Cmd":["/usr/local/bin/serve-default.sh"],"WorkingDir":"/home/tt/work","Labels":{"org.opencontainers.image.revision":"44d66500520fda9f2c7060c0f6b41ec48f7ab37e","org.opencontainers.image.version":"22.04","org.tenstorrent.tt-model":"auto_e2e-p150","org.tenstorrent.tt-model.arch":"blackhole","org.tenstorrent.tt-model.kind":"tt-dit-server","org.tenstorrent.tt-model.plugin":"","org.tenstorrent.tt-model.profiles":"default","org.tenstorrent.tt-model.repo":"changh95/auto_e2e-p150","org.tenstorrent.tt-model.tt-metal":"","org.tenstorrent.tt-model.weights":"AutowareFoundation/auto_e2e"},"ArgsEscaped":true},"created":"2026-12-06T05:48:29.285550465+09:00","history":[{"created":"2026-09-03T12:14:51.139348462Z","created_by":"/bin/sh -c #(nop) ARG RELEASE","empty_layer":true},{"created":"2026-09-03T12:14:51.170427469Z","created_by":"/bin/sh -c #(nop) ARG LAUNCHPAD_BUILD_ARCH","empty_layer":true},{"created":"2026-09-03T12:14:51.200307479Z","created_by":"/bin/sh -c #(nop) LABEL org.opencontainers.image.version=22.04","empty_layer":true},{"created":"2026-09-03T12:14:53.528689977Z","created_by":"/bin/sh -c #(nop) ADD file:81c01921c5f642ac2fcbfae682e489e8e64b347467d9fa1587707e310e64d790 in / "},{"created":"2026-09-03T12:14:54.045714841Z","created_by":"/bin/sh -c #(nop) CMD [\"/bin/bash\"]","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG OMPI_DIR=/opt/openmpi-v5.0.7-ulfm","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG EXTRA_MODELS_DIR=","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG TT_MODEL_KIND","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_NAME","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_REPO","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_WEIGHTS","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_ARCH","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_PROFILES","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_TT_METAL_SHA","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_TT_METAL_DESCRIBE","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"ARG MODEL_PLUGIN_SHA","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-05T09:07:31.631409893+09:00","created_by":"RUN |11 OMPI_DIR=/opt/openmpi-v5.0.7-ulfm EXTRA_MODELS_DIR= TT_MODEL_KIND=tt-dit-server MODEL_NAME=auto_e2e-p150 MODEL_REPO=changh95/auto_e2e-p150 MODEL_WEIGHTS=AutowareFoundation/auto_e2e MODEL_ARCH=blackhole MODEL_PROFILES=default MODEL_TT_METAL_SHA=44d66500520fda9f2c7060c0f6b41ec48f7ab37e MODEL_TT_METAL_DESCRIBE= MODEL_PLUGIN_SHA= /bin/sh -c apt-get update \u0026\u0026 apt-get install -y --no-install-recommends libhwloc15 libnuma1 libatomic1 libudev1 libcap2 zlib1g libmpc3 libmpfr6 libgmp10 libzstd1 libevent-core-2.1-7 libevent-pthreads-2.1-7 libgl1 libsndfile1 ca-certificates \u0026\u0026 apt-get clean \u0026\u0026 rm -rf /var/lib/apt/lists/* # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-05T09:07:31.95297359+09:00","created_by":"RUN |11 OMPI_DIR=/opt/openmpi-v5.0.7-ulfm EXTRA_MODELS_DIR= TT_MODEL_KIND=tt-dit-server MODEL_NAME=auto_e2e-p150 MODEL_REPO=changh95/auto_e2e-p150 MODEL_WEIGHTS=AutowareFoundation/auto_e2e MODEL_ARCH=blackhole MODEL_PROFILES=default MODEL_TT_METAL_SHA=44d66500520fda9f2c7060c0f6b41ec48f7ab37e MODEL_TT_METAL_DESCRIBE= MODEL_PLUGIN_SHA= /bin/sh -c existing=\"$(getent passwd 1000 | cut -d: -f1)\" \u0026\u0026 if [ -n \"$existing\" ]; then userdel -r \"$existing\" 2\u003e/dev/null || userdel \"$existing\"; fi \u0026\u0026 useradd --uid 1000 --create-home --home-dir /home/tt --shell /bin/bash tt \u0026\u0026 mkdir -p /home/tt/work/logs /cache /opt/tt-metal \u0026\u0026 chown -R tt:tt /home/tt /cache /opt/tt-metal \u0026\u0026 chmod 1777 /home/tt /home/tt/work /home/tt/work/logs /cache # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-05T09:12:10.929790863+09:00","created_by":"COPY /opt/openmpi-v5.0.7-ulfm /opt/openmpi-v5.0.7-ulfm # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-05T09:12:11.535817847+09:00","created_by":"COPY /opt/tenstorrent /opt/tenstorrent # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:08.228130562+09:00","created_by":"COPY /usr/local/share/uv /usr/local/share/uv # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:11.299281498+09:00","created_by":"COPY /opt/tt-venv /opt/tt-venv # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:11.398795926+09:00","created_by":"COPY /opt/vllm /opt/vllm # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:12.157278462+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/runtime /opt/tt-metal/runtime # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:12.431398816+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/build_Release /opt/tt-metal/build_Release # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:12.727036718+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/build /opt/tt-metal/build # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:13.735596064+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/tt_metal /opt/tt-metal/tt_metal # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:14.469384106+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/ttnn /opt/tt-metal/ttnn # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:14.625511051+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/tools /opt/tt-metal/tools # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:14.741015722+09:00","created_by":"COPY --chown=tt:tt /opt/tt-metal/setup.py /opt/tt-metal/pyproject.toml /opt/tt-metal/ # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:14.849413245+09:00","created_by":"COPY --chown=tt:tt code/ /opt/tt-metal/ # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:15.278376725+09:00","created_by":"RUN |11 OMPI_DIR=/opt/openmpi-v5.0.7-ulfm EXTRA_MODELS_DIR= TT_MODEL_KIND=tt-dit-server MODEL_NAME=auto_e2e-p150 MODEL_REPO=changh95/auto_e2e-p150 MODEL_WEIGHTS=AutowareFoundation/auto_e2e MODEL_ARCH=blackhole MODEL_PROFILES=default MODEL_TT_METAL_SHA=44d66500520fda9f2c7060c0f6b41ec48f7ab37e MODEL_TT_METAL_DESCRIBE= MODEL_PLUGIN_SHA= /bin/sh -c find /opt/tt-metal \\( -type f -o -type d \\) \\( ! -perm -o+r -o \\( -type d ! -perm -o+x \\) \\) -exec chmod a+rX {} + # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:15.378100191+09:00","created_by":"COPY --chmod=0755 entrypoint.sh /usr/local/bin/entrypoint.sh # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"COPY --chmod=0755 serve-default.sh /usr/local/bin/serve-default.sh # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV VENV=/opt/tt-venv","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV VIRTUAL_ENV=/opt/tt-venv","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV PATH=/opt/tt-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV TT_METAL_RUNTIME_ROOT=/opt/tt-metal","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV TT_METAL_HOME=/opt/tt-metal","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV PYTHONPATH=/opt/tt-metal","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV LD_LIBRARY_PATH=/opt/tt-metal/build/lib:/opt/openmpi-v5.0.7-ulfm/lib","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV EXTRA_MODELS_DIR=","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ARG TT_VLLM_BUILTIN_MODELS=","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV TT_VLLM_BUILTIN_MODELS=","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV TT_MODEL_KIND=tt-dit-server","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV HF_HOME=/hf","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV TT_METAL_CACHE=/cache","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV HOME=/home/tt","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV USER=tt","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"ENV LOGNAME=tt","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.468516702+09:00","created_by":"USER tt","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:15.568950387+09:00","created_by":"WORKDIR /home/tt/work","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:15.661144664+09:00","created_by":"COPY --chmod=0755 verify.sh /ctx/verify.sh # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:29.00435574+09:00","created_by":"RUN |12 OMPI_DIR=/opt/openmpi-v5.0.7-ulfm EXTRA_MODELS_DIR= TT_MODEL_KIND=tt-dit-server MODEL_NAME=auto_e2e-p150 MODEL_REPO=changh95/auto_e2e-p150 MODEL_WEIGHTS=AutowareFoundation/auto_e2e MODEL_ARCH=blackhole MODEL_PROFILES=default MODEL_TT_METAL_SHA=44d66500520fda9f2c7060c0f6b41ec48f7ab37e MODEL_TT_METAL_DESCRIBE= MODEL_PLUGIN_SHA= TT_VLLM_BUILTIN_MODELS= /bin/sh -c bash /ctx/verify.sh # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:29.00435574+09:00","created_by":"USER root","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:29.285550465+09:00","created_by":"RUN |12 OMPI_DIR=/opt/openmpi-v5.0.7-ulfm EXTRA_MODELS_DIR= TT_MODEL_KIND=tt-dit-server MODEL_NAME=auto_e2e-p150 MODEL_REPO=changh95/auto_e2e-p150 MODEL_WEIGHTS=AutowareFoundation/auto_e2e MODEL_ARCH=blackhole MODEL_PROFILES=default MODEL_TT_METAL_SHA=44d66500520fda9f2c7060c0f6b41ec48f7ab37e MODEL_TT_METAL_DESCRIBE= MODEL_PLUGIN_SHA= TT_VLLM_BUILTIN_MODELS= /bin/sh -c chmod -R a+rwX /home/tt # buildkit","comment":"buildkit.dockerfile.v0"},{"created":"2026-12-06T05:48:29.285550465+09:00","created_by":"USER tt","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:29.285550465+09:00","created_by":"LABEL org.tenstorrent.tt-model=auto_e2e-p150 org.tenstorrent.tt-model.repo=changh95/auto_e2e-p150 org.tenstorrent.tt-model.weights=AutowareFoundation/auto_e2e org.tenstorrent.tt-model.arch=blackhole org.tenstorrent.tt-model.kind=tt-dit-server org.tenstorrent.tt-model.profiles=default org.opencontainers.image.revision=44d66500520fda9f2c7060c0f6b41ec48f7ab37e org.tenstorrent.tt-model.tt-metal= org.tenstorrent.tt-model.plugin=","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:29.285550465+09:00","created_by":"ENTRYPOINT [\"/usr/local/bin/entrypoint.sh\"]","comment":"buildkit.dockerfile.v0","empty_layer":true},{"created":"2026-12-06T05:48:29.285550465+09:00","created_by":"CMD [\"/usr/local/bin/serve-default.sh\"]","comment":"buildkit.dockerfile.v0","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:ea16cace89338c84eb6bcb91a7efdfcae6838fff359efe951858227436486c34","sha256:3dd1ac48a70dd22daa1ffcb0d48b11e6f6182adf5294978fb4ba76d952ef0783","sha256:d6603778cc6fd3644acabd272a700e30287d90530646e5251f0d71d8f20af1f0","sha256:2bd0d4c59deb92321e511a3e3898fff70d2a1b007a7fb7477a62d1603f2e07fc","sha256:15d39bf3938c81b3767aec3be0a176d632697bc5879f9b918f025b5f7a1fcf86","sha256:eb726478969caf303c2a39cbaf6c4faeb89f1b5caccdea9fe00f297ba49179c8","sha256:122f74c4611b412bdb9e96059c6beb3f33df22b242919e10d81f38fa88c97d31","sha256:b1cdd2231416ef48bc696f6c409d54d9421212a105ef876deab076dc5782fff4","sha256:410b3bc3520b8dabd4858e3090249af85826a4642633b2c7f15e48f0f0f4a4f2","sha256:9a0c3a39622845b21e8cdf6170975a0dc797834f7a98eba60fef294bd81eaae8","sha256:74d6a13eebdc8dc0819b0639e43e4b7b10b9af42f1d0f04d0199723146ed3c49","sha256:94f8839bbc267cf878a7f9f1aaac97d57eb1a49771a69dc317fd747ff6bc785e","sha256:593cf9bc169ff9c1785e7e6dcc2a901632e26de42ab3042fd70c998282e47d5e","sha256:d90cf6b3754dda9cf5a4f4d720f9a962e4bc14949c27f065caafac7ceb89dd8b","sha256:a9376c283112f1f976ccde62254dc1976c3fe9e4141be293c61e9c144fea22cb","sha256:754df2dddeeccf60ca0b2ba34824b1609d93dce3c6cccb412bf1afa989c9287e","sha256:7e5dd20b817a2dc9b3dce65cef504b584add7a3c99b94c034e740336a46b415f","sha256:b2145ed62ee8ee7b341eb866b89fd3bd38276b8c05666fb0200d5981422cd2a2","sha256:ba0c123ea1527cacf47a51d734baa0210533bce7a9052d6ad4e089430035258a","sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef","sha256:33201052828cb60f166a2bda5f6a4a94ed90881dce98c04469a2278adb1b026c","sha256:77e72f75c7fe3d36ae9740c957174a07bf2e01533883469041c117151d595571","sha256:409e120542c429d74653ae90c4140707aeae78e653422ca6953cb25a2011cfcc"]}}123version https://git-lfs.github.com/spec/v1oid sha256:94f8839bbc267cf878a7f9f1aaac97d57eb1a49771a69dc317fd747ff6bc785esize 208406016123version https://git-lfs.github.com/spec/v1oid sha256:9a0c3a39622845b21e8cdf6170975a0dc797834f7a98eba60fef294bd81eaae8size 1441541121{"id":"403eaa4036008b2845055cca5d3a7124f64e7cfbe2dc8748a60a0ccc12e1446b","parent":"8f2d770c34444069a04e43d8c3e5b4ba0c02e5fa286cb74817595998c316e20b","created":"1970-01-01T09:00:00+09:00","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"os":"linux"}.gitattributes+10
README.md+9-9
build_info.json+7-7
code/tt_autoe2e/.omc/state/last-tool-error.jsonAdded+7
code/tt_autoe2e/api.py+2-2
code/tt_autoe2e/host/geometry.py+18
code/tt_autoe2e/tests/dev_api.py+2-2
code/tt_autoe2e/tests/dev_cm_probe.py+22-8
code/tt_autoe2e/tests/dev_eval.py+2-2
code/tt_autoe2e/tests/dev_front_ab.pyAdded+90
code/tt_autoe2e/tests/dev_prof.py+2-2
code/tt_autoe2e/tests/dev_runner.py+2-2
code/tt_autoe2e/tests/dev_sm_order.pyAdded+42
code/tt_autoe2e/tests/dev_step.py+2-2
code/tt_autoe2e/tests/dev_tsa_probe.pyAdded+81
code/tt_autoe2e/tests/dev_tsa_riscs.pyAdded+109
code/tt_autoe2e/tt/encoder.py+30-9
code/tt_autoe2e/tt/fusion.py+44-4
code/tt_autoe2e/tt/kernels/cm_anchors.cppAdded+77
code/tt_autoe2e/tt/kernels/msda_cm_compute.cpp+202-80
code/tt_autoe2e/tt/kernels/msda_cm_reader.cpp+127-89
code/tt_autoe2e/tt/msda_cm.py+86-16
code/tt_autoe2e/tt/runner.py+9-4
image/blobs/sha256/05fe53b1920092f2394a302fd1ad844c61a4377dfc993bfa3c21980316f56954Added+1
image/blobs/sha256/11948ed4e000c13d17fe32e39a0a382c7f2e02670fd73d3dded903bef16b9b57Added+1
image/blobs/sha256/122f74c4611b412bdb9e96059c6beb3f33df22b242919e10d81f38fa88c97d31Added+3
image/blobs/sha256/160f2a85f0e18f88bcf53273dd22b85af2f85f82833ae2b4e686b3e0b88bbf29Added+1
image/blobs/sha256/1b22e4f0d312bea10bb20ea934a2ae3a85b737ae72352e86a2c97a8982b5764fAdded+1
image/blobs/sha256/1e10b19cc8edb8b9ac4382a32b71f743b50b483973c58f6758ab0c3af427f4c0Added+1
image/blobs/sha256/33201052828cb60f166a2bda5f6a4a94ed90881dce98c04469a2278adb1b026cAdded
image/blobs/sha256/409e120542c429d74653ae90c4140707aeae78e653422ca6953cb25a2011cfccAdded
image/blobs/sha256/410b3bc3520b8dabd4858e3090249af85826a4642633b2c7f15e48f0f0f4a4f2Added+3
image/blobs/sha256/46c342db0831c94fb121b42c81080aae176692e0fb4c4ad14e831311c1bc31b2Added+1
image/blobs/sha256/4f160023014e5c2d8ed58182b1196b2d190d4303e9488556924cf91eaf361205Added+1
image/blobs/sha256/593cf9bc169ff9c1785e7e6dcc2a901632e26de42ab3042fd70c998282e47d5eAdded+3
image/blobs/sha256/6473731dc6fbc1f1667ea8018264c7535abcb67616f24e5cb99a101a91c4c1fbAdded+1
image/blobs/sha256/6d73b977a09663ac3118d88d2ce1e9caf7909d215fc8af68c82e9dd3b50d1cf2Added+1
image/blobs/sha256/7088d24bf5ccedbaa4042c50cbc54feac1ae4a1d9faf1e04b586ca685bdacc27Added+1
image/blobs/sha256/74d6a13eebdc8dc0819b0639e43e4b7b10b9af42f1d0f04d0199723146ed3c49Added+3
image/blobs/sha256/754df2dddeeccf60ca0b2ba34824b1609d93dce3c6cccb412bf1afa989c9287eAdded+3
image/blobs/sha256/77e72f75c7fe3d36ae9740c957174a07bf2e01533883469041c117151d595571Added+3
image/blobs/sha256/7e5dd20b817a2dc9b3dce65cef504b584add7a3c99b94c034e740336a46b415fAdded
image/blobs/sha256/806a105d73446c361812fbdfbce523388f342580134ada94468b1394539ffd22Added+1
image/blobs/sha256/94f01b2815f8135c34fcf7bb381c074fc13bc60aeec30564c0750d8b728039f4Added+1
image/blobs/sha256/94f8839bbc267cf878a7f9f1aaac97d57eb1a49771a69dc317fd747ff6bc785eAdded+3
image/blobs/sha256/9a0c3a39622845b21e8cdf6170975a0dc797834f7a98eba60fef294bd81eaae8Added+3
image/blobs/sha256/9c488e0676bc827ac4ea1431e0dc374fed4853e3c2c22ed02eca381292711f36Added+1
image/blobs/sha256/a9376c283112f1f976ccde62254dc1976c3fe9e4141be293c61e9c144fea22cbAdded
image/blobs/sha256/b1cdd2231416ef48bc696f6c409d54d9421212a105ef876deab076dc5782fff4Added
image/blobs/sha256/b2145ed62ee8ee7b341eb866b89fd3bd38276b8c05666fb0200d5981422cd2a2Added