-
Notifications
You must be signed in to change notification settings - Fork 40
Add retrans for IBUC #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chencjcj
wants to merge
3
commits into
FlagOpen:main
Choose a base branch
from
chencjcj:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add retrans for IBUC #270
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /************************************************************************* | ||
| * Copyright (c) 2023 BAAI. All rights reserved. | ||
| * All rights reserved. | ||
| * | ||
| * IBUC Retransmission Support - Header | ||
| ************************************************************************/ | ||
|
|
||
| #ifndef FLAGCX_IBUC_RETRANS_H_ | ||
| #define FLAGCX_IBUC_RETRANS_H_ | ||
|
|
||
| #include "flagcx_common.h" | ||
| #include "ib_common.h" | ||
| #include <stdint.h> | ||
| #include <time.h> | ||
|
|
||
| // Retransmission constants | ||
| #define FLAGCX_RETRANS_MAGIC 0xDEADBEEF // Magic number for retransmission header | ||
| #define FLAGCX_RETRANS_WR_ID 0xFFFFFFFEULL // WR ID for retransmission completions | ||
|
|
||
| extern int64_t flagcxParamIbRetransEnable(void); | ||
| extern int64_t flagcxParamIbRetransTimeout(void); | ||
| extern int64_t flagcxParamIbRetransMaxRetry(void); | ||
| extern int64_t flagcxParamIbRetransAckInterval(void); | ||
| extern int64_t flagcxParamIbMaxOutstanding(void); | ||
|
|
||
| static inline uint64_t flagcxIbGetTimeUs(void) { | ||
| struct timespec ts; | ||
| clock_gettime(CLOCK_MONOTONIC, &ts); | ||
| return (uint64_t)ts.tv_sec * 1000000ULL + (uint64_t)ts.tv_nsec / 1000ULL; | ||
| } | ||
|
|
||
| static inline int flagcxIbSeqLess(uint32_t a, uint32_t b) { | ||
| uint16_t a16 = a & 0xFFFF; | ||
| uint16_t b16 = b & 0xFFFF; | ||
| return (int16_t)(a16 - b16) < 0; | ||
| } | ||
|
|
||
| static inline int flagcxIbSeqLeq(uint32_t a, uint32_t b) { | ||
| uint16_t a16 = a & 0xFFFF; | ||
| uint16_t b16 = b & 0xFFFF; | ||
| return (int16_t)(a16 - b16) <= 0; | ||
| } | ||
|
|
||
| flagcxResult_t flagcxIbRetransInit(struct flagcxIbRetransState *state); | ||
|
|
||
| flagcxResult_t flagcxIbRetransDestroy(struct flagcxIbRetransState *state); | ||
|
|
||
| flagcxResult_t flagcxIbRetransAddPacket(struct flagcxIbRetransState *state, | ||
| uint32_t seq, uint32_t size, void *data, | ||
| uint64_t remote_addr, uint32_t *lkeys, | ||
| uint32_t *rkeys); | ||
|
|
||
| flagcxResult_t flagcxIbRetransProcessAck(struct flagcxIbRetransState *state, | ||
| struct flagcxIbAckMsg *ack_msg); | ||
|
|
||
| flagcxResult_t flagcxIbRetransCheckTimeout(struct flagcxIbRetransState *state, | ||
| struct flagcxIbSendComm *comm); | ||
|
|
||
| flagcxResult_t flagcxIbRetransRecvPacket(struct flagcxIbRetransState *state, | ||
| uint32_t seq, | ||
| struct flagcxIbAckMsg *ack_msg, | ||
| int *should_ack); | ||
|
|
||
| flagcxResult_t flagcxIbRetransPiggybackAck(struct flagcxIbSendFifo *fifo_elem, | ||
| struct flagcxIbAckMsg *ack_msg); | ||
|
|
||
| flagcxResult_t flagcxIbRetransExtractAck(struct flagcxIbSendFifo *fifo_elem, | ||
| struct flagcxIbAckMsg *ack_msg); | ||
|
|
||
| static inline uint32_t flagcxIbEncodeImmData(uint32_t seq, uint32_t size) { | ||
| return ((seq & 0xFFFF) << 16) | (size & 0xFFFF); | ||
| } | ||
|
|
||
| static inline void flagcxIbDecodeImmData(uint32_t imm_data, uint32_t *seq, | ||
| uint32_t *size) { | ||
| *seq = (imm_data >> 16) & 0xFFFF; | ||
| *size = imm_data & 0xFFFF; | ||
| } | ||
|
|
||
| void flagcxIbRetransPrintStats(struct flagcxIbRetransState *state, | ||
| const char *prefix); | ||
|
|
||
| flagcxResult_t flagcxIbCreateCtrlQp(struct ibv_context *context, | ||
| struct ibv_pd *pd, uint8_t port_num, | ||
| struct flagcxIbCtrlQp *ctrlQp); | ||
|
|
||
| flagcxResult_t flagcxIbDestroyCtrlQp(struct flagcxIbCtrlQp *ctrlQp); | ||
|
|
||
| flagcxResult_t | ||
| flagcxIbSetupCtrlQpConnection(struct ibv_context *context, struct ibv_pd *pd, | ||
| struct flagcxIbCtrlQp *ctrlQp, | ||
| uint32_t remote_qpn, union ibv_gid *remote_gid, | ||
| uint16_t remote_lid, uint8_t port_num, | ||
| uint8_t link_layer, uint8_t local_gid_index); | ||
|
|
||
| flagcxResult_t flagcxIbRetransSendAckViaUd(struct flagcxIbRecvComm *comm, | ||
| struct flagcxIbAckMsg *ack_msg, | ||
| int devIndex); | ||
|
|
||
| flagcxResult_t flagcxIbRetransRecvAckViaUd(struct flagcxIbSendComm *comm, | ||
| int devIndex); | ||
|
|
||
| flagcxResult_t flagcxIbRetransResendViaSend(struct flagcxIbSendComm *comm, | ||
| uint32_t seq); | ||
|
|
||
| flagcxResult_t flagcxIbCreateSrq(struct ibv_context *context, struct ibv_pd *pd, | ||
| struct flagcxIbSrqMgr *srqMgr); | ||
|
|
||
| flagcxResult_t flagcxIbDestroySrq(struct flagcxIbSrqMgr *srqMgr); | ||
|
|
||
| flagcxResult_t flagcxIbSrqPostRecv(struct flagcxIbSrqMgr *srqMgr, int count); | ||
|
|
||
| #endif // FLAGCX_IBUC_RETRANS_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.