mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 03:33:47 +08:00
Model captured Tensor output in Jetlink warp fixture
Keep production captured-output guard intact and preserve coherent-move/fallback assertions. Match fixture to required Tensor protocol and add missing/non-Tensor rejection checks.18warp tests,Ruff and typing pass; broader adapter check42pass/6missing-clang environment blocks. No production/native changes; canonical inventory refreshed.
This commit is contained in:
@@ -7,6 +7,7 @@ from unittest.mock import Mock, patch
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
from tinygrad import Tensor
|
||||
|
||||
from openpilot.starpilot.models import jetlink_adapter
|
||||
from openpilot.starpilot.models.jetlink_warp import CatalogWarp
|
||||
@@ -100,7 +101,9 @@ def test_a_moved_output_is_sent_from_where_it_is_and_any_other_copied_out(copied
|
||||
def runner_buffer(device):
|
||||
buffer = FakeBuffer(device=device)
|
||||
small = CatalogModelState.__new__(CatalogModelState)
|
||||
small.warp_enqueue = NS(captured=NS(ret=output(buffer)))
|
||||
# The production move path admits only a captured Tensor, not an arbitrary output object.
|
||||
tensor = Mock(spec=Tensor, uop=NS(base=NS(buffer=buffer)))
|
||||
small.warp_enqueue = NS(captured=NS(ret=tensor))
|
||||
return small, buffer
|
||||
|
||||
|
||||
@@ -120,6 +123,16 @@ def test_the_runner_moves_a_comma_warps_output():
|
||||
assert cpu.warp_copied == "a CPU buffer"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("captured", [None, NS(ret=None), NS(ret=output(FakeBuffer(device="QCOM")))])
|
||||
def test_the_runner_refuses_missing_or_non_tensor_warp_output(captured):
|
||||
small = CatalogModelState.__new__(CatalogModelState)
|
||||
small.warp_enqueue = NS(captured=captured)
|
||||
move = Mock()
|
||||
small.move_warp_output(move)
|
||||
move.assert_not_called()
|
||||
assert small.warp_copied == "warp has no captured Tensor output"
|
||||
|
||||
|
||||
def test_the_move_comes_before_warmup_links_the_warp():
|
||||
calls = []
|
||||
model = Mock(warmup=lambda: calls.append("warmup"), move_warp_output=lambda move: calls.append("move"))
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "764646d6b3f20b844b6f2545cd10e8300b53481ebecfa2d16dafb99c2ceaee31", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "80eb3bcfecfa88504d3dfcea06687041c1aeb6d24738aca2e8f4b3f28c47116c", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user