spatial-computing 0.27.0__tar.gz → 0.28.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/PKG-INFO +2 -1
  2. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/README.md +1 -0
  3. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/pyproject.toml +1 -1
  4. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/__init__.py +1 -1
  5. spatial_computing-0.28.0/spatial/automotive/__init__.py +5 -0
  6. spatial_computing-0.28.0/spatial/automotive/placement.py +101 -0
  7. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/cli.py +21 -0
  8. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/PKG-INFO +2 -1
  9. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/SOURCES.txt +3 -0
  10. spatial_computing-0.28.0/tests/test_automotive.py +104 -0
  11. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/LICENSE +0 -0
  12. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/setup.cfg +0 -0
  13. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/ai/__init__.py +0 -0
  14. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/ai/kvcache.py +0 -0
  15. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/ai/llm.py +0 -0
  16. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/__init__.py +0 -0
  17. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/cost.py +0 -0
  18. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/detect.py +0 -0
  19. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/monitor.py +0 -0
  20. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/scheduler.py +0 -0
  21. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/taskqueue.py +0 -0
  22. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/worker.py +0 -0
  23. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/compute/workloads.py +0 -0
  24. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/__init__.py +0 -0
  25. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/auth.py +0 -0
  26. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/energy.py +0 -0
  27. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/ledger.py +0 -0
  28. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/model.py +0 -0
  29. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/protocol.py +0 -0
  30. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/core/registry.py +0 -0
  31. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/__init__.py +0 -0
  32. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/cuda.py +0 -0
  33. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/devices.py +0 -0
  34. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/metal.py +0 -0
  35. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/metal_mandel.swift +0 -0
  36. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fabric/metal_run.swift +0 -0
  37. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/__init__.py +0 -0
  38. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/agent.py +0 -0
  39. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/alerts.py +0 -0
  40. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/dashboard.py +0 -0
  41. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/ha.py +0 -0
  42. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/fleet/hub.py +0 -0
  43. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/intelligence/__init__.py +0 -0
  44. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/intelligence/predictor.py +0 -0
  45. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/interconnect/__init__.py +0 -0
  46. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/interconnect/collectives.py +0 -0
  47. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/interconnect/comm.py +0 -0
  48. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/interconnect/model.py +0 -0
  49. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/interconnect/tasks.py +0 -0
  50. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/kernel/__init__.py +0 -0
  51. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/kernel/dsl.py +0 -0
  52. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/kernel/library.py +0 -0
  53. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/market/__init__.py +0 -0
  54. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/market/vast.py +0 -0
  55. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/__init__.py +0 -0
  56. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/fararray.py +0 -0
  57. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/pageserver.py +0 -0
  58. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/secure.py +0 -0
  59. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/shared.py +0 -0
  60. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/memory/tiered.py +0 -0
  61. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/__init__.py +0 -0
  62. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/billing.py +0 -0
  63. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/db.py +0 -0
  64. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/invoice_rules.py +0 -0
  65. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/mailer.py +0 -0
  66. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/oidc.py +0 -0
  67. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/pdf.py +0 -0
  68. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/qr.py +0 -0
  69. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/security.py +0 -0
  70. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/server.py +0 -0
  71. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/service.py +0 -0
  72. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/app.js +0 -0
  73. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/DMMono-normal-400.woff2 +0 -0
  74. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/DMMono-normal-500.woff2 +0 -0
  75. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/InstrumentSerif-italic-400.woff2 +0 -0
  76. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/InstrumentSerif-normal-400.woff2 +0 -0
  77. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/Inter-normal-400.woff2 +0 -0
  78. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/Inter-normal-500.woff2 +0 -0
  79. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts/Inter-normal-600.woff2 +0 -0
  80. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/fonts.css +0 -0
  81. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/index.html +0 -0
  82. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/logo.svg +0 -0
  83. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/static/style.css +0 -0
  84. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/totp.py +0 -0
  85. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/ubl.py +0 -0
  86. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/platform/vat.py +0 -0
  87. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/__init__.py +0 -0
  88. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/arch.py +0 -0
  89. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/desktop/Dockerfile +0 -0
  90. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/desktop/__init__.py +0 -0
  91. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/desktop/start.sh +0 -0
  92. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/envs.py +0 -0
  93. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/inspect.py +0 -0
  94. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/microvm.py +0 -0
  95. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/planner.py +0 -0
  96. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/runner.py +0 -0
  97. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/runtime/toolchain.py +0 -0
  98. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/unified/__init__.py +0 -0
  99. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/unified/model.py +0 -0
  100. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/unified/planner.py +0 -0
  101. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial/unified/providers.py +0 -0
  102. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/dependency_links.txt +0 -0
  103. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/entry_points.txt +0 -0
  104. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/requires.txt +0 -0
  105. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/spatial_computing.egg-info/top_level.txt +0 -0
  106. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_auth.py +0 -0
  107. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_compute.py +0 -0
  108. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_core.py +0 -0
  109. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_dashboard.py +0 -0
  110. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_domains.py +0 -0
  111. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_engines.py +0 -0
  112. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_fabric.py +0 -0
  113. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_fleet.py +0 -0
  114. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_ha.py +0 -0
  115. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_hardening.py +0 -0
  116. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_interconnect.py +0 -0
  117. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_kernel.py +0 -0
  118. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_market.py +0 -0
  119. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_memory.py +0 -0
  120. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_platform.py +0 -0
  121. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_platform2.py +0 -0
  122. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_qr.py +0 -0
  123. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_quorum.py +0 -0
  124. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_real_servers.py +0 -0
  125. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_runtime.py +0 -0
  126. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_sso.py +0 -0
  127. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_unified.py +0 -0
  128. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_v02.py +0 -0
  129. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_v03.py +0 -0
  130. {spatial_computing-0.27.0 → spatial_computing-0.28.0}/tests/test_v05.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatial-computing
