Skip to content
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

bug fix and major refactor of code #21

Merged
merged 21 commits into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e32ee27
assorted clean-ups
drossetti May 19, 2017
12178fd
add flags param to gds_stream_post_descriptors
drossetti May 19, 2017
d7609f5
consolidate APIs into apis.cpp
drossetti May 19, 2017
6df673c
use descriptor APIs
drossetti May 19, 2017
9b9df07
remove useless code
drossetti May 19, 2017
54e0b97
right type for write descriptor
Akshay-Venkatesh May 19, 2017
9bb7447
move desc as 1st param in gds_prepare_wait|write_value32()
drossetti May 22, 2017
9b00f7b
fix bug: make sanity checkers conform to C++ conventions
drossetti May 22, 2017
567e37a
use descriptor APIs for write32 and wait32
drossetti May 22, 2017
626882e
add descriptor APIs support (-U) to gds kernel latency tests
drossetti May 22, 2017
40f993b
send updated + rollback function (old changes applied to new branch)
e-ago May 22, 2017
32c504c
change extended param name for -U, add support for USE_GPU
drossetti May 22, 2017
1a92e95
Warnings fixed
e-ago May 22, 2017
b030bc7
use exp_ verbs names instead of a custom abstracted names
drossetti May 22, 2017
aaf966f
minor clean-ups in test/
drossetti May 22, 2017
0cdf58d
get rid of gds_register_peer()
drossetti May 23, 2017
951813f
move APIs into separate sections and add initial documentation
drossetti May 23, 2017
ac773e3
fix build problem with device.cuh
drossetti May 26, 2017
3ca6da9
protect from inclusion in C modules. fix build error.
drossetti May 26, 2017
e512e98
include device.cuh as sanity check
drossetti May 26, 2017
a7e902a
propagate CPPFLAGS to CUDA C builds
drossetti May 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use exp_ verbs names instead of a custom abstracted names
  • Loading branch information
drossetti committed May 27, 2017
commit b030bc767c69c22ab83b48dfacc29a932eb8909d
61 changes: 0 additions & 61 deletions include/gdsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,67 +36,6 @@
#include <infiniband/verbs_exp.h>
#include <infiniband/peer_ops.h>

#define ibv_peer_commit ibv_exp_peer_commit
#define ibv_peer_commit_qp ibv_exp_peer_commit_qp

#define ibv_create_qp_ex ibv_exp_create_qp
#define ibv_qp_init_attr_ex ibv_exp_qp_init_attr
#define ibv_create_cq_attr_ex ibv_exp_cq_init_attr

#define IBV_QP_INIT_ATTR_PD IBV_EXP_QP_INIT_ATTR_PD
#define IBV_QP_INIT_ATTR_PEER_DIRECT IBV_EXP_QP_INIT_ATTR_PEER_DIRECT

#define IBV_CREATE_CQ_ATTR_PEER_DIRECT IBV_EXP_CQ_INIT_ATTR_PEER_DIRECT

#define IBV_PEER_OP_FENCE IBV_EXP_PEER_OP_FENCE
#define IBV_PEER_OP_STORE_DWORD IBV_EXP_PEER_OP_STORE_DWORD
#define IBV_PEER_OP_STORE_QWORD IBV_EXP_PEER_OP_STORE_QWORD
#define IBV_PEER_OP_POLL_AND_DWORD IBV_EXP_PEER_OP_POLL_AND_DWORD
#define IBV_PEER_OP_POLL_NOR_DWORD IBV_EXP_PEER_OP_POLL_NOR_DWORD
#define IBV_PEER_OP_POLL_GEQ_DWORD IBV_EXP_PEER_OP_POLL_GEQ_DWORD
#define IBV_PEER_OP_COPY_BLOCK IBV_EXP_PEER_OP_COPY_BLOCK

