From 072a6a485095d6a8fd63afd678d9592243b5d931 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 7 Feb 2018 09:49:36 -0700 Subject: [PATCH] opal/btl: add support for flushing RDMA/atomic operations This commit adds a new optional function to the BTL module: btl_flush. This function takes an optional BTL endpoint. When called this function completes all outstanding RDMA and atomic operations started prior to the call to btl_flush. Signed-off-by: Nathan Hjelm --- opal/mca/btl/base/btl_base_frame.c | 3 ++- opal/mca/btl/base/btl_base_mca.c | 6 ++++- opal/mca/btl/btl.h | 38 ++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/opal/mca/btl/base/btl_base_frame.c b/opal/mca/btl/base/btl_base_frame.c index e1851ec6e5..857273bea1 100644 --- a/opal/mca/btl/base/btl_base_frame.c +++ b/opal/mca/btl/base/btl_base_frame.c @@ -14,7 +14,7 @@ * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -53,6 +53,7 @@ mca_base_var_enum_value_flag_t mca_btl_base_flag_enum_flags[] = { {MCA_BTL_FLAGS_NEED_ACK, "need-ack", 0}, {MCA_BTL_FLAGS_NEED_CSUM, "need-csum", 0}, {MCA_BTL_FLAGS_HETEROGENEOUS_RDMA, "hetero-rdma", 0}, + {MCA_BTL_FLAGS_RDMA_FLUSH, "rdma-flush", 0}, {0, NULL, 0} }; diff --git a/opal/mca/btl/base/btl_base_mca.c b/opal/mca/btl/base/btl_base_mca.c index fb59f0e816..c65c0a3b5c 100644 --- a/opal/mca/btl/base/btl_base_mca.c +++ b/opal/mca/btl/base/btl_base_mca.c @@ -14,7 +14,7 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights * reserved. * * $COPYRIGHT$ @@ -182,6 +182,10 @@ int mca_btl_base_param_verify(mca_btl_base_module_t *module) module->btl_flags &= ~MCA_BTL_FLAGS_GET; } + if (NULL == module->btl_flush) { + module->btl_flags &= ~MCA_BTL_FLAGS_RDMA_FLUSH; + } + if (0 == module->btl_atomic_flags) { module->btl_flags &= ~MCA_BTL_FLAGS_ATOMIC_OPS; } diff --git a/opal/mca/btl/btl.h b/opal/mca/btl/btl.h index 48564b573e..5f0e73b30c 100644 --- a/opal/mca/btl/btl.h +++ b/opal/mca/btl/btl.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012-2013 NVIDIA Corporation. All rights reserved. @@ -244,6 +244,9 @@ typedef uint8_t mca_btl_base_tag_t; /* The BTL is using progress thread and need the protection on matching */ #define MCA_BTL_FLAGS_BTL_PROGRESS_THREAD_ENABLED 0x40000 +/* The BTL supports RMDA flush */ +#define MCA_BTL_FLAGS_RDMA_FLUSH 0x80000 + /* Default exclusivity levels */ #define MCA_BTL_EXCLUSIVITY_HIGH (64*1024) /* internal loopback */ #define MCA_BTL_EXCLUSIVITY_DEFAULT 1024 /* GM/IB/etc. */ @@ -1164,6 +1167,20 @@ typedef void (*mca_btl_base_module_dump_fn_t)( */ typedef int (*mca_btl_base_module_ft_event_fn_t)(int state); +/** + * Flush all outstanding RDMA operations on an endpoint or all endpoints. + * + * @param btl (IN) BTL module + * @param endpoint (IN) Endpoint to flush (NULL == all) + * + * This function returns when all outstanding RDMA (put, get, atomic) operations + * that were started prior to the flush call have completed. This call does + * NOT guarantee that all BTL callbacks have been completed. + * + * The BTL is allowed to ignore the endpoint parameter and flush *all* endpoints. + */ +typedef int (*mca_btl_base_module_flush_fn_t) (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint); + /** * BTL module interface functions and attributes. */ @@ -1231,23 +1248,30 @@ struct mca_btl_base_module_t { #if OPAL_CUDA_SUPPORT size_t btl_cuda_max_send_size; /**< set if CUDA max send_size is different from host max send size */ #endif /* OPAL_CUDA_SUPPORT */ + + mca_btl_base_module_flush_fn_t btl_flush; /**< flush all previous operations on an endpoint */ + + unsigned char padding[256]; /**< padding to future-proof the btl module */ }; typedef struct mca_btl_base_module_t mca_btl_base_module_t; /* - * Macro for use in modules that are of type btl v3.0.0 - * NOTE: This is not the final version of 3.0.0. Consider it - * alpha until this comment is removed. + * Macro for use in modules that are of type btl v3.1.0 */ -#define MCA_BTL_BASE_VERSION_3_0_0 \ - OPAL_MCA_BASE_VERSION_2_1_0("btl", 3, 0, 0) +#define MCA_BTL_BASE_VERSION_3_1_0 \ + OPAL_MCA_BASE_VERSION_2_1_0("btl", 3, 1, 0) #define MCA_BTL_DEFAULT_VERSION(name) \ - MCA_BTL_BASE_VERSION_3_0_0, \ + MCA_BTL_BASE_VERSION_3_1_0, \ .mca_component_name = name, \ MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, \ OPAL_RELEASE_VERSION) +/** + * Convinience macro for detecting the BTL interface version. + */ +#define BTL_VERSION 310 + END_C_DECLS #endif /* OPAL_MCA_BTL_H */