Skip to content

Commit

Permalink
Fix region size issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 11, 2024
1 parent e9ab2c0 commit 3791dc7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
16 changes: 3 additions & 13 deletions spynnaker/pyNN/models/neuron/synaptic_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
AbstractSynapseDynamicsStructural)
from spynnaker.pyNN.utilities.bit_field_utilities import (
get_sdram_for_bit_field_region, get_bitfield_key_map_data,
write_bitfield_init_data)
write_bitfield_init_data, is_sdram_poisson_source)
from spynnaker.pyNN.models.common import PopulationApplicationVertex
from spynnaker.pyNN.models.spike_source import SpikeSourcePoissonVertex

Expand Down Expand Up @@ -289,7 +289,7 @@ def generate_data(self) -> None:
# pylint: disable=protected-access
app_edge = proj._projection_edge
synapse_info = proj._synapse_information
if self.__is_sdram_poisson_source(app_edge):
if is_sdram_poisson_source(app_edge):
continue
app_key_info = self.__app_key_and_mask(app_edge, synapse_info)
d_app_key_info = self.__delay_app_key_and_mask(
Expand Down Expand Up @@ -523,16 +523,6 @@ def __delay_app_key_and_mask(
r_info, app_edge.n_delay_stages, app_edge.pre_vertex,
s_info.partition_id)

def __is_sdram_poisson_source(self, app_edge):
# Avoid circular import
# pylint: disable=import-outside-toplevel
from spynnaker.pyNN.extra_algorithms.splitter_components import (
SplitterPoissonDelegate)
if isinstance(app_edge.pre_vertex.splitter, SplitterPoissonDelegate):
if app_edge.pre_vertex.splitter.send_over_sdram:
return True
return False

def get_connections_from_machine(
self, placement: Placement, app_edge: ProjectionApplicationEdge,
synapse_info: SynapseInformation) -> Sequence[NDArray]:
Expand All @@ -549,7 +539,7 @@ def get_connections_from_machine(
:py:const:`~.NUMPY_CONNECTORS_DTYPE`
:rtype: list(~numpy.ndarray)
"""
if self.__is_sdram_poisson_source(app_edge):
if is_sdram_poisson_source(app_edge):
return cast(SpikeSourcePoissonVertex, app_edge.pre_vertex)\
.read_connections(synapse_info)
matrix = self.__matrices[app_edge, synapse_info]
Expand Down
19 changes: 16 additions & 3 deletions spynnaker/pyNN/utilities/bit_field_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@
BIT_IN_A_WORD = 32.0



def is_sdram_poisson_source(app_edge):
""" Determine if a given app edge is a poisson source being sent over SDRAM
as it can likely be discounted if so
"""
# Avoid circular import
# pylint: disable=import-outside-toplevel
from spynnaker.pyNN.extra_algorithms.splitter_components import (
SplitterPoissonDelegate)
if isinstance(app_edge.pre_vertex.splitter, SplitterPoissonDelegate):
if app_edge.pre_vertex.splitter.send_over_sdram:
return True
return False


def _unique_edges(projections: Iterable[Projection]) -> Iterable[
Tuple[ProjectionApplicationEdge, str]]:
"""
Expand All @@ -55,9 +70,7 @@ def _unique_edges(projections: Iterable[Projection]) -> Iterable[
# pylint: disable=protected-access
edge = proj._projection_edge
synapse_info = proj._synapse_information
# If there are no outgoing vertices, we should discount this edge
if not edge.pre_vertex.splitter.get_out_going_vertices(
synapse_info.partition_id):
if is_sdram_poisson_source(edge):
continue
if (edge, synapse_info.partition_id) not in seen_edges:
seen_edges.add((edge, synapse_info.partition_id))
Expand Down

0 comments on commit 3791dc7

Please sign in to comment.