Skip to content

Commit

Permalink
remove most of tools APIs, easily replaced by using gds descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
drossetti committed Jun 20, 2017
1 parent 3986009 commit f65f228
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 166 deletions.
11 changes: 0 additions & 11 deletions include/gdsync/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,4 @@ typedef struct gds_mem_desc {
int gds_alloc_mapped_memory(gds_mem_desc_t *desc, size_t size, int flags);
int gds_free_mapped_memory(gds_mem_desc_t *desc);

// flags is combination of gds_memory_type and gds_poll_flags
int gds_stream_post_poll_dword(CUstream stream, uint32_t *ptr, uint32_t magic, gds_wait_cond_flag_t cond_flag, int flags);
int gds_stream_post_poke_dword(CUstream stream, uint32_t *ptr, uint32_t value, int flags);
int gds_stream_post_inline_copy(CUstream stream, void *ptr, void *src, size_t nbytes, int flags);
int gds_stream_post_polls_and_pokes(CUstream stream,
size_t n_polls, uint32_t *ptrs[], uint32_t magics[], gds_wait_cond_flag_t cond_flags[], int poll_flags[],
size_t n_pokes, uint32_t *poke_ptrs[], uint32_t poke_values[], int poke_flags[]);
int gds_stream_post_polls_and_immediate_copies(CUstream stream,
size_t n_polls, uint32_t *ptrs[], uint32_t magics[], gds_wait_cond_flag_t cond_flags[], int poll_flags[],
size_t n_imms, void *imm_ptrs[], void *imm_datas[], size_t imm_bytes[], int imm_flags[]);

GDS_END_DECLS
61 changes: 0 additions & 61 deletions src/apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,67 +474,6 @@ int gds_prepare_write_memory(gds_write_memory_t *desc, uint8_t *dest, const uint

//-----------------------------------------------------------------------------

int gds_stream_post_poll_dword(CUstream stream, uint32_t *ptr, uint32_t magic, gds_wait_cond_flag_t cond_flags, int flags)
{
int retcode = 0;
CUstreamBatchMemOpParams param[1];
retcode = gds_fill_poll(param, ptr, magic, cond_flags, flags);
if (retcode) {
gds_err("error in fill_poll\n");
goto out;
}
retcode = gds_stream_batch_ops(stream, 1, param, 0);
if (retcode) {
gds_err("error in batch_ops\n");
goto out;
}
out:
return retcode;
}

//-----------------------------------------------------------------------------

int gds_stream_post_poke_dword(CUstream stream, uint32_t *ptr, uint32_t value, int flags)
{
int retcode = 0;
CUstreamBatchMemOpParams param[1];
retcode = gds_fill_poke(param, ptr, value, flags);
if (retcode) {
gds_err("error in fill_poke\n");
goto out;
}
retcode = gds_stream_batch_ops(stream, 1, param, 0);
if (retcode) {
gds_err("error in batch_ops\n");
goto out;
}
out:
return retcode;
}

//-----------------------------------------------------------------------------

int gds_stream_post_inline_copy(CUstream stream, void *ptr, void *src, size_t nbytes, int flags)
{
int retcode = 0;
CUstreamBatchMemOpParams param[1];

retcode = gds_fill_inlcpy(param, ptr, src, nbytes, flags);
if (retcode) {
gds_err("error in fill_poke\n");
goto out;
}
retcode = gds_stream_batch_ops(stream, 1, param, 0);
if (retcode) {
gds_err("error in batch_ops\n");
goto out;
}
out:
return retcode;
}

//-----------------------------------------------------------------------------

static bool no_network_descs_after_entry(size_t n_descs, gds_descriptor_t *descs, size_t idx)
{
bool ret = true;
Expand Down
94 changes: 0 additions & 94 deletions src/gdsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,100 +977,6 @@ int gds_post_pokes_on_cpu(int count, gds_send_request_t *info, uint32_t *dw, uin

//-----------------------------------------------------------------------------

int gds_stream_post_polls_and_pokes(CUstream stream,
size_t n_polls, uint32_t *ptrs[], uint32_t magics[], gds_wait_cond_flag_t cond_flags[], int poll_flags[],
size_t n_pokes, uint32_t *poke_ptrs[], uint32_t poke_values[], int poke_flags[])
{
int retcode = 0;
size_t idx = 0;
CUstreamBatchMemOpParams params[n_polls + n_pokes];
gds_dbg("n_polls=%zu n_pokes=%zu\n", n_polls, n_pokes);

for (size_t j = 0; j < n_polls; ++j, ++idx) {
uint32_t *ptr = ptrs[j];
uint32_t magic = magics[j];
gds_wait_cond_flag_t cond_flag = cond_flags[j];
int flags = poll_flags[j];
gds_dbg("poll %zu: addr=%p value=%08x cond=%d flags=%08x\n", j, ptr, magic, cond_flag, flags);
retcode = gds_fill_poll(params+idx, ptr, magic, cond_flag, flags);
if (retcode) {
gds_err("error in fill_poll at entry %zu\n", j);
goto out;
}
}

for (size_t j = 0; j < n_pokes; ++j, ++idx) {
uint32_t *addr = poke_ptrs[j];
uint32_t value = poke_values[j];
int flags = poke_flags[j];
gds_dbg("poke %zu: addr=%p value=%08x flags=%08x\n", j, addr, value, flags);
retcode = gds_fill_poke(params+idx, addr, value, flags);
if (retcode) {
gds_err("error in fill_poll at entry %zu\n", j);
goto out;
}
}

assert(idx == n_polls + n_pokes);

retcode = gds_stream_batch_ops(stream, idx, params, 0);
if (retcode) {
gds_err("error in batch_ops\n");
goto out;
}

out:
return retcode;
}

//-----------------------------------------------------------------------------

int gds_stream_post_polls_and_immediate_copies(CUstream stream,
size_t n_polls, uint32_t *ptrs[], uint32_t magics[], gds_wait_cond_flag_t cond_flags[], int poll_flags[],
size_t n_imms, void *imm_ptrs[], void *imm_datas[], size_t imm_bytes[], int imm_flags[])
{
int retcode = 0;
size_t idx = 0;
CUstreamBatchMemOpParams params[n_polls + n_imms];

for (size_t j = 0; j < n_polls; ++j, ++idx) {
uint32_t *ptr = ptrs[j];
uint32_t magic = magics[j];
gds_wait_cond_flag_t cond_flag = cond_flags[j];
int flags = poll_flags[j];

retcode = gds_fill_poll(params+idx, ptr, magic, cond_flag, flags);
if (retcode) {
gds_err("error in fill_poll at entry %zu\n", j);
goto out;
}
}

for (size_t j = 0; j < n_imms; ++j, ++idx) {
void *ptr = imm_ptrs[j];
void *data = imm_datas[j];
size_t n_bytes = imm_bytes[j];
int flags = imm_flags[j];
retcode = gds_fill_inlcpy(params+idx, ptr, data, n_bytes, flags);
if (retcode) {
gds_err("error in fill_inlcpy at entry %zu\n", j);
goto out;
}
}
assert(idx == n_polls + n_imms);

retcode = gds_stream_batch_ops(stream, idx, params, 0);
if (retcode) {
gds_err("error in batch_ops\n");
goto out;
}

out:
return retcode;
}

//-----------------------------------------------------------------------------

static void gds_dump_ops(struct peer_op_wr *op, size_t count)
{
size_t n = 0;
Expand Down

0 comments on commit f65f228

Please sign in to comment.