Skip to content

Commit 1c41d9d

Browse files
authored
Merge branch 'master' into binaries_report_cores
2 parents b175a6a + e7758dd commit 1c41d9d

12 files changed

Lines changed: 33 additions & 31 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
cp -vaT $ROOT_DOC_DIR $DEPLOY_DIR
6060
cp -vaT $C_DOC_DIR $DEPLOY_DIR/c
6161
- name: Deploy to GitHub Pages
62-
uses: JamesIves/github-pages-deploy-action@v4.7.2
62+
uses: JamesIves/github-pages-deploy-action@v4.7.3
6363
with:
6464
branch: gh-pages
6565
folder: ${{ env.DEPLOY_DIR }}

spinn_front_end_common/interface/buffer_management/buffer_manager.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import logging
2020
from typing import (
2121
Dict, Iterable, List, Optional, Set, Tuple, cast, TYPE_CHECKING)
22+
from typing_extensions import Never
23+
2224
from spinn_utilities.config_holder import get_config_bool
2325
from spinn_utilities.log import FormatAdapter
2426
from spinn_utilities.ordered_set import OrderedSet
@@ -132,7 +134,7 @@ def __init__(self) -> None:
132134

133135
def _request_data(
134136
self, placement_x: int, placement_y: int, address: int,
135-
length: int) -> bytes:
137+
length: int) -> bytearray:
136138
"""
137139
Uses the extra monitor cores for data extraction.
138140
@@ -176,7 +178,7 @@ def _request_data(
176178
return extra_mon_data
177179

178180
@staticmethod
179-
def _verify_data(extra_mon_data: bytes, txrx_data: bytes) -> None:
181+
def _verify_data(extra_mon_data: bytearray, txrx_data: bytearray) -> None:
180182
sm = difflib.SequenceMatcher(a=extra_mon_data, b=txrx_data)
181183
failed_index = -1
182184
for (tag, i1, i2, j1, j2) in sm.get_opcodes():
@@ -406,8 +408,9 @@ def __python_extract_no_monitors(
406408
for placement in progress.over(recording_placements):
407409
self._retreive_by_placement(placement)
408410

409-
def get_data_by_placement(self, placement: Placement,
410-
recording_region_id: int) -> Tuple[bytes, bool]:
411+
def get_data_by_placement(
412+
self, placement: Placement,
413+
recording_region_id: int) -> Tuple[memoryview, bool]:
411414
"""
412415
Deprecated use get_recording or get_download
413416
@@ -432,7 +435,7 @@ def get_data_by_placement(self, placement: Placement,
432435
f"Unable to get data for vertex {placement.vertex}")
433436

434437
def get_recording(self, placement: Placement,
435-
recording_region_id: int) -> Tuple[bytes, bool]:
438+
recording_region_id: int) -> Tuple[memoryview, bool]:
436439
"""
437440
Get the data container for the data retrieved
438441
during the simulation from a specific region area of a core.
@@ -457,7 +460,7 @@ def get_recording(self, placement: Placement,
457460
placement, recording_region_id, lookup_error)
458461

459462
def get_download(self, placement: Placement,
460-
recording_region_id: int) -> Tuple[bytes, bool]:
463+
recording_region_id: int) -> Tuple[memoryview, bool]:
461464
"""
462465
Get the data container for the data retrieved
463466
during the simulation from a specific region area of a core.
@@ -479,11 +482,11 @@ def get_download(self, placement: Placement,
479482
placement.x, placement.y, placement.p,
480483
recording_region_id, -1)
481484
except LookupError as lookup_error:
482-
return self._raise_error(
485+
self._raise_error(
483486
placement, recording_region_id, lookup_error)
484487

485488
def _raise_error(self, placement: Placement, recording_region_id: int,
486-
lookup_error: LookupError) -> Tuple[bytes, bool]:
489+
lookup_error: LookupError) -> Never:
487490
"""
488491
Raises the correct exception-
489492
"""

spinn_front_end_common/interface/buffer_management/storage_objects/buffer_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def get_last_extraction_id(self) -> int:
338338
raise LookupError("No Extraction id found")
339339

