Day in the life of fi_send fi_recv - a-abraham/docs GitHub Wiki
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
EPhas asend_cq - Check that size of the send is lower than
GNIX_INJECT_SIZE(WithFI_INJECTflag 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 descriptormust 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_FENCErequest), the request is scheduled to be sent later.gnix_vc_queue_tx_reqwill eventually call on awork_fnto 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_hdrortdesc->rndzv_start_hdr. Refer to sections below for more information on the differences.
- Regardless of message type, the
req`` is added into thetdescas well as acompleter_fn(much like thework_fnadded to thereqingnix_send). The completer function provided isgnix_ep_smsg_completers[tag]```.
-
GNI_SmsgSendWTagis called.
- Ensure there is an associated memory descriptor.
- Populate tdesc->rndzv_start_hdr
- GNI_READ_ALIGN_MASK (what is this step?)
- 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
TODO
- Basic Sanity Checking
- Check
EPhasrecv_cq - Check
msg_recv_allowedortagged_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_RECVanother space is left in the receive buffer. Go back to step 7 from previous section and proceed again. gnix_fr_free
TODO
TODO