Skip to content

Commit bdd903e

Browse files
committed
ch4/ofi: move some inline util functions
Move these utility functions to ofi_impl.h since they are simple and non-specific. It also simplifies figuring out which file to include especially for .c files.
1 parent c24a4a9 commit bdd903e

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

src/mpid/ch4/netmod/ofi/ofi_events.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,6 @@
1414
int MPIDI_OFI_rma_done_event(int vci, struct fi_cq_tagged_entry *wc, MPIR_Request * in_req);
1515
int MPIDI_OFI_dispatch_function(int vci, struct fi_cq_tagged_entry *wc, MPIR_Request * req);
1616

17-
MPL_STATIC_INLINE_PREFIX MPL_gpu_engine_type_t MPIDI_OFI_gpu_get_recv_engine_type(int cvar)
18-
{
19-
if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_compute) {
20-
return MPL_GPU_ENGINE_TYPE_COMPUTE;
21-
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_copy_high_bandwidth) {
22-
return MPL_GPU_ENGINE_TYPE_COPY_HIGH_BANDWIDTH;
23-
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_copy_low_latency) {
24-
return MPL_GPU_ENGINE_TYPE_COPY_LOW_LATENCY;
25-
} else {
26-
return MPL_GPU_ENGINE_TYPE_LAST;
27-
}
28-
}
29-
30-
MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_cqe_get_source(struct fi_cq_tagged_entry *wc, bool has_err)
31-
{
32-
if (MPIDI_OFI_ENABLE_DATA) {
33-
if (unlikely(has_err)) {
34-
return wc->data & ((1 << MPIDI_OFI_IDATA_SRC_BITS) - 1);
35-
}
36-
return wc->data;
37-
} else {
38-
return MPIDI_OFI_init_get_source(wc->tag);
39-
}
40-
}
41-
4217
MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_send_event(int vci,
4318
struct fi_cq_tagged_entry *wc /* unused */ ,
4419
MPIR_Request * sreq, int event_id)

src/mpid/ch4/netmod/ofi/ofi_impl.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,44 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_gpu_free_pack_buffer(void *ptr)
827827
}
828828
}
829829

830+
MPL_STATIC_INLINE_PREFIX MPL_gpu_engine_type_t MPIDI_OFI_gpu_get_send_engine_type(int cvar)
831+
{
832+
if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_compute) {
833+
return MPL_GPU_ENGINE_TYPE_COMPUTE;
834+
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_copy_high_bandwidth) {
835+
return MPL_GPU_ENGINE_TYPE_COPY_HIGH_BANDWIDTH;
836+
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_copy_low_latency) {
837+
return MPL_GPU_ENGINE_TYPE_COPY_LOW_LATENCY;
838+
} else {
839+
return MPL_GPU_ENGINE_TYPE_LAST;
840+
}
841+
}
842+
843+
MPL_STATIC_INLINE_PREFIX MPL_gpu_engine_type_t MPIDI_OFI_gpu_get_recv_engine_type(int cvar)
844+
{
845+
if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_compute) {
846+
return MPL_GPU_ENGINE_TYPE_COMPUTE;
847+
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_copy_high_bandwidth) {
848+
return MPL_GPU_ENGINE_TYPE_COPY_HIGH_BANDWIDTH;
849+
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_RECEIVE_ENGINE_TYPE_copy_low_latency) {
850+
return MPL_GPU_ENGINE_TYPE_COPY_LOW_LATENCY;
851+
} else {
852+
return MPL_GPU_ENGINE_TYPE_LAST;
853+
}
854+
}
855+
856+
MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_cqe_get_source(struct fi_cq_tagged_entry *wc, bool has_err)
857+
{
858+
if (MPIDI_OFI_ENABLE_DATA) {
859+
if (unlikely(has_err)) {
860+
return wc->data & ((1 << MPIDI_OFI_IDATA_SRC_BITS) - 1);
861+
}
862+
return wc->data;
863+
} else {
864+
return MPIDI_OFI_init_get_source(wc->tag);
865+
}
866+
}
867+
830868
int MPIDI_OFI_gpu_pipeline_send(MPIR_Request * sreq, const void *send_buf,
831869
MPI_Aint count, MPI_Datatype datatype,
832870
MPL_pointer_attr_t attr, MPI_Aint data_sz,

src/mpid/ch4/netmod/ofi/ofi_send.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@
88

99
#include "ofi_impl.h"
1010

11-
MPL_STATIC_INLINE_PREFIX MPL_gpu_engine_type_t MPIDI_OFI_gpu_get_send_engine_type(int cvar)
12-
{
13-
if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_compute) {
14-
return MPL_GPU_ENGINE_TYPE_COMPUTE;
15-
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_copy_high_bandwidth) {
16-
return MPL_GPU_ENGINE_TYPE_COPY_HIGH_BANDWIDTH;
17-
} else if (cvar == MPIR_CVAR_CH4_OFI_GPU_SEND_ENGINE_TYPE_copy_low_latency) {
18-
return MPL_GPU_ENGINE_TYPE_COPY_LOW_LATENCY;
19-
} else {
20-
return MPL_GPU_ENGINE_TYPE_LAST;
21-
}
22-
}
23-
2411
MPL_STATIC_INLINE_PREFIX int MPIDI_OFI_send_lightweight(const void *buf,
2512
size_t data_sz,
2613
uint64_t cq_data,

0 commit comments

Comments
 (0)