3
- Version: 0.27.0
3
+ Version: 0.28.0
4
4
  Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, fleet)
5
5
  Author: Spatial Computing contributors
6
6
  License-Expression: Apache-2.0
@@ -102,6 +102,7 @@ st.put(0, b"..." * 1000); st.get(0); print(st.stats())
102
102
  | Runtime Engine (inspect binaries, route, micro-VM, WASI, containers incl. ARM64 via emulation) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
103
103
  | Portable kernels (one source, CPU/Metal/CUDA/HIP/Triton; market-vertical presets) | first components | `tests/test_kernel.py`, `benchmarks/bench_kernel.py` |
104
104
  | Live GPU market prices (`spatial market`, read-only, no account) | first components | `tests/test_market.py`, [docs/MARKET.md](docs/MARKET.md) |
105
+ | In-vehicle multi-chip placement (`spatial automotive`, declared chip specs, no real silicon) | first components | `tests/test_automotive.py`, [docs/AUTOMOTIVE.md](docs/AUTOMOTIVE.md) |
105
106
  | AI, Intelligence | first components (toy model) | `tests/test_engines.py`, `tests/test_domains.py` |
106
107
 
107
108
  Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency. Full table and conditions: [docs/RESULTATS.fr.md](docs/RESULTATS.fr.md).
@@ -76,6 +76,7 @@ st.put(0, b"..." * 1000); st.get(0); print(st.stats())
76
76
  | Runtime Engine (inspect binaries, route, micro-VM, WASI, containers incl. ARM64 via emulation) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
77
77
  | Portable kernels (one source, CPU/Metal/CUDA/HIP/Triton; market-vertical presets) | first components | `tests/test_kernel.py`, `benchmarks/bench_kernel.py` |
78
78
  | Live GPU market prices (`spatial market`, read-only, no account) | first components | `tests/test_market.py`, [docs/MARKET.md](docs/MARKET.md) |
79
+ | In-vehicle multi-chip placement (`spatial automotive`, declared chip specs, no real silicon) | first components | `tests/test_automotive.py`, [docs/AUTOMOTIVE.md](docs/AUTOMOTIVE.md) |
79
80
  | AI, Intelligence | first components (toy model) | `tests/test_engines.py`, `tests/test_domains.py` |
80
81
 
