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

prov/peer: Move coll_domain to peer_domain #5

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ common_srcs = \
prov/util/src/rocr_mem_monitor.c \
prov/util/src/ze_mem_monitor.c \
prov/util/src/cuda_ipc_monitor.c \
prov/peer/src/peer_domain.c \
prov/coll/src/coll_attr.c \
prov/coll/src/coll_av.c \
prov/coll/src/coll_av_set.c \
prov/coll/src/coll_coll.c \
prov/coll/src/coll_cq.c \
prov/coll/src/coll_domain.c \
prov/coll/src/coll_ep.c \
prov/coll/src/coll_eq.c \
prov/coll/src/coll_fabric.c \
Expand Down
46 changes: 46 additions & 0 deletions include/ofi_peer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 Intel Corporation, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* 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.
*/

#ifndef _OFI_PEER_H_
#define _OFI_PEER_H_

#include <ofi_util.h>

struct peer_domain {
struct util_domain util_domain;
struct fid_domain *peer_domain;
};

int ofi_peer_domain_open2(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **dom, uint64_t flags, void *context);

#endif /* _OFI_PEER_H_ */
10 changes: 1 addition & 9 deletions prov/coll/src/coll.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ enum {
COLL_TX_SIZE = 16384,
};

struct coll_domain {
struct util_domain util_domain;
struct fid_domain *peer_domain;
};

struct coll_av {
struct util_av util_av;
struct fid_peer_av *peer_av;
Expand Down Expand Up @@ -106,7 +101,7 @@ struct coll_ep {
struct coll_mr {
struct fid_mr mr_fid;
struct fid_mr *msg_mr;
struct coll_domain *domain;
struct peer_domain *domain;
enum fi_hmem_iface iface;
uint64_t device;
ofi_mutex_t amo_lock;
Expand All @@ -132,9 +127,6 @@ extern struct fi_info coll_info;
int coll_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric,
void *context);

int coll_domain_open2(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **dom, uint64_t flags, void *context);

int coll_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, void *context);

Expand Down
3 changes: 2 additions & 1 deletion prov/coll/src/coll_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* SOFTWARE.
*/

#include "ofi_peer.h"
#include "coll.h"
#include "ofi_coll.h"

Expand Down Expand Up @@ -1263,7 +1264,7 @@ int coll_query_collective(struct fid_domain *dom_fid,
struct fi_collective_attr *attr, uint64_t flags)
{
int ret;
struct coll_domain *domain = container_of(dom_fid, struct coll_domain,
struct peer_domain *domain = container_of(dom_fid, struct peer_domain,
util_domain.domain_fid);
struct fid_domain *peer_domain = domain->peer_domain;

Expand Down
3 changes: 2 additions & 1 deletion prov/coll/src/coll_fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* SOFTWARE.
*/

#include "ofi_peer.h"
#include "coll.h"

static struct fi_ops_fabric coll_fabric_ops = {
Expand All @@ -39,7 +40,7 @@ static struct fi_ops_fabric coll_fabric_ops = {
.eq_open = coll_eq_open,
.wait_open = ofi_wait_fd_open,
.trywait = ofi_trywait,
.domain2 = coll_domain_open2,
.domain2 = ofi_peer_domain_open2,
};

static int coll_fabric_close(fid_t fid)
Expand Down
28 changes: 15 additions & 13 deletions prov/coll/src/coll_domain.c → prov/peer/src/peer_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
* SOFTWARE.
*/

#include "coll.h"
#include "ofi_peer.h"
/* for coll_av_open, coll_endpoint and coll_query_collective */
#include "../../coll/src/coll.h"

static struct fi_ops_domain coll_domain_ops = {
static struct fi_ops_domain peer_domain_ops = {
.size = sizeof(struct fi_ops_domain),
.av_open = coll_av_open,
.cq_open = coll_cq_open,
Expand All @@ -47,12 +49,12 @@ static struct fi_ops_domain coll_domain_ops = {
.endpoint2 = fi_no_endpoint2,
};

static int coll_domain_close(fid_t fid)
static int peer_domain_close(fid_t fid)
{
struct coll_domain *domain;
struct peer_domain *domain;
int ret;

domain = container_of(fid, struct coll_domain, util_domain.domain_fid.fid);
domain = container_of(fid, struct peer_domain, util_domain.domain_fid.fid);

ret = ofi_domain_close(&domain->util_domain);
if (ret)
Expand All @@ -62,26 +64,26 @@ static int coll_domain_close(fid_t fid)
return 0;
}

static struct fi_ops coll_domain_fi_ops = {
static struct fi_ops peer_domain_fi_ops = {
.size = sizeof(struct fi_ops),
.close = coll_domain_close,
.close = peer_domain_close,
.bind = fi_no_bind,
.control = fi_no_control,
.ops_open = fi_no_ops_open,
};

static struct fi_ops_mr coll_domain_mr_ops = {
static struct fi_ops_mr peer_domain_mr_ops = {
.size = sizeof(struct fi_ops_mr),
.reg = fi_no_mr_reg,
.regv = fi_no_mr_regv,
.regattr = fi_no_mr_regattr,
};

int coll_domain_open2(struct fid_fabric *fabric, struct fi_info *info,
int ofi_peer_domain_open2(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **domain_fid, uint64_t flags,
void *context)
{
struct coll_domain *domain;
struct peer_domain *domain;
struct fi_peer_domain_context *peer_context = context;
int ret;

Expand Down Expand Up @@ -109,9 +111,9 @@ int coll_domain_open2(struct fid_fabric *fabric, struct fi_info *info,
goto err;

*domain_fid = &domain->util_domain.domain_fid;
(*domain_fid)->fid.ops = &coll_domain_fi_ops;
(*domain_fid)->ops = &coll_domain_ops;
(*domain_fid)->mr = &coll_domain_mr_ops;
(*domain_fid)->fid.ops = &peer_domain_fi_ops;
(*domain_fid)->ops = &peer_domain_ops;
(*domain_fid)->mr = &peer_domain_mr_ops;
return 0;

err:
Expand Down