340340
def store_recording(self, x: int, y: int, p: int, region: int,
341-
missing: bool, data: bytes) -> None:
341+
missing: bool, data: bytearray | bytes) -> None:
342342
"""
343343
Store some information in the corresponding buffer for a
344344
specific chip, core and recording region.
@@ -368,7 +368,7 @@ def store_recording(self, x: int, y: int, p: int, region: int,
368368

369369
def store_download(
370370
self, x: int, y: int, p: int, region: int, missing: bool,
371-
data: bytes) -> None:
371+
data: bytearray | bytes) -> None:
372372
"""
373373
Store some information in the corresponding buffer for a
374374
specific chip, core and recording region.

spinn_front_end_common/interface/ds/ds_sqllite_database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def get_double_region(self) -> Iterable[Tuple[int, int, int, int]]:
287287
yield (row["x"], row["y"], row["p"], row["region_num"])
288288

289289
def set_region_content(
290-
self, x: int, y: int, p: int, region_num: int, content: bytes,
290+
self, x: int, y: int, p: int, region_num: int, content: bytearray,
291291
content_debug: Optional[str]) -> None:
292292
"""
293293
Sets the content for this region
@@ -458,7 +458,7 @@ def set_region_pointer(self, x: int, y: int, p: int, region_num: int,
458458

459459
def get_region_pointers_and_content(
460460
self, x: int, y: int, p: int) -> Iterable[Tuple[
461-
int, int, Optional[bytes]]]:
461+
int, int, Optional[bytearray]]]:
462462
"""
463463
Yields the number, pointers and content for each reserved region
464464
@@ -485,8 +485,8 @@ def get_region_pointers_and_content(
485485
content = None
486486
yield row["region_num"], row["pointer"], content
487487

488-
def get_regions_content(
489-
self, x: int, y: int, p: int) -> Iterable[Tuple[int, int, bytes]]:
488+
def get_regions_content(self, x: int, y: int,
489+
p: int) -> Iterable[Tuple[int, int, bytearray]]:
490490
"""
491491
Yields the number, pointers and content for each region
492492

spinn_front_end_common/interface/interface_functions/host_no_bitfield_router_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ def _build_data(self, table: AbstractMulticastRoutingTable) -> bytes:
228228
entry.key, entry.mask,
229229
Router.convert_routing_table_entry_to_spinnaker_route(entry),
230230
get_defaultable_source_id(entry))
231-
return bytearray(data)
231+
return data

spinn_front_end_common/interface/interface_functions/load_data_specification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from spinn_front_end_common.interface.ds import DsSqlliteDatabase
3535

3636
logger = FormatAdapter(logging.getLogger(__name__))
37-
_Writer: TypeAlias = Callable[[int, int, int, bytes], Any]
37+
_Writer: TypeAlias = Callable[[int, int, int, bytearray | bytes], Any]
3838

3939
MONITOR_CUTOFF = 12800 # 50 packets of 256 bytes
4040

spinn_front_end_common/interface/profiling/profile_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, tag_labels: Mapping[int, str]):
5858
self._tags: Dict[str, Tuple[numpy.ndarray, numpy.ndarray]] = dict()
5959
self._max_time: float = 0.0
6060

61-
def add_data(self, data: bytes) -> None:
61+
def add_data(self, data: bytearray) -> None:
6262
"""
6363
Add profiling data read from the profile section.
6464

spinn_front_end_common/interface/spinnaker.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ run_compression_checker = Debug
316316
Mainly used for testing changes to the algorithms or bugs.
317317
path_compression_checker = routing_compression_checker_report.rpt
318318

319-
validate_routes_uncompressed = False
319+
validate_routes_uncompressed = Debug
320320
@validate_routes_uncompressed = Runs a check that the routing tables are correct before compresssion.
321321
Mainly used for testing changes to the algorithms or bugs.
322322

spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/set_reinjection_packet_types_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, x: int, y: int, p: int, multicast: bool,
5353
argument_1=int(bool(multicast)),
5454
argument_2=int(bool(point_to_point)),
5555
argument_3=int(bool(fixed_route)),
56-
data=bytearray(struct.pack("<B", nearest_neighbour)))
56+
data=struct.pack("<B", nearest_neighbour))
5757

