SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
|
The implementation of the Data Speed Up Packet Gatherer. More...
#include <spin1_api.h>
#include <common-typedefs.h>
#include "common.h"
#include <data_specification.h>
#include <simulation.h>
#include <debug.h>
#include <bit_field.h>
Go to the source code of this file.
Data Structures | |
struct | receive_data_to_location_msg_t |
meaning of payload in first data in SDP packet More... | |
struct | receive_seq_data_msg_t |
meaning of payload in subsequent data in SDP packets More... | |
struct | sdp_msg_out_payload_t |
SDP packet payload definition. More... | |
struct | data_out_config_t |
The layout of the Data Out configuration region. More... | |
struct | chip_key_data_t |
struct | data_in_config_t |
The layout of the Data In configuration region. More... | |
struct | dsupg_provenance_t |
The structure of the provenance region FIXME. More... | |
Macros | |
#define | SDP_TIMEOUT 100 |
timeout used in sending SDP messages | |
#define | MESSAGE_DELAY_TIME_WHEN_FAIL 1 |
the time to wait before trying again to send a message (MC, SDP) in microseconds | |
#define | FIRST_SEQ_NUM 0 |
first sequence number to use and reset to | |
#define | MAX_CHIP_INDEX 8 |
max index needed to cover the chips in either direction on a spinn-5 board | |
#define | SDRAM_VS_DTCM_THRESHOLD 40000 |
threshold for SDRAM vs DTCM when allocating received_seq_nums_store | |
#define | ALL_MISSING_FLAG 0xFFFFFFFE |
flag when all seq numbers are missing | |
#define | ROUTER_TIMEOUT_MASK 0xFF |
mask needed by router timeout | |
Functions | |
static void | publish_transaction_id_to_user_1 (int transaction_id) |
Writes the updated transaction ID to the user1. | |
static void | send_sdp_message (void) |
sends the SDP message built in the my_msg global | |
static void | send_mc_message (key_offsets command, uint payload) |
sends a multicast (with payload) message to the current target chip | |
static void | sanity_check_write (uint write_address, uint n_elements) |
Sanity checking for writes, ensuring that they're to the buffered SDRAM range. | |
static void | process_sdp_message_into_mc_messages (const uint *data, uint n_elements, bool set_write_address, uint write_address) |
sends multicast messages accordingly for an SDP message | |
static void | create_sequence_number_bitfield (uint max_seq) |
creates a store for sequence numbers in a memory store. | |
static void | free_sequence_number_bitfield (void) |
Frees the allocated sequence number store. | |
static uint | calculate_sdram_address_from_seq_num (uint seq_num) |
calculates the new sdram location for a given seq num | |
static void | set_message_length (const void *end) |
Sets the length of the outbound SDP message in my_msg. | |
static void | process_address_data (const receive_data_to_location_msg_t *receive_data_cmd) |
handles reading the address, chips and max packets from a SDP message (command: SDP_SEND_DATA_TO_LOCATION_CMD) | |
static void | send_finished_response (void) |
sends the finished request | |
static void | process_missing_seq_nums_and_request_retransmission (const sdp_msg_pure_data *msg) |
searches through received sequence numbers and transmits missing ones back to host for retransmission | |
static uint | n_elements_in_msg (const sdp_msg_pure_data *msg, const uint *data_start) |
Calculates the number of words of data in an SDP message. | |
static void | copy_data (void *restrict target, const void *source, uint n_words) |
because spin1_memcpy() is stupid, especially for access to SDRAM | |
static void | receive_seq_data (const sdp_msg_pure_data *msg) |
Handles receipt and parsing of a message full of sequence numbers that need to be retransmitted (command: SDP_SEND_SEQ_DATA_CMD) | |
static void | data_in_receive_sdp_data (const sdp_msg_pure_data *msg) |
processes SDP messages for the Data In protocol | |
static void | send_timeout (sdp_msg_t *msg, uint32_t key) |
sends the basic timeout command via multicast to the extra monitors | |
static void | send_clear_message (sdp_msg_t *msg) |
sends the clear message to all extra monitors on this board | |
static void | reinjection_sdp_command (sdp_msg_t *msg) |
handles the commands for the reinjector code. | |
static void | receive_sdp_message (uint mailbox, uint port) |
processes SDP messages | |
static void | send_data (void) |
sends data to the host via SDP (using my_msg) | |
static void | receive_data (uint key, uint payload) |
Handles receipt of a fixed route packet with payload from the SpiNNaker network. | |
static void | initialise (void) |
Sets up the application. | |
void | c_main (void) |
This function is called at application start-up. | |
Variables | |
static uint32_t | new_sequence_key = 0 |
the key that causes data out sequence number to be processed | |
static uint32_t | first_data_key = 0 |
the key that says this is the first item of data in a data out stream | |
static uint32_t | transaction_id_key = 0 |
the key that provides a new data out transaction ID | |
static uint32_t | end_flag_key = 0 |
the key that marks the end of a data out stream | |
static uint32_t | basic_data_key = 0 |
the key that marks an ordinary word within a data out stream | |
static uint32_t | seq_num = FIRST_SEQ_NUM |
default seq num | |
static uint32_t | max_seq_num = 0xFFFFFFFF |
maximum sequence number | |
static uint32_t | transaction_id = 0 |
The Data In transaction ID. Used to distinguish streams of packets. | |
static uint32_t | data_out_transaction_id = 0 |
The Data Out transaction ID. Used to distinguish streams of packets. | |
static uint32_t | data [ITEMS_PER_DATA_PACKET] |
static uint32_t | position_in_store = 0 |
index into data | |
static sdp_msg_pure_data | my_msg |
SDP message holder for transmissions. | |
static uint | data_in_mc_key_map [MAX_CHIP_INDEX][MAX_CHIP_INDEX] = {{0}} |
How to find which key to use to talk to which chip on this board. | |
static uint | chip_x = 0xFFFFFFF |
Board-relative x-coordinate of current chip being written to. | |
static uint | chip_y = 0xFFFFFFF |
Board-relative y-coordinate of current chip being written to. | |
static bit_field_t | received_seq_nums_store = NULL |
Records what sequence numbers we have received from host during Data In. | |
static uint | size_of_bitfield = 0 |
The size of the bitfield in received_seq_nums_store. | |
static bool | alloc_in_sdram = false |
Whether received_seq_nums_store was allocated in SDRAM. | |
static uint | total_received_seq_nums = 0 |
Count of received sequence numbers. | |
static uint | last_seen_seq_num = 0 |
The most recently seen sequence number. | |
static uint | start_sdram_address = 0 |
Where the current stream of data started in SDRAM. | |
static dsupg_provenance_t | prov = {0} |
The DTCM copy of the provenance. | |
static dsupg_provenance_t * | sdram_prov |
The SDRAM copy of the provenance. | |
The implementation of the Data Speed Up Packet Gatherer.
The purpose of this application is to allow data to be streamed in and out of SpiNNaker at very high speed while other applications are not running. It is designed to only run on chips with an active Ethernet port.
Definition in file data_speed_up_packet_gatherer.c.
struct receive_data_to_location_msg_t |
meaning of payload in first data in SDP packet
Definition at line 127 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
uint | command | The meaning of the message. |
uint | transaction_id | The transaction that the message is taking part in. |
address_t | address | Where the stream will be writing to in memory. |
ushort | chip_y | Board-local y coordinate of chip to do write on. |
ushort | chip_x | Board-local x coordinate of chip to do write on. |
uint | max_seq_num | Maximum sequence number of data stream. |
struct receive_seq_data_msg_t |
meaning of payload in subsequent data in SDP packets
Definition at line 137 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
uint | command | The meaning of the message. |
uint | transaction_id | The transaction that the message is taking part in. |
uint | seq_num | The sequence number of this message. |
uint | data[] | The payload of real data. |
struct sdp_msg_out_payload_t |
SDP packet payload definition.
Definition at line 145 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
uint | command | The meaning of the message. |
uint | transaction_id | The transaction associated with the message. |
uint | data[ITEMS_PER_MISSING_PACKET] | The payload data of the message. |
struct data_out_config_t |
The layout of the Data Out configuration region.
Definition at line 202 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
const uint | new_seq_key | The key used to indicate a new sequence/stream. |
const uint | first_data_key | The key used to indicate the first word of a stream. |
const uint | transaction_id_key | The key used to indicate a transaction ID. |
const uint | end_flag_key | The key used to indicate a stream end. |
const uint | basic_data_key | The key used to indicate a general data item in a stream. |
const uint | tag_id |
The ID of the IPtag to send the SDP packets out to host on. Note that the host is responsible for configuring the tag. |
struct chip_key_data_t |
Associates a board-local coordinate with a key for talking to the extra monitor on that chip.
Definition at line 272 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
uint32_t | x_coord | Board local x coordinate of extra monitor. |
uint32_t | y_coord | Board local y coordinate of extra monitor. |
uint32_t | base_key | Base key to use for talking to that chip. |
struct data_in_config_t |
The layout of the Data In configuration region.
Definition at line 279 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
const uint32_t | n_extra_monitors | The number of extra monitors that we can talk to. |
const uint32_t | reinjector_base_key | The base key for reinjection control messages. |
const struct chip_key_data_t | chip_to_key[] |
The configuration data for routing messages to specific extra monitors. Used to populate data_in_mc_key_map |
struct dsupg_provenance_t |
The structure of the provenance region FIXME.
Definition at line 292 of file data_speed_up_packet_gatherer.c.
Data Fields | ||
---|---|---|
uint32_t | n_sdp_sent | The number of SDP messages sent. |
uint32_t | n_sdp_recvd | The number of SDP messages received (excluding those for SARK) |
uint32_t | n_in_streams | The number of input streams. |
uint32_t | n_out_streams | The number of output streams (technically, output transactions) |
#define SDP_TIMEOUT 100 |
timeout used in sending SDP messages
Definition at line 39 of file data_speed_up_packet_gatherer.c.
#define MESSAGE_DELAY_TIME_WHEN_FAIL 1 |
the time to wait before trying again to send a message (MC, SDP) in microseconds
Definition at line 43 of file data_speed_up_packet_gatherer.c.
#define FIRST_SEQ_NUM 0 |
first sequence number to use and reset to
Definition at line 46 of file data_speed_up_packet_gatherer.c.
#define MAX_CHIP_INDEX 8 |
max index needed to cover the chips in either direction on a spinn-5 board
Definition at line 49 of file data_speed_up_packet_gatherer.c.
#define SDRAM_VS_DTCM_THRESHOLD 40000 |
threshold for SDRAM vs DTCM when allocating received_seq_nums_store
Definition at line 74 of file data_speed_up_packet_gatherer.c.
#define ALL_MISSING_FLAG 0xFFFFFFFE |
flag when all seq numbers are missing
Definition at line 92 of file data_speed_up_packet_gatherer.c.
#define ROUTER_TIMEOUT_MASK 0xFF |
mask needed by router timeout
Definition at line 95 of file data_speed_up_packet_gatherer.c.
SDP port commands relating to the Data In protocol.
Definition at line 52 of file data_speed_up_packet_gatherer.c.
values for port numbers this core will respond to
Enumerator | |
---|---|
REINJECTION_PORT | Reinjection control messages. |
DATA_SPEED_UP_IN_PORT | Data Speed Up Inbound messages. |
Definition at line 68 of file data_speed_up_packet_gatherer.c.
Offsets into messages.
Definition at line 77 of file data_speed_up_packet_gatherer.c.
Misc constants for Data In.
Definition at line 98 of file data_speed_up_packet_gatherer.c.
Counts of items in a packet.
Definition at line 110 of file data_speed_up_packet_gatherer.c.
human readable definitions of each DSG region in SDRAM
Enumerator | |
---|---|
CONFIG | Index of general configuration region. |
CHIP_TO_KEY | Index of chip-to-key mapping table. |
PROVENANCE_REGION | Index of provenance region. |
Definition at line 192 of file data_speed_up_packet_gatherer.c.
values for the priority for each callback
Enumerator | |
---|---|
MC_PACKET | Multicast packet receive uses FIQ. |
SDP | SDP receive priority standard (high) |
Definition at line 220 of file data_speed_up_packet_gatherer.c.
Human readable definitions of the offsets for data in multicast key elements. These act as commands sent to the target extra monitor core.
Enumerator | |
---|---|
WRITE_ADDR_KEY_OFFSET | Payload contains a write address. |
DATA_KEY_OFFSET | Payload contains a data word. |
BOUNDARY_KEY_OFFSET | Write stream complete. Payload irrelevant. |
Definition at line 261 of file data_speed_up_packet_gatherer.c.
Writes the updated transaction ID to the user1.
[in] | transaction_id | The transaction ID to publish |
Definition at line 315 of file data_speed_up_packet_gatherer.c.
sends the SDP message built in the my_msg global
Definition at line 325 of file data_speed_up_packet_gatherer.c.
|
inlinestatic |
sends a multicast (with payload) message to the current target chip
[in] | command | the key offset, which indicates the command being sent |
[in] | payload | the argument to the command |
Definition at line 338 of file data_speed_up_packet_gatherer.c.
Sanity checking for writes, ensuring that they're to the buffered SDRAM range.
Note that the RTE here is good as it is better (easier to debug, easier to comprehend) than having corrupt memory actually written.
[in] | write_address | where we are going to write. |
[in] | n_elements | the number of words we are going to write. |
Definition at line 353 of file data_speed_up_packet_gatherer.c.
|
static |
sends multicast messages accordingly for an SDP message
[in] | data | the actual data from the SDP message |
[in] | n_elements | the number of data items in the SDP message |
[in] | set_write_address | bool flag for if we should send the address where our writes will start; this is not set every time to reduce on-chip network overhead |
[in] | write_address | the sdram address where this block of data is to be written to |
Definition at line 374 of file data_speed_up_packet_gatherer.c.
creates a store for sequence numbers in a memory store.
May allocate in either DTCM (preferred) or SDRAM.
[in] | max_seq | the max seq num expected during this stage |
Definition at line 394 of file data_speed_up_packet_gatherer.c.
Frees the allocated sequence number store.
Definition at line 424 of file data_speed_up_packet_gatherer.c.
calculates the new sdram location for a given seq num
[in] | seq_num | the seq num to figure offset for |
Definition at line 442 of file data_speed_up_packet_gatherer.c.
Sets the length of the outbound SDP message in my_msg.
[in] | end | Points to the first byte after the content of the message |
Definition at line 449 of file data_speed_up_packet_gatherer.c.
|
static |
handles reading the address, chips and max packets from a SDP message (command: SDP_SEND_DATA_TO_LOCATION_CMD)
[in] | receive_data_cmd | The message to parse |
Definition at line 459 of file data_speed_up_packet_gatherer.c.
sends the finished request
Definition at line 521 of file data_speed_up_packet_gatherer.c.
|
static |
searches through received sequence numbers and transmits missing ones back to host for retransmission
[in] | msg | The message asking for the missed seq nums |
Definition at line 536 of file data_speed_up_packet_gatherer.c.
|
inlinestatic |
Calculates the number of words of data in an SDP message.
[in] | msg | the SDP message, as received from SARK |
[in] | data_start | where in the message the data actually starts |
Definition at line 609 of file data_speed_up_packet_gatherer.c.
because spin1_memcpy() is stupid, especially for access to SDRAM
[out] | target | Where to copy to |
[in] | source | Where to copy from |
[in] | n_words | The number of words to copy |
Definition at line 620 of file data_speed_up_packet_gatherer.c.
|
inlinestatic |
Handles receipt and parsing of a message full of sequence numbers that need to be retransmitted (command: SDP_SEND_SEQ_DATA_CMD)
[in] | msg | The message to parse (really of type receive_seq_data_msg_t) |
Definition at line 632 of file data_speed_up_packet_gatherer.c.
|
static |
processes SDP messages for the Data In protocol
[in] | msg | the SDP message |
Definition at line 685 of file data_speed_up_packet_gatherer.c.
sends the basic timeout command via multicast to the extra monitors
[in,out] | msg | the request to send the timeout; will be updated with result |
[in] | key | the multicast key to use here |
Definition at line 712 of file data_speed_up_packet_gatherer.c.
sends the clear message to all extra monitors on this board
[in,out] | msg | the request to send the clear; will be updated with result |
Definition at line 726 of file data_speed_up_packet_gatherer.c.
handles the commands for the reinjector code.
[in,out] | msg | the message with the commands; will be updated with result |
Definition at line 737 of file data_speed_up_packet_gatherer.c.
processes SDP messages
[in,out] | mailbox | the SDP message; will be freed by this call! |
[in] | port | the port associated with this SDP message |
Definition at line 774 of file data_speed_up_packet_gatherer.c.
sends data to the host via SDP (using my_msg)
Definition at line 790 of file data_speed_up_packet_gatherer.c.
Handles receipt of a fixed route packet with payload from the SpiNNaker network.
[in] | key | The key in the packet |
[in] | payload | The payload in the packet |
Definition at line 811 of file data_speed_up_packet_gatherer.c.
Sets up the application.
Definition at line 864 of file data_speed_up_packet_gatherer.c.
This function is called at application start-up.
It is used to register event callbacks (delegated to initialise()) and begin the simulation.
Definition at line 937 of file data_speed_up_packet_gatherer.c.
|
static |
the key that causes data out sequence number to be processed
Definition at line 155 of file data_speed_up_packet_gatherer.c.
|
static |
the key that says this is the first item of data in a data out stream
Definition at line 158 of file data_speed_up_packet_gatherer.c.
|
static |
the key that provides a new data out transaction ID
Definition at line 161 of file data_speed_up_packet_gatherer.c.
|
static |
the key that marks the end of a data out stream
Definition at line 164 of file data_speed_up_packet_gatherer.c.
|
static |
the key that marks an ordinary word within a data out stream
Definition at line 167 of file data_speed_up_packet_gatherer.c.
|
static |
default seq num
Definition at line 170 of file data_speed_up_packet_gatherer.c.
|
static |
maximum sequence number
Definition at line 173 of file data_speed_up_packet_gatherer.c.
|
static |
The Data In transaction ID. Used to distinguish streams of packets.
Definition at line 176 of file data_speed_up_packet_gatherer.c.
|
static |
The Data Out transaction ID. Used to distinguish streams of packets.
Definition at line 179 of file data_speed_up_packet_gatherer.c.
|
static |
data holders for the SDP packet (plus 1 to protect against memory overwrites with command messages)
Definition at line 183 of file data_speed_up_packet_gatherer.c.
|
static |
index into data
Definition at line 186 of file data_speed_up_packet_gatherer.c.
|
static |
SDP message holder for transmissions.
Definition at line 189 of file data_speed_up_packet_gatherer.c.
|
static |
How to find which key to use to talk to which chip on this board.
Note that these addresses are board-local chip addresses.
The keys here are base keys, and indicate the first key in a group where the LSBs (see key_offsets) indicate the meaning of the message.
Definition at line 231 of file data_speed_up_packet_gatherer.c.
|
static |
Board-relative x-coordinate of current chip being written to.
Definition at line 234 of file data_speed_up_packet_gatherer.c.
|
static |
Board-relative y-coordinate of current chip being written to.
Definition at line 237 of file data_speed_up_packet_gatherer.c.
|
static |
Records what sequence numbers we have received from host during Data In.
Definition at line 240 of file data_speed_up_packet_gatherer.c.
|
static |
The size of the bitfield in received_seq_nums_store.
Definition at line 243 of file data_speed_up_packet_gatherer.c.
Whether received_seq_nums_store was allocated in SDRAM.
If false, the bitfield fitted in DTCM
Definition at line 248 of file data_speed_up_packet_gatherer.c.
|
static |
Count of received sequence numbers.
Definition at line 251 of file data_speed_up_packet_gatherer.c.
|
static |
The most recently seen sequence number.
Definition at line 254 of file data_speed_up_packet_gatherer.c.
|
static |
Where the current stream of data started in SDRAM.
Definition at line 257 of file data_speed_up_packet_gatherer.c.
|
static |
The DTCM copy of the provenance.
Definition at line 304 of file data_speed_up_packet_gatherer.c.
|
static |
The SDRAM copy of the provenance.
Definition at line 307 of file data_speed_up_packet_gatherer.c.