btl: add support for more atomics
This commit add support for more atomic operations and type. The operations added are logical and, logical or, logical xor, swap, min, and max. New types are 32-bit int by using the MCA_BTL_ATOMIC_FLAG_32BIT flag, 64-bit float by using the MCA_BTL_ATOMIC_FLAG_FLOAT flag, and 32-bit float by using both flags. Floating point numbers are supported by packing the number in as an int64_t or int32_t. We will update the btl interface in the future to make this less confusing. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
ce783a9ebf
Коммит
23fe19a956
@ -61,6 +61,12 @@ mca_base_var_enum_value_flag_t mca_btl_base_atomic_enum_flags[] = {
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_AND, "and", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_OR, "or", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_XOR, "xor", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_LAND, "land", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_LOR, "lor", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_LXOR, "lxor", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_SWAP, "swap", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_MIN, "min", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_MAX, "max", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_CSWAP, "compare-and-swap", 0},
|
||||
{MCA_BTL_ATOMIC_SUPPORTS_GLOB, "global"},
|
||||
{0, NULL, 0}
|
||||
|
@ -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-2015 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2006-2016 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.
|
||||
@ -293,10 +293,44 @@ enum {
|
||||
MCA_BTL_ATOMIC_SUPPORTS_OR = 0x00000400,
|
||||
/** The btl supports atomic bitwise exclusive or */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_XOR = 0x00000800,
|
||||
|
||||
/** The btl supports logical and */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_LAND = 0x00001000,
|
||||
/** The btl supports logical or */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_LOR = 0x00002000,
|
||||
/** The btl supports logical exclusive or */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_LXOR = 0x00004000,
|
||||
|
||||
/** The btl supports atomic swap */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_SWAP = 0x00010000,
|
||||
|
||||
/** The btl supports atomic min */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_MIN = 0x00100000,
|
||||
/** The btl supports atomic min */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_MAX = 0x00200000,
|
||||
|
||||
/** The btl supports atomic compare-and-swap */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_CSWAP = 0x10000000,
|
||||
|
||||
/** The btl guarantees global atomicity (can mix btl atomics with cpu atomics) */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_GLOB = 0x20000000,
|
||||
|
||||
|
||||
/** The btl supports 32-bit integer operations. Keep in mind the btl may
|
||||
* support only a subset of the available atomics. */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_32BIT = 0x40000000,
|
||||
|
||||
/** The btl supports floating-point operations. Keep in mind the btl may
|
||||
* support only a subset of the available atomics and may not support
|
||||
* both 64 or 32-bit floating point. */
|
||||
MCA_BTL_ATOMIC_SUPPORTS_FLOAT = 0x80000000,
|
||||
};
|
||||
|
||||
enum {
|
||||
/** Use 32-bit atomics */
|
||||
MCA_BTL_ATOMIC_FLAG_32BIT = 0x00000001,
|
||||
/** Use floating-point atomics */
|
||||
MCA_BTL_ATOMIC_FLAG_FLOAT = 0x00000002,
|
||||
};
|
||||
|
||||
enum mca_btl_base_atomic_op_t {
|
||||
@ -308,6 +342,20 @@ enum mca_btl_base_atomic_op_t {
|
||||
MCA_BTL_ATOMIC_OR = 0x0012,
|
||||
/** Atomic xor: (*remote_address) = (*remote_address) ^ operand */
|
||||
MCA_BTL_ATOMIC_XOR = 0x0014,
|
||||
/** Atomic logical and: (*remote_address) = (*remote_address) && operand */
|
||||
MCA_BTL_ATOMIC_LAND = 0x0015,
|
||||
/** Atomic logical or: (*remote_address) = (*remote_address) || operand */
|
||||
MCA_BTL_ATOMIC_LOR = 0x0016,
|
||||
/** Atomic logical xor: (*remote_address) = (*remote_address) != operand */
|
||||
MCA_BTL_ATOMIC_LXOR = 0x0017,
|
||||
/** Atomic swap: (*remote_address) = operand */
|
||||
MCA_BTL_ATOMIC_SWAP = 0x001a,
|
||||
/** Atomic min */
|
||||
MCA_BTL_ATOMIC_MIN = 0x0020,
|
||||
/** Atomic max */
|
||||
MCA_BTL_ATOMIC_MAX = 0x0021,
|
||||
|
||||
MCA_BTL_ATOMIC_LAST,
|
||||
};
|
||||
typedef enum mca_btl_base_atomic_op_t mca_btl_base_atomic_op_t;
|
||||
|
||||
@ -977,7 +1025,7 @@ typedef int (*mca_btl_base_module_get_fn_t) (struct mca_btl_base_module_t *btl,
|
||||
* (remote_address, remote_address + 8)
|
||||
* @param op (IN) Operation to perform
|
||||
* @param operand (IN) Operand for the operation
|
||||
* @param flags (IN) Flags for this put operation
|
||||
* @param flags (IN) Flags for this atomic operation
|
||||
* @param order (IN) Ordering
|
||||
* @param cbfunc (IN) Function to call on completion (if queued)
|
||||
* @param cbcontext (IN) Context for the callback
|
||||
@ -1021,7 +1069,7 @@ typedef int (*mca_btl_base_module_atomic_op64_fn_t) (struct mca_btl_base_module_
|
||||
* (remote_address, remote_address + 8)
|
||||
* @param op (IN) Operation to perform
|
||||
* @param operand (IN) Operand for the operation
|
||||
* @param flags (IN) Flags for this put operation
|
||||
* @param flags (IN) Flags for this atomic operation
|
||||
* @param order (IN) Ordering
|
||||
* @param cbfunc (IN) Function to call on completion (if queued)
|
||||
* @param cbcontext (IN) Context for the callback
|
||||
@ -1067,7 +1115,7 @@ typedef int (*mca_btl_base_module_atomic_fop64_fn_t) (struct mca_btl_base_module
|
||||
* (remote_address, remote_address + 8)
|
||||
* @param compare (IN) Operand for the operation
|
||||
* @param value (IN) Value to store on success
|
||||
* @param flags (IN) Flags for this put operation
|
||||
* @param flags (IN) Flags for this atomic operation
|
||||
* @param order (IN) Ordering
|
||||
* @param cbfunc (IN) Function to call on completion (if queued)
|
||||
* @param cbcontext (IN) Context for the callback
|
||||
|
@ -112,7 +112,7 @@ int mca_btl_openib_atomic_fop (struct mca_btl_base_module_t *btl, struct mca_btl
|
||||
void *cbcontext, void *cbdata)
|
||||
{
|
||||
|
||||
if (OPAL_UNLIKELY(MCA_BTL_ATOMIC_ADD != op)) {
|
||||
if (OPAL_UNLIKELY(MCA_BTL_ATOMIC_ADD != op || (MCA_BTL_ATOMIC_FLAG_32BIT & flags))) {
|
||||
return OPAL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -128,6 +128,10 @@ int mca_btl_openib_atomic_cswap (struct mca_btl_base_module_t *btl, struct mca_b
|
||||
uint64_t value, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc,
|
||||
void *cbcontext, void *cbdata)
|
||||
{
|
||||
if (OPAL_UNLIKELY(MCA_BTL_ATOMIC_FLAG_32BIT & flags)) {
|
||||
return OPAL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return mca_btl_openib_atomic_internal (btl, endpoint, local_address, remote_address, local_handle,
|
||||
remote_handle, IBV_WR_ATOMIC_CMP_AND_SWP, compare, value,
|
||||
flags, order, cbfunc, cbcontext, cbdata);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user