81
82
  Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency. Full table and conditions: [docs/RESULTATS.fr.md](docs/RESULTATS.fr.md).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "spatial-computing"
7
- version = "0.27.0"
7
+ version = "0.28.0"
8
8
  description = "Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, fleet)"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -3,4 +3,4 @@
3
3
  Status of every engine is declared in spatial.core.registry and must be backed
4
4
  by a test or benchmark before being set to OPERATIONAL.
5
5
  """
6
- __version__ = "0.27.0"
6
+ __version__ = "0.28.0"
@@ -0,0 +1,5 @@
1
+ """In-vehicle multi-chip workload placement. See spatial.automotive.placement."""
2
+
3
+ from .placement import Chip, Placement, PlacementError, Task, makespan_s, place, total_energy_j
4
+
5
+ __all__ = ["Chip", "Placement", "PlacementError", "Task", "makespan_s", "place", "total_energy_j"]
@@ -0,0 +1,101 @@
1
+ """In-vehicle multi-chip workload placement.
2
+
3
+ Real, documented gap (not invented): a modern vehicle runs several heterogeneous
4
+ chips (a perception SoC, a separate NPU, a general MCU...) and, per published
5
+ research (DAVOS, arXiv 2601.05072, 2026), "resource management, data movement,
6
+ and scheduling decisions are made independently across stacks" today -- no
7
+ joint placement. This module applies the project's placement idea -- one task,
8
+ several devices, lowest finish time -- to that gap: given a task graph and a
9
+ declared chip catalogue, place each task on the chip that finishes it earliest
10
+ without violating dependency order.
11
+
12
+ Software only. There is no automotive silicon here to run anything on, same
13
+ honesty as the generated-only CUDA/HIP/Triton kernel back ends: chip throughput
14
+ and power numbers are declared inputs you supply (a datasheet, or your own
15
+ bench), never measured by this module and never presented as real-vehicle
16
+ results. No ISO 26262 or other safety certification claim is made.
17
+ """
18
+
19
+ from dataclasses import dataclass
20
+
21
+
22
+ class PlacementError(Exception):
23
+ pass
24
+
25
+
26
+ @dataclass(frozen=True)
27
+ class Chip:
28
+ name: str
29
+ flops_per_s: float
30
+ power_w: float
31
+ supports_npu: bool = False
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ class Task:
36
+ name: str
37
+ flops: float
38
+ needs_npu: bool = False
39
+ after: tuple[str, ...] = ()
40
+
41
+
42
+ @dataclass(frozen=True)
43
+ class Placement:
44
+ task: str
45
+ chip: str
46
+ start_s: float
47
+ finish_s: float
48
+
49
+
50
+ def _eligible(task: Task, chips: tuple[Chip, ...]) -> tuple[Chip, ...]:
51
+ out = tuple(c for c in chips if not task.needs_npu or c.supports_npu)
52
+ if not out:
53
+ raise PlacementError(f"no chip in the catalogue supports task {task.name!r} (needs_npu=True)")
54
+ return out
55
+
56
+
57
+ def place(tasks: tuple[Task, ...], chips: tuple[Chip, ...]) -> tuple[Placement, ...]:
58
+ """Topological placement: each ready task goes on the eligible chip that
59
+ finishes it earliest, given its dependencies' finish times and when that
60
+ chip is next free. Raises PlacementError on an unknown dependency, a cycle,
61
+ an empty chip catalogue, or a task no chip in the catalogue can run."""
62
+ if not chips:
63
+ raise PlacementError("empty chip catalogue")
64
+ by_name = {t.name: t for t in tasks}
65
+ if len(by_name) != len(tasks):
66
+ raise PlacementError("duplicate task name")
67
+ for t in tasks:
68
+ for dep in t.after:
69
+ if dep not in by_name:
70
+ raise PlacementError(f"task {t.name!r} depends on unknown task {dep!r}")
71
+ free_at = {c.name: 0.0 for c in chips}
72
+ finish_of: dict[str, float] = {}
73
+ placed: dict[str, Placement] = {}
74
+ remaining = dict(by_name)
75
+ while remaining:
76
+ ready = [t for t in remaining.values() if all(d in finish_of for d in t.after)]
77
+ if not ready:
78
+ raise PlacementError("dependency cycle among: " + ", ".join(sorted(remaining)))
79
+ for t in ready:
80
+ best = None
81
+ for c in _eligible(t, chips):
82
+ ready_at = max(free_at[c.name], max((finish_of[d] for d in t.after), default=0.0))
83
+ finish = ready_at + t.flops / c.flops_per_s
84
+ if best is None or finish < best[1]:
85
+ best = (c, finish, ready_at)
86
+ chip, finish, start = best
87
+ placed[t.name] = Placement(t.name, chip.name, start, finish)
88
+ free_at[chip.name] = finish
89
+ finish_of[t.name] = finish
90
+ del remaining[t.name]
91
+ return tuple(placed[t.name] for t in tasks)
92
+
93
+
94
+ def total_energy_j(placements: tuple[Placement, ...], chips: tuple[Chip, ...]) -> float:
95
+ """Sum of power x busy-time per chip -- declared power, not measured."""
96
+ power = {c.name: c.power_w for c in chips}
97
+ return sum((p.finish_s - p.start_s) * power[p.chip] for p in placements)
98
+
99
+
100
+ def makespan_s(placements: tuple[Placement, ...]) -> float:
101
+ return max((p.finish_s for p in placements), default=0.0)
@@ -275,6 +275,24 @@ def cmd_market(a):
275
275
  return 0
276
276
 
277
277
 
278
+ def cmd_automotive(a):
279
+ from .automotive import Chip, PlacementError, Task, makespan_s, place, total_energy_j
280
+ with open(a.file) as f:
281
+ cat = json.load(f)
282
+ try:
283
+ chips = tuple(Chip(c["name"], c["flops_per_s"], c["power_w"], c.get("supports_npu", False)) for c in cat["chips"])
284
+ tasks = tuple(Task(t["name"], t["flops"], t.get("needs_npu", False), tuple(t.get("after", []))) for t in cat["tasks"])
285
+ placements = place(tasks, chips)
286
+ except (PlacementError, KeyError) as e:
287
+ print(f"spatial: {type(e).__name__}: {e}", file=sys.stderr)
288
+ return 1
289
+ for p in placements:
290
+ print(f"{p.task} -> {p.chip} [{p.start_s:.4f}s .. {p.finish_s:.4f}s]")
291
+ print(f"makespan: {makespan_s(placements):.4f}s, energy: {total_energy_j(placements, chips):.4f}J "
292
+ f"(declared chip specs, not measured on real automotive silicon)")
293
+ return 0
294
+
295
+
278
296
  def cmd_token(a):
279
297
  from .core import auth
280
298
  if a.action == "init":
@@ -355,6 +373,9 @@ def main(argv=None):
355
373
  p.add_argument("--min-reliability", type=float, default=0.5, help="Vast.ai's own 0..1 host score; a low-reliability offer is excluded by default")
356
374
  p.add_argument("--neocloud-usd-per-hour", type=float, default=None, help="your reference 'neocloud' price for this GPU: if given, prints the arbitrage spread instead of just the price")
357
375
  p.set_defaults(fn=cmd_market)
376
+ p = sub.add_parser("automotive", help="place a task graph on a declared in-vehicle chip catalogue (software only, no real automotive silicon here)")
377
+ p.add_argument("--file", required=True, help="JSON: {\"chips\":[{\"name\",\"flops_per_s\",\"power_w\",\"supports_npu\"}], \"tasks\":[{\"name\",\"flops\",\"needs_npu\",\"after\"}]}")
378
+ p.set_defaults(fn=cmd_automotive)
358
379
  p = sub.add_parser("agent", help="run a fleet agent: measure this machine, report to a hub, run allow-listed tasks")
359
380
  p.add_argument("--hub", required=True, help="host:port of the hub")
360
381
  p.add_argument("--token-file", required=True, help="shared secret file, or a scoped token with fleet:report,fleet:work")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatial-computing
3
- Version: 0.27.0
3
+ Version: 0.28.0
4
4
  Summary: Spatial Computing: open-source infrastructure efficiency toolkit. Measure, decide, prove (compute, tiered memory, runtime routing, fleet)
5
5
  Author: Spatial Computing contributors
6
6
  License-Expression: Apache-2.0
@@ -102,6 +102,7 @@ st.put(0, b"..." * 1000); st.get(0); print(st.stats())
102
102
  | Runtime Engine (inspect binaries, route, micro-VM, WASI, containers incl. ARM64 via emulation) | operational prototype | `tests/test_runtime.py`, `benchmarks/bench_runtime.py` |
103
103
  | Portable kernels (one source, CPU/Metal/CUDA/HIP/Triton; market-vertical presets) | first components | `tests/test_kernel.py`, `benchmarks/bench_kernel.py` |
104
104
  | Live GPU market prices (`spatial market`, read-only, no account) | first components | `tests/test_market.py`, [docs/MARKET.md](docs/MARKET.md) |
105
+ | In-vehicle multi-chip placement (`spatial automotive`, declared chip specs, no real silicon) | first components | `tests/test_automotive.py`, [docs/AUTOMOTIVE.md](docs/AUTOMOTIVE.md) |
105
106
  | AI, Intelligence | first components (toy model) | `tests/test_engines.py`, `tests/test_domains.py` |
106
107
 
107
108
  Measured on the reference machine (AC power): Numba JIT ×31.6 over pure Python with an identical result; 0.88 s to boot an isolated Linux micro-VM on macOS; −75 % local RAM for a skewed-access dataset at 107× the mean access latency. Full table and conditions: [docs/RESULTATS.fr.md](docs/RESULTATS.fr.md).
@@ -6,6 +6,8 @@ spatial/cli.py
6
6
  spatial/ai/__init__.py
7
7
  spatial/ai/kvcache.py
8
8
  spatial/ai/llm.py
9
+ spatial/automotive/__init__.py
10
+ spatial/automotive/placement.py
9
11
  spatial/compute/__init__.py
10
12
  spatial/compute/cost.py
11
13
  spatial/compute/detect.py
@@ -99,6 +101,7 @@ spatial_computing.egg-info/entry_points.txt
99
101
  spatial_computing.egg-info/requires.txt
100
102
  spatial_computing.egg-info/top_level.txt
101
103
  tests/test_auth.py
104
+ tests/test_automotive.py
102
105
  tests/test_compute.py
103
106
  tests/test_core.py
104
107
  tests/test_dashboard.py
@@ -0,0 +1,104 @@
1
+ """In-vehicle multi-chip placement: declared chip specs, never real automotive silicon."""
2
+ import pytest
3
+
4
+ from spatial.automotive import Chip, PlacementError, Task, makespan_s, place, total_energy_j
5
+
6
+
7
+ def test_single_task_single_chip():
8
+ chips = (Chip("mcu", flops_per_s=1e9, power_w=5.0),)
9
+ out = place((Task("camera_isp", flops=1e9),), chips)
10
+ assert len(out) == 1 and out[0].chip == "mcu" and out[0].start_s == 0.0
11
+ assert out[0].finish_s == pytest.approx(1.0)
12
+
13
+
14
+ def test_cheaper_faster_chip_wins_when_both_eligible():
15
+ mcu = Chip("mcu", flops_per_s=1e9, power_w=5.0)
16
+ soc = Chip("soc", flops_per_s=1e10, power_w=20.0)
17
+ out = place((Task("detect", flops=1e10),), (mcu, soc))
18
+ assert out[0].chip == "soc" # finishes in 1s on soc vs 10s on mcu
19
+
20
+
21
+ def test_npu_only_task_goes_to_npu_chip_even_if_slower():
22
+ mcu = Chip("mcu", flops_per_s=1e10, power_w=5.0, supports_npu=False)
23
+ npu = Chip("npu", flops_per_s=1e9, power_w=15.0, supports_npu=True)
24
+ out = place((Task("segment", flops=1e9, needs_npu=True),), (mcu, npu))
25
+ assert out[0].chip == "npu"
26
+
27
+
28
+ def test_no_eligible_chip_raises():
29
+ mcu = Chip("mcu", flops_per_s=1e9, power_w=5.0, supports_npu=False)
30
+ with pytest.raises(PlacementError, match="needs_npu"):
31
+ place((Task("segment", flops=1e9, needs_npu=True),), (mcu,))
32
+
33
+
34
+ def test_dependency_order_respected_across_two_chips():
35
+ mcu = Chip("mcu", flops_per_s=1e9, power_w=5.0)
36
+ soc = Chip("soc", flops_per_s=1e9, power_w=5.0)
37
+ tasks = (
38
+ Task("camera_isp", flops=1e9),
39
+ Task("sensor_fusion", flops=1e9, after=("camera_isp",)),
40
+ Task("path_planning", flops=1e9, after=("sensor_fusion",)),
41
+ )
42
+ out = place(tasks, (mcu, soc))
43
+ by_name = {p.task: p for p in out}
44
+ assert by_name["camera_isp"].finish_s <= by_name["sensor_fusion"].start_s
45
+ assert by_name["sensor_fusion"].finish_s <= by_name["path_planning"].start_s
46
+ assert makespan_s(out) == pytest.approx(3.0)
47
+
48
+
49
+ def test_unknown_dependency_raises():
50
+ with pytest.raises(PlacementError, match="unknown task"):
51
+ place((Task("a", flops=1.0, after=("missing",)),), (Chip("c", 1.0, 1.0),))
52
+
53
+
54
+ def test_dependency_cycle_raises():
55
+ tasks = (Task("a", flops=1.0, after=("b",)), Task("b", flops=1.0, after=("a",)))
56
+ with pytest.raises(PlacementError, match="cycle"):
57
+ place(tasks, (Chip("c", 1.0, 1.0),))
58
+
59
+
60
+ def test_duplicate_task_name_raises():
61
+ with pytest.raises(PlacementError, match="duplicate"):
62
+ place((Task("a", flops=1.0), Task("a", flops=2.0)), (Chip("c", 1.0, 1.0),))
63
+
64
+
65
+ def test_empty_chip_catalogue_raises():
66
+ with pytest.raises(PlacementError, match="empty"):
67
+ place((Task("a", flops=1.0),), ())
68
+
69
+
70
+ def test_total_energy_is_power_times_busy_time_summed_per_chip():
71
+ mcu = Chip("mcu", flops_per_s=1e9, power_w=10.0)
72
+ out = place((Task("a", flops=1e9), Task("b", flops=2e9, after=("a",))), (mcu,))
73
+ assert total_energy_j(out, (mcu,)) == pytest.approx(10.0 * 3.0) # 3s busy at 10W
74
+
75
+
76
+ def test_cli_automotive_runs_a_sample_catalogue(tmp_path, capsys):
77
+ import json
78
+ from spatial.cli import main
79
+ cat = {
80
+ "chips": [
81
+ {"name": "mcu", "flops_per_s": 4e9, "power_w": 5.0},
82
+ {"name": "npu", "flops_per_s": 2e9, "power_w": 15.0, "supports_npu": True},
83
+ ],
84
+ "tasks": [
85
+ {"name": "camera_isp", "flops": 1e9},
86
+ {"name": "segment", "flops": 2e9, "needs_npu": True, "after": ["camera_isp"]},
87
+ ],
88
+ }
89
+ f = tmp_path / "vehicle.json"
90
+ f.write_text(json.dumps(cat))
91
+ assert main(["automotive", "--file", str(f)]) == 0
92
+ out = capsys.readouterr().out
93
+ assert "camera_isp -> mcu" in out and "segment -> npu" in out and "makespan" in out
94
+
95
+
96
+ def test_cli_automotive_reports_placement_error_cleanly(tmp_path, capsys):
97
+ import json
98
+ from spatial.cli import main
99
+ cat = {"chips": [{"name": "mcu", "flops_per_s": 1e9, "power_w": 5.0}],
100
+ "tasks": [{"name": "segment", "flops": 1e9, "needs_npu": True}]}
101
+ f = tmp_path / "vehicle.json"
102
+ f.write_text(json.dumps(cat))
103
+ assert main(["automotive", "--file", str(f)]) == 1
104
+ assert "PlacementError" in capsys.readouterr().err