#define IBV_PEER_OP_FENCE_CAP IBV_EXP_PEER_OP_FENCE_CAP
#define IBV_PEER_OP_STORE_DWORD_CAP IBV_EXP_PEER_OP_STORE_DWORD_CAP
#define IBV_PEER_OP_STORE_QWORD_CAP IBV_EXP_PEER_OP_STORE_QWORD_CAP
#define IBV_PEER_OP_COPY_BLOCK_CAP IBV_EXP_PEER_OP_COPY_BLOCK_CAP
#define IBV_PEER_OP_POLL_AND_DWORD_CAP IBV_EXP_PEER_OP_POLL_AND_DWORD_CAP
#define IBV_PEER_OP_POLL_NOR_DWORD_CAP IBV_EXP_PEER_OP_POLL_NOR_DWORD_CAP

#define IBV_PEER_FENCE_OP_READ IBV_EXP_PEER_FENCE_OP_READ
#define IBV_PEER_FENCE_OP_WRITE IBV_EXP_PEER_FENCE_OP_WRITE
#define IBV_PEER_FENCE_FROM_CPU IBV_EXP_PEER_FENCE_FROM_CPU
#define IBV_PEER_FENCE_FROM_HCA IBV_EXP_PEER_FENCE_FROM_HCA
#define IBV_PEER_FENCE_MEM_SYS IBV_EXP_PEER_FENCE_MEM_SYS
#define IBV_PEER_FENCE_MEM_PEER IBV_EXP_PEER_FENCE_MEM_PEER

#define ibv_peer_direct_attr ibv_exp_peer_direct_attr
#define ibv_peer_direction ibv_exp_peer_direction
#define ibv_peer_op ibv_exp_peer_op

#define IBV_ROLLBACK_ABORT_UNCOMMITED IBV_EXP_ROLLBACK_ABORT_UNCOMMITED
#define IBV_ROLLBACK_ABORT_LATE IBV_EXP_ROLLBACK_ABORT_LATE

#define ibv_rollback_ctx ibv_exp_rollback_ctx
#define ibv_rollback_qp ibv_exp_rollback_qp
#define ibv_peer_peek ibv_exp_peer_peek
#define ibv_peer_peek_cq ibv_exp_peer_peek_cq
#define ibv_peer_abort_peek ibv_exp_peer_abort_peek
#define ibv_peer_abort_peek_cq ibv_exp_peer_abort_peek_cq

#define IBV_PEER_DIRECTION_FROM_CPU IBV_EXP_PEER_DIRECTION_FROM_CPU
#define IBV_PEER_DIRECTION_FROM_HCA IBV_EXP_PEER_DIRECTION_FROM_HCA
#define IBV_PEER_DIRECTION_FROM_PEER IBV_EXP_PEER_DIRECTION_FROM_PEER
#define IBV_PEER_DIRECTION_TO_CPU IBV_EXP_PEER_DIRECTION_TO_CPU
#define IBV_PEER_DIRECTION_TO_HCA IBV_EXP_PEER_DIRECTION_TO_HCA
#define IBV_PEER_DIRECTION_TO_PEER IBV_EXP_PEER_DIRECTION_TO_PEER

#define ibv_peer_buf ibv_exp_peer_buf
#define ibv_peer_buf_alloc_attr ibv_exp_peer_buf_alloc_attr

#define ibv_create_cq_ex_(ctx, attr, n, ch) \
ibv_exp_create_cq(ctx, n, NULL, ch, 0, attr)

#include <cuda.h>
#include <gdrapi.h>

Expand Down
2 changes: 1 addition & 1 deletion include/gdsync/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum gds_create_qp_flags {
GDS_CREATE_QP_WQ_DBREC_ON_GPU = 1<<5,
};

typedef struct ibv_qp_init_attr_ex gds_qp_init_attr_t;
typedef struct ibv_exp_qp_init_attr gds_qp_init_attr_t;
typedef struct ibv_exp_send_wr gds_send_wr;