5858
@overrides(AbstractSCPRequest.get_scp_response)
5959
def get_scp_response(self) -> CheckOKResponse:

spinn_front_end_common/utility_models/data_speed_up_packet_gatherer_machine_vertex.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import struct
2020
from enum import Enum, IntEnum
2121
from typing import (
22-
Any, BinaryIO, Iterable, List, Optional, Set, Tuple, Union,
23-
TYPE_CHECKING)
22+
Any, BinaryIO, Iterable, List, Optional, Set, Tuple, TYPE_CHECKING)
2423

2524
from spinn_utilities.config_holder import get_config_bool, get_report_path
2625
from spinn_utilities.overrides import overrides
@@ -489,7 +488,7 @@ def _generate_data_in_report(
489488

490489
def send_data_into_spinnaker(
491490
self, x: int, y: int, base_address: int,
492-
data: Union[BinaryIO, bytes, str, int], *,
491+
data: BinaryIO | bytearray | bytes | str | int, *,
493492
n_bytes: Optional[int] = None, offset: int = 0) -> None:
494493
"""
495494
Sends a block of data into SpiNNaker to a given chip.
@@ -606,7 +605,7 @@ def __open_connection(self) -> SCAMPConnection:
606605

607606
def _send_data_via_extra_monitors(
608607
self, destination_chip: Chip, start_address: int,
609-
data_to_write: bytes) -> None:
608+
data_to_write: bytearray | bytes) -> None:
610609
"""
611610
Sends data using the extra monitor cores.
612611
@@ -739,7 +738,7 @@ def _read_in_missing_seq_nums(
739738
return seen_last, seen_all
740739

741740
def _outgoing_retransmit_missing_seq_nums(
742-
self, data_to_write: bytes, missing: Set[int],
741+
self, data_to_write: bytearray | bytes, missing: Set[int],
743742
connection: SCAMPConnection) -> None:
744743
"""
745744
Transmits back into SpiNNaker the missing data based off missing
@@ -772,7 +771,7 @@ def __position_from_seq_number(seq_num: int) -> int:
772771
return BYTES_IN_FULL_PACKET_WITH_KEY * seq_num
773772

774773
def __make_data_in_stream_message(
775-
self, data_to_write: bytes, seq_num: int,
774+
self, data_to_write: bytearray | bytes, seq_num: int,
776775
position: Optional[int]) -> Tuple[SDPMessage, int]:
777776
"""
778777
Determine the data needed to be sent to the SpiNNaker machine
@@ -833,7 +832,7 @@ def __send_tell_flag(self, connection: SCAMPConnection) -> None:
833832
_DataInCommands.SEND_TELL, self._transaction_id)))
834833

835834
def _send_all_data_based_packets(
836-
self, data_to_write: bytes, start_address: int,
835+
self, data_to_write: bytearray | bytes, start_address: int,
837836
connection: SCAMPConnection) -> None:
838837
"""
839838
Send all the data as one block.
@@ -994,7 +993,7 @@ def unset_cores_for_data_streaming(self) -> None:
994993
def get_data(
995994
self, extra_monitor: ExtraMonitorSupportMachineVertex,
996995
placement: Placement, memory_address: int,
997-
length_in_bytes: int) -> bytes:
996+
length_in_bytes: int) -> bytearray:
998997
"""
999998
Gets data from a given core and memory address.
1000999
@@ -1243,7 +1242,7 @@ def _determine_and_retransmit_missing_seq_nums(
12431242

12441243
# build SDP message and send it to the core
12451244
connection.send_sdp_message(self.__make_data_out_message(
1246-
placement, data))
1245+
placement, bytes(data)))
12471246

12481247
# sleep for ensuring core doesn't lose packets
12491248
time.sleep(self._TIMEOUT_FOR_SENDING_IN_SECONDS)

0 commit comments

Comments
 (0)