forked from ofiwg/libfabric
-
Notifications
You must be signed in to change notification settings - Fork 9
Day in the life of fi_send fi_recv
Amith Abraham edited this page Sep 19, 2016
·
1 revision
There is a one to one correspondence between application's invocation of fi_send
, fi_recv
, and a gnix fab_req
.
This article covers basic code flow through gnix_send and gnix_recv
gnix_send populates a fab request based on the parameters provided to the function call, and finally will make another function call to try to initiate the send. The basic steps of gnix_send are outlined below.
- Basic Sanity checking. A few examples are listed below, but these may or may not change.
- Check that the provided
EP
has asend_cq
- Check that size of the send is lower than
GNIX_INJECT_SIZE
(WithFI_INJECT
flag present) - Check
FI_TRIGGER
- Determine whether the send is short (eager) or long (rendezvous). If the message is longer than the rendezvous threshold SMSG cannot be used, so both send and receive must handle this case differently.
- If rendezvous, a
memory descriptor
must be registered.
- Get Virtual Channel For a specific Endpoint and Destination Address you will get a specific Virtual Channel.
- Allocate Fab Request
- Populate Fab Request (Expand on this)
- What's different with FI_INJECT?
-
Initiate
gnix_vc_queue_tx_req
. This attempts to initiate a TX request. If the TX queue is blocked (due to low resources or aFI_FENCE
request), the request is scheduled to be sent later.gnix_vc_queue_tx_req
will eventually call on awork_fn
to process the request. In the case ofgnix_send
, the work function provided isgnix_send_req
.
- Basic sanity checking.
- Check for EP and NIC
- gnix_nic_tx_alloc Allocates a tx desc for the provided nic
-
Populate tdesc This is done differently based on the type of transaction (eager or rendezvous). In each case, a different portion of the struct will be populated -
tdesc->eager_hdr
ortdesc->rndzv_start_hdr
. Refer to sections below for more information on the differences.
- Regardless of message type, the
req`` is added into the
tdescas well as a
completer_fn(much like the
work_fnadded to the
reqin
gnix_send). The completer function provided is
gnix_ep_smsg_completers[tag]```.
-
GNI_SmsgSendWTag
is called.
- Ensure there is an associated memory descriptor.
- Populate tdesc->rndzv_start_hdr
- GNI_READ_ALIGN_MASK Align if necessary
- Changes are made to rndzv_start_hdr.head and .tail
- hdr and hdr_len are set to equal rndzv_start header and its size.
- Data is set to null.
- data = Null data_len= 0
- Populate tdesc->eager_hdr
- The hdr and data are added to the tdesc here. Since this isn't a rndzv the send length should always be the cumulative length of all the send_info lengths
- Basic Sanity Checking
- Check
EP
hasrecv_cq
- Check
msg_recv_allowed
ortagged_recv_allowed
-
gnix_msg_addr_lookup
(expand on this)
- gnix_msg_queues - This function sets up receive queues and locks based on whether the message is tagged or not.
- Acquire lock
- Look for a matching receive request
- Populate fab request fields
-
Check if using Peek/Claim,Discard (P/C/D) matching flags
(
FI_DISCARD
,FI_PEEK
) - Determine what kind of receive request was received, rendezvous or eager?
- Send length is truncated to receive buffer size
- Data is copied from eager msg to receive buffer (expand here)
- Generate recv completion
- If using
FI_MULTI_RECV
another space is left in the receive buffer. Go back to step 7 from previous section and proceed again. gnix_fr_free
TODO
TODO