struct gds_cq {
Expand Down
64 changes: 32 additions & 32 deletions src/gdsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *
//int flags = 0;
gds_dbg("op[%zu] type:%08x\n", n, op->type);
switch(op->type) {
case IBV_PEER_OP_FENCE: {
case IBV_EXP_PEER_OP_FENCE: {
gds_dbg("OP_FENCE: fence_flags=%"PRIu64"\n", op->wr.fence.fence_flags);
uint32_t fence_op = (op->wr.fence.fence_flags & (IBV_EXP_PEER_FENCE_OP_READ|IBV_EXP_PEER_FENCE_OP_WRITE));
uint32_t fence_from = (op->wr.fence.fence_flags & (IBV_EXP_PEER_FENCE_FROM_CPU|IBV_EXP_PEER_FENCE_FROM_HCA));
Expand Down Expand Up @@ -613,7 +613,7 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *
}
break;
}
case IBV_PEER_OP_STORE_DWORD: {
case IBV_EXP_PEER_OP_STORE_DWORD: {
CUdeviceptr dev_ptr = range_from_id(op->wr.dword_va.target_id)->dptr +
op->wr.dword_va.offset;
uint32_t data = op->wr.dword_va.data;
Expand Down Expand Up @@ -650,7 +650,7 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *
}
break;
}
case IBV_PEER_OP_STORE_QWORD: {
case IBV_EXP_PEER_OP_STORE_QWORD: {
CUdeviceptr dev_ptr = range_from_id(op->wr.qword_va.target_id)->dptr +
op->wr.qword_va.offset;
uint64_t data = op->wr.qword_va.data;
Expand Down Expand Up @@ -700,7 +700,7 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *

break;
}
case IBV_PEER_OP_COPY_BLOCK: {
case IBV_EXP_PEER_OP_COPY_BLOCK: {
CUdeviceptr dev_ptr = range_from_id(op->wr.copy_op.target_id)->dptr +
op->wr.copy_op.offset;
size_t len = op->wr.copy_op.len;
Expand All @@ -722,9 +722,9 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *
++idx;
break;
}
case IBV_PEER_OP_POLL_AND_DWORD:
case IBV_PEER_OP_POLL_GEQ_DWORD:
case IBV_PEER_OP_POLL_NOR_DWORD: {
case IBV_EXP_PEER_OP_POLL_AND_DWORD:
case IBV_EXP_PEER_OP_POLL_GEQ_DWORD:
case IBV_EXP_PEER_OP_POLL_NOR_DWORD: {
int poll_cond;
CUdeviceptr dev_ptr = range_from_id(op->wr.dword_va.target_id)->dptr +
op->wr.dword_va.offset;
Expand All @@ -737,17 +737,17 @@ int gds_post_ops(size_t n_ops, struct peer_op_wr *op, CUstreamBatchMemOpParams *
gds_dbg("OP_WAIT_DWORD dev_ptr=%llx data=%"PRIx32"\n", dev_ptr, data);

switch(op->type) {
case IBV_PEER_OP_POLL_NOR_DWORD:
case IBV_EXP_PEER_OP_POLL_NOR_DWORD:
//poll_cond = GDS_WAIT_COND_NOR;
// TODO: lookup and pass peer down
assert(gpu_does_support_nor(NULL));
retcode = EINVAL;
goto out;
break;
case IBV_PEER_OP_POLL_GEQ_DWORD:
case IBV_EXP_PEER_OP_POLL_GEQ_DWORD:
poll_cond = GDS_WAIT_COND_GEQ;
break;
case IBV_PEER_OP_POLL_AND_DWORD:
case IBV_EXP_PEER_OP_POLL_AND_DWORD:
poll_cond = GDS_WAIT_COND_AND;
break;
default:
Expand Down Expand Up @@ -832,7 +832,7 @@ static int gds_post_ops_on_cpu(size_t n_descs, struct peer_op_wr *op)
//int flags = 0;
gds_dbg("op[%zu] type:%08x\n", n, op->type);
switch(op->type) {
case IBV_PEER_OP_FENCE: {
case IBV_EXP_PEER_OP_FENCE: {
gds_dbg("fence_flags=%"PRIu64"\n", op->wr.fence.fence_flags);
uint32_t fence_op = (op->wr.fence.fence_flags & (IBV_EXP_PEER_FENCE_OP_READ|IBV_EXP_PEER_FENCE_OP_WRITE));
uint32_t fence_from = (op->wr.fence.fence_flags & (IBV_EXP_PEER_FENCE_FROM_CPU|IBV_EXP_PEER_FENCE_FROM_HCA));
Expand Down Expand Up @@ -865,32 +865,32 @@ static int gds_post_ops_on_cpu(size_t n_descs, struct peer_op_wr *op)
}
break;
}
case IBV_PEER_OP_STORE_DWORD: {
case IBV_EXP_PEER_OP_STORE_DWORD: {
uint32_t *ptr = (uint32_t*)((ptrdiff_t)range_from_id(op->wr.dword_va.target_id)->va + op->wr.dword_va.offset);
uint32_t data = op->wr.dword_va.data;
// A || B || C || E
ACCESS_ONCE(*ptr) = data;
gds_dbg("%p <- %08x\n", ptr, data);
break;
}
case IBV_PEER_OP_STORE_QWORD: {
case IBV_EXP_PEER_OP_STORE_QWORD: {
uint64_t *ptr = (uint64_t*)((ptrdiff_t)range_from_id(op->wr.qword_va.target_id)->va + op->wr.qword_va.offset);
uint64_t data = op->wr.qword_va.data;
ACCESS_ONCE(*ptr) = data;
gds_dbg("%p <- %016"PRIx64"\n", ptr, data);
break;
}
case IBV_PEER_OP_COPY_BLOCK: {
case IBV_EXP_PEER_OP_COPY_BLOCK: {
uint64_t *ptr = (uint64_t*)((ptrdiff_t)range_from_id(op->wr.copy_op.target_id)->va + op->wr.copy_op.offset);
uint64_t *src = (uint64_t*)op->wr.copy_op.src;
size_t n_bytes = op->wr.copy_op.len;
gds_bf_copy(ptr, src, n_bytes);
gds_dbg("%p <- %p len=%zu\n", ptr, src, n_bytes);
break;
}
case IBV_PEER_OP_POLL_AND_DWORD:
case IBV_PEER_OP_POLL_GEQ_DWORD:
case IBV_PEER_OP_POLL_NOR_DWORD: {
case IBV_EXP_PEER_OP_POLL_AND_DWORD:
case IBV_EXP_PEER_OP_POLL_GEQ_DWORD:
case IBV_EXP_PEER_OP_POLL_NOR_DWORD: {
gds_err("polling is not supported\n");
retcode = EINVAL;
break;
Expand Down Expand Up @@ -1040,27 +1040,27 @@ static void gds_dump_ops(struct peer_op_wr *op, size_t count)
for (; op; op = op->next, ++n) {
gds_dbg("op[%zu] type:%d\n", n, op->type);
switch(op->type) {
case IBV_PEER_OP_FENCE: {
case IBV_EXP_PEER_OP_FENCE: {
gds_dbg("FENCE flags=%"PRIu64"\n", op->wr.fence.fence_flags);
break;
}
case IBV_PEER_OP_STORE_DWORD: {
case IBV_EXP_PEER_OP_STORE_DWORD: {
CUdeviceptr dev_ptr = range_from_id(op->wr.dword_va.target_id)->dptr +
op->wr.dword_va.offset;
gds_dbg("STORE_QWORD data:%x target_id:%"PRIx64" offset:%zu dev_ptr=%llx\n",
op->wr.dword_va.data, op->wr.dword_va.target_id,
op->wr.dword_va.offset, dev_ptr);
break;
}
case IBV_PEER_OP_STORE_QWORD: {
case IBV_EXP_PEER_OP_STORE_QWORD: {
CUdeviceptr dev_ptr = range_from_id(op->wr.qword_va.target_id)->dptr +
op->wr.qword_va.offset;
gds_dbg("STORE_QWORD data:%"PRIx64" target_id:%"PRIx64" offset:%zu dev_ptr=%llx\n",
op->wr.qword_va.data, op->wr.qword_va.target_id,
op->wr.qword_va.offset, dev_ptr);
break;
}
case IBV_PEER_OP_COPY_BLOCK: {
case IBV_EXP_PEER_OP_COPY_BLOCK: {
CUdeviceptr dev_ptr = range_from_id(op->wr.copy_op.target_id)->dptr +
op->wr.copy_op.offset;
gds_dbg("COPY_BLOCK src:%p len:%zu target_id:%"PRIx64" offset:%zu dev_ptr=%llx\n",
Expand All @@ -1069,12 +1069,12 @@ static void gds_dump_ops(struct peer_op_wr *op, size_t count)
dev_ptr);
break;
}
case IBV_PEER_OP_POLL_AND_DWORD:
case IBV_PEER_OP_POLL_NOR_DWORD: {
case IBV_EXP_PEER_OP_POLL_AND_DWORD:
case IBV_EXP_PEER_OP_POLL_NOR_DWORD: {
CUdeviceptr dev_ptr = range_from_id(op->wr.dword_va.target_id)->dptr +
op->wr.dword_va.offset;
gds_dbg("%s data:%08x target_id:%"PRIx64" offset:%zu dev_ptr=%llx\n",
(op->type==IBV_PEER_OP_POLL_AND_DWORD) ? "POLL_AND_DW" : "POLL_NOR_SDW",
(op->type==IBV_EXP_PEER_OP_POLL_AND_DWORD) ? "POLL_AND_DW" : "POLL_NOR_SDW",
op->wr.dword_va.data,
op->wr.dword_va.target_id,
op->wr.dword_va.offset,
Expand Down Expand Up @@ -1155,7 +1155,7 @@ int gds_stream_post_wait_cq_multi(CUstream stream, int count, gds_wait_request_t

// If NULL returned then buffer will be allocated in system memory
// by ibverbs driver.
static struct ibv_peer_buf *gds_buf_alloc(ibv_peer_buf_alloc_attr *attr)
static struct ibv_exp_peer_buf *gds_buf_alloc(ibv_exp_peer_buf_alloc_attr *attr)
{
assert(attr);
gds_peer *peer = peer_from_id(attr->peer_id);
Expand All @@ -1167,7 +1167,7 @@ static struct ibv_peer_buf *gds_buf_alloc(ibv_peer_buf_alloc_attr *attr)
return peer->buf_alloc(peer->alloc_type, attr->length, attr->dir, attr->alignment, peer->alloc_flags);
}

static int gds_buf_release(struct ibv_peer_buf *pb)
static int gds_buf_release(struct ibv_exp_peer_buf *pb)
{
gds_dbg("freeing pb=%p\n", pb);
gds_buf *buf = static_cast<gds_buf*>(pb);
Expand Down Expand Up @@ -1329,8 +1329,8 @@ gds_create_cq(struct ibv_context *context, int cqe,
peer->alloc_type = gds_peer::CQ;
peer->alloc_flags = flags;

ibv_create_cq_attr_ex attr;
attr.comp_mask = IBV_CREATE_CQ_ATTR_PEER_DIRECT;
ibv_exp_cq_init_attr attr;
attr.comp_mask = IBV_EXP_CQ_INIT_ATTR_PEER_DIRECT;
attr.flags = 0; // see ibv_exp_cq_create_flags
attr.res_domain = NULL;
attr.peer_direct_attrs = peer_attr;
Expand Down Expand Up @@ -1396,7 +1396,7 @@ struct gds_qp *gds_create_qp(struct ibv_pd *pd, struct ibv_context *context, gds
qp_attr->recv_cq = rx_cq;

qp_attr->pd = pd;
qp_attr->comp_mask |= IBV_QP_INIT_ATTR_PD;
qp_attr->comp_mask |= IBV_EXP_QP_INIT_ATTR_PD;

gds_dbg("before gds_register_peer_ex\n");

Expand All @@ -1416,13 +1416,13 @@ struct gds_qp *gds_create_qp(struct ibv_pd *pd, struct ibv_context *context, gds
gds_warn("QP WQ DBREC on GPU\n");
peer->alloc_flags |= GDS_ALLOC_DBREC_ON_GPU;
}
qp_attr->comp_mask |= IBV_QP_INIT_ATTR_PEER_DIRECT;
qp_attr->comp_mask |= IBV_EXP_QP_INIT_ATTR_PEER_DIRECT;
qp_attr->peer_direct_attrs = peer_attr;

qp = ibv_create_qp_ex(context, qp_attr);
qp = ibv_exp_create_qp(context, qp_attr);
if (!qp) {
ret = EINVAL;
gds_err("error in ibv_create_qp_ex\n");
gds_err("error in ibv_exp_create_qp\n");
goto err_free_cqs;
}

Expand Down
Loading