From ca759850a372e679245517145d38aa8b62814461 Mon Sep 17 00:00:00 2001 From: Nikhil Nanal Date: Mon, 7 Oct 2024 13:39:29 -0700 Subject: [PATCH] --- prov/xxx/xxx.h | 31 +++++++++ prov/xxx/xxx_atomic.c | 10 ++- prov/xxx/xxx_cq.c | 10 ++- prov/xxx/xxx_domain.c | 108 +++++++++++++++++++++++++++++- prov/xxx/xxx_ep.c | 151 +++++++++++++++++++++++++++++++++++++++++- prov/xxx/xxx_fabric.c | 52 ++++++++++++++- prov/xxx/xxx_init.c | 7 ++ 7 files changed, 364 insertions(+), 5 deletions(-) diff --git a/prov/xxx/xxx.h b/prov/xxx/xxx.h index 74496cefe94..c425fd02af4 100644 --- a/prov/xxx/xxx.h +++ b/prov/xxx/xxx.h @@ -49,5 +49,36 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +extern struct fi_provider xxx_prov; +extern struct fi_info xxx_info; +extern struct util_prov xxx_util_prov; + int xxx_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context); +int xxx_av_open(struct fid_domain *domain_fid, struct fi_av_attr *attr, + struct fid_av **fid_av, void *context); +int xnet_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr, + struct fid_cq **cq_fid, void *context); +int xxx_endpoint(struct fid_domain *domain, struct fi_info *info, + struct fid_ep **ep_fid, void *context); +int xxx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr, + struct fid_cntr **cntr_fid, void *context); +int xxx_srx_context (struct fid_domain *domain, struct fi_rx_attr *attr, + struct fid_ep **rx_ep, void *context); + +int xxx_srx_context (struct fid_domain *domain, struct fi_rx_attr *attr, + struct fid_ep **rx_ep, void *context); \ No newline at end of file diff --git a/prov/xxx/xxx_atomic.c b/prov/xxx/xxx_atomic.c index 8e5b0d93ba1..4e3cfea60ad 100644 --- a/prov/xxx/xxx_atomic.c +++ b/prov/xxx/xxx_atomic.c @@ -28,4 +28,12 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - */ \ No newline at end of file + */ + +#include "xxx.h" + +int xxx_query_atomic(struct fid_domain *domain, enum fi_datatype datatype, + enum fi_op op, struct fi_atomic_attr *attr, uint64_t flags) +{ + return fi_no_query_atomic(domain, datatype, op, attr, flags); +} \ No newline at end of file diff --git a/prov/xxx/xxx_cq.c b/prov/xxx/xxx_cq.c index 8e5b0d93ba1..7d7caeebda6 100644 --- a/prov/xxx/xxx_cq.c +++ b/prov/xxx/xxx_cq.c @@ -28,4 +28,12 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - */ \ No newline at end of file + */ + +#include "xxx.h" + +int xnet_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr, + struct fid_cq **cq_fid, void *context) +{ + return fi_no_cq_open(domain, attr, cq_fid, context); +} \ No newline at end of file diff --git a/prov/xxx/xxx_domain.c b/prov/xxx/xxx_domain.c index 8e5b0d93ba1..847737721bb 100644 --- a/prov/xxx/xxx_domain.c +++ b/prov/xxx/xxx_domain.c @@ -28,4 +28,110 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - */ \ No newline at end of file + */ + +#include "xxx.h" + +static int xxx_query_collective(struct fid_domain *domain, + enum fi_collective_op coll, + struct fi_collective *attr, uint64_t flags) +{ + return fi_no_query_collective(domain, coll, attr, flags); +} + +static struct fi_ops_domain xxx_domain_ops = { + .size = sizeof(struct fi_ops_domain), + .av_open = xxx_av_open, + .cq_open = xxx_cq_open, + .endpoint = xxx_endpoint, + .scalable_ep = fi_no_scalable_ep, + .cntr_open = xxx_cntr_open, + .poll_open = fi_no_poll_create, + .stx_ctx = fi_no_stx_context, + .srx_ctx = xxx_srx_context, + .query_atomic = xxx_query_atomic, + .query_collective = fi_no_query_collective, +}; + +static int xxx_domain_close(fid_t fid) +{ + int ret; + struct xxx_domain *domain; + + domain = container_of(fid, struct xxx_domain, + util_domain.domain_fid.fid); + + ret = ofi_domain_close(&domain->util_domain); + if (ret) + return ret; + + free(domain); + return 0; +} + +static struct fi_ops xxx_domain_fi_ops = { + .size = sizeof(struct fi_ops), + .close = xxx_domain_close, + .bind = fi_no_bind, + .control = fi_no_control, + .ops_open = fi_no_ops_open, +}; + +static int xxx_mr_reg(struct fid *fid, const void *buf, size_t len, + uint64_t access, uint64_t offset, uint64_t requested_key, + uint64_t flags, struct fid_mr **mr_fid, void *context) +{ + return ofi_mr_reg(fid, buf, len, access, offset, requested_key, flags, + mr_fid, context); +} + +static int xxx_mr_regv(struct fid *fid, const struct iovec *iov, size_t count, + uint64_t access, uint64_t offset, uint64_t requested_key, + uint64_t flags, struct fid_mr **mr_fid, void *context) +{ + return ofi_mr_regv(fid, iov, count, access, offset, requested_key, + flags, mr_fid, context); +} + +static int xxx_mr_regattr(struct fid *fid, const struct fi_mr_attr *attr, + uint64_t flags, struct fid_mr **mr_fid) +{ + return ofi_mr_regattr(fid, attr, flags, mr_fid); +} + +static struct fi_ops_mr xxx_mr_ops = { + .size = sizeof(struct fi_ops_mr), + .reg = xxx_mr_reg, + .regv = xxx_mr_regv, + .regattr = xxx_mr_regattr, +}; + + +int xxx_domain_open(struct fid_fabric *fabric, struct fi_info *info, + struct fid_domain **domain, void *context) +{ + int ret; + struct xxx_domain *xxx_domain; + + ret = ofi_prov_check_info(&xxx_util_prov, fabric->api_version, info); + if (ret) + return ret; + + xxx_domain = calloc(1, sizeof(*xxx_domain)); + if (!xxx_domain) + return -FI_ENOMEM; + + ret = ofi_domain_init(fabric, info, &xxx_domain->util_domain, context, + OFI_LOCK_SPINLOCK); + if (ret) { + free(xxx_domain); + return ret; + } + + *domain = &xxx_domain->util_domain.domain_fid; + (*domain)->fid.ops = &xxx_domain_fi_ops; + (*domain)->ops = &xxx_domain_ops; + (*domain)->mr = &xxx_mr_ops; + + return 0; +} diff --git a/prov/xxx/xxx_ep.c b/prov/xxx/xxx_ep.c index 8e5b0d93ba1..72226eacd3f 100644 --- a/prov/xxx/xxx_ep.c +++ b/prov/xxx/xxx_ep.c @@ -28,4 +28,153 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - */ \ No newline at end of file + */ + +#include "xxx.h" + +static int xxx_setname(fid_t fid, void *addr, size_t addrlen) +{ + return fi_no_setname(fid, addr, addrlen); +} + +static int xxx_getname(fid_t fid, void *addr, size_t *addrlen) +{ + return fi_no_getname(fid, addr, addrlen); +} + +static int xxx_getpeer(struct fid_ep *ep, void *addr, size_t *addrlen) +{ + return fi_no_getpeer(ep, addr, addrlen); +} + +static int xxx_connect(struct fid_ep *ep, const void *addr, const void *param, + size_t paramlen) +{ + return fi_no_connect(ep, addr, param, paramlen); +} + +static int xxx_listen(struct fid_pep *pep) +{ + return fi_no_listen(pep); +} + +static int xxx_accept(struct fid_ep *ep, const void *param, size_t paramlen) +{ + return fi_no_accept(ep, param, paramlen); +} + +static int xxx_reject(struct fid_pep *pep, fid_t handle, const void *param, + size_t paramlen) +{ + return fi_no_reject(pep, handle, param, paramlen); +} + +static int xxx_shutdown(struct fid_ep *ep, uint64_t flags) +{ + return fi_no_shutdown(ep, flags); +} + +static struct fi_ops_cm xxx_cm_ops = { + .size = sizeof(struct fi_ops_cm), + .setname = xxx_setname, + .getname = xxx_getname, + .getpeer = xxx_getpeer, + .connect = xxx_connect, + .listen = xxx_listen, + .accept = xxx_accept, + .reject = xxx_reject, + .shutdown = xxx_shutdown, +}; + +static ssize_t xxx_ep_cancel(struct fid_t ep_fid, void *context) +{ + return -FI_ENOSYS; +} + +int xxx_ep_getopt(fid_t fid, int level, int optname, void *optval, + size_t *optlen) +{ + return -FI_ENOSYS; +} + +int xxx_ep_setopt(fid_t fid, int level, int optname, const void *optval, + size_t optlen) +{ + return -FI_ENOSYS; +} + +int xxx_tx_ctx(struct fid_ep *sep, int index, struct fi_tx_attr *attr, + struct fid_ep **tx_ep, void *context) +{ + return fi_no_tx_ctx(sep, index, attr, tx_ep, context); +} + +int xxx_rx_ctx(struct fid_ep *sep, int index, struct fi_tx_attr *attr, + struct fid_ep **tx_ep, void *context) +{ + return fi_no_rx_ctx(sep, index, attr, tx_ep, context); +} + +ssize_t xxx_rx_size_left(struct fid_ep *ep) +{ + return fi_no_rx_size_left(ep); +} + +ssize_t xxx_tx_size_left(struct fid_ep *ep) +{ + return fi_no_tx_size_left(ep); +} + +static struct fi_ops_ep xxx_ep_ops = { + .size = sizeof(struct fi_ops_ep), + .cancel = xxx_ep_cancel, + .getopt = xxx_ep_getopt, + .setopt = xxx_ep_setopt, + .tx_ctx = xxx_tx_ctx, + .rx_ctx = xxx_rx_ctx, + .rx_size_left = xxx_rx_size_left, + .tx_size_left = xxx_tx_size_left, +}; + +static int xxx_ep_close(struct fid *ep_fid) +{ + return fi_no_close(ep_fid); +} + +static int xxx_ep_bind(struct fid *ep_fid, struct fid *bfid, uint64_t flags) +{ + return fi_no_bind(ep_fid, bfid, flags); +} + +static int xxx_ep_ctrl(struct fid *ep_fid, int command, void *arg) +{ + return fi_no_control(ep_fid, command, arg); +} + +static int xxx_ops_open(struct fid *fid, const char *name, uint64_t flags, + void **ops, void *context) +{ + return fi_no_ops_open(fid, name, flags, ops, context); +} + +static struct fi_ops xxx_ep_fi_ops = { + .size = sizeof(struct fi_ops), + .close = xxx_ep_close, + .bind = xxx_ep_bind, + .control = xxx_ep_ctrl, + .ops_open = xxx_ops_open, + .tostr = fi_no_tostr, + .ops_set = fi_no_ops_set +}; + +int xxx_endpoint(struct fid_domain *domain, struct fi_info *info, + struct fid_ep **ep_fid, void *context) +{ + return fi_no_endpoint(domain, info, ep_fid, context); +} + +int xxx_sep_open(struct fid_domain *domain, struct fi_info *info, + struct fid_ep **sep, void *context) +{ + return fi_no_scalable_ep(domain, info, sep, context); +} \ No newline at end of file diff --git a/prov/xxx/xxx_fabric.c b/prov/xxx/xxx_fabric.c index 0db4b97c423..64fec2caedc 100644 --- a/prov/xxx/xxx_fabric.c +++ b/prov/xxx/xxx_fabric.c @@ -30,8 +30,58 @@ * SOFTWARE. */ +#include "xxx.h" + +static int xxx_wait_open(struct fid_fabric *fabric_fid, + struct fi_wait_attr *attr, + struct fid_wait **waitset) +{ + return fi_no_wait_open(fabric, attr, waitset); +} + +static struct fi_ops_fabric xxx_fabric_ops = { + .size = sizeof(struct fi_ops_fabric), + .domain = xxx_domain_open, + .passive_ep = xxx_passive_ep, + .eq_open = xxx_eq_create, + .wait_open = xxx_wait_open, + .trywait = xxx_trywait +}; + +static int xxx_fabric_close(fid_t fid) +{ + return -FI_ENOSYS; +} + +static int xxx_bind(struct fid *fid, struct fid *bfid, uint64_t flags) +{ + return fi_no_bind(fid, bfid, flags); +} + +static int xxx_control(struct fid *fid, int command, void *arg) +{ + return fi_no_control(fid, command, arg); +} + +static int xxx_ops_open(struct fid *fid, const char *name, uint64_t flags, + void **ops, void *context) +{ + return fi_no_ops_open(fid, name, flags, ops, context); +} + +static struct fi_ops xxx_fabric_fi_ops = { + .size = sizeof(struct fi_ops), + .close = xxx_fabric_close, + .bind = xxx_bind, + .control = xxx_control, + .ops_open = xxx_ops_open, + .tostr = fi_no_tostr, + .ops_set = fi_no_ops_set +}; + int xxx_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context) { return -FI_ENOSYS; -} \ No newline at end of file +} + diff --git a/prov/xxx/xxx_init.c b/prov/xxx/xxx_init.c index 77ccfb787e8..0d9b5384524 100644 --- a/prov/xxx/xxx_init.c +++ b/prov/xxx/xxx_init.c @@ -58,8 +58,15 @@ struct fi_provider xxx_prov = { .cleanup = xxx_fini, }; +struct util_prov xxx_util_prov = { + .prov = &xxx_prov, + .info = &xxx_info, + .flags = 0 +}; + /* TODO: Add macro include/ofi_prov.h */ XXX_INI { return &xxx_prov; } +