Commit e518cb4c authored by Rob Latham's avatar Rob Latham
Browse files

Configure check for (need for) header padding



Dancing around with various schemes to detect/deal-with compiler padding
in structs so the 'payload' field ends up double-aligned.  The new
"large type , large count" work introduced a pointer into the nemisis
packet, so we have to be a bit more dynamic about how or if we pad out
the structure.

- put the members of MPID_nem_pkt_header inside a struct, so subsequent
  payload does not "fall into" compiler-introduced padding
- use this updated datatype to determine the size, and if we need to pad
  or not.
- use the result of the configure test to introduce padding, or omit the
  padding from the definition if the amount of padding is '0'
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@mcs.anl.gov>
parent d1bf4161
......@@ -144,20 +144,14 @@
#define MPID_NEM_MPICH_HEAD_LEN sizeof(MPID_nem_pkt_header_t)
#define MPID_NEM_MPICH_DATA_LEN (MPID_NEM_CELL_PAYLOAD_LEN - MPID_NEM_MPICH_HEAD_LEN)
#define MPID_NEM_PKT_HEADER_FIELDS \
int source; \
int dest; \
MPIDI_msg_sz_t datalen; \
unsigned short seqno; \
unsigned short type /* currently used only with checkpointing */
typedef struct MPID_nem_pkt_header
{
MPID_NEM_PKT_HEADER_FIELDS;
} MPID_nem_pkt_header_t;
#include "mpid_nem_pkt_header.h"
typedef struct MPID_nem_pkt_mpich
{
MPID_NEM_PKT_HEADER_FIELDS;
#if (MPID_NEM_PKT_HEADER_PADDING > 0)
char padding[MPID_NEM_PKT_HEADER_PADDING];
#endif
char payload[MPID_NEM_MPICH_DATA_LEN];
} MPID_nem_pkt_mpich_t;
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2013 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef MPID_NEM_PKT_HEADER_H
#define MPID_NEM_PKT_HEADER_H
#define MPID_NEM_PKT_HEADER_FIELDS \
struct { \
int source; \
int dest; \
MPIR_Pint datalen; \
unsigned short seqno; \
unsigned short type; /* currently used only with checkpointing */ \
};
typedef struct MPID_nem_pkt_header
{
MPID_NEM_PKT_HEADER_FIELDS;
} MPID_nem_pkt_header_t;
#endif /* MPID_NEM_DATATYPES_H */
......@@ -319,6 +319,23 @@ if test "$enable_nemesis_lock_free_queues" = "yes" ; then
AC_DEFINE(MPID_NEM_USE_LOCK_FREE_QUEUES, 1, [Define to enable lock-free communication queues])
fi
# for nemisis header alignment, will need to know how this structure laid out:
AC_CHECK_SIZEOF(MPID_nem_pkt_header_t, 0, [
typedef $MPI_PINT MPIR_Pint;
#include "${master_top_srcdir}/src/mpid/ch3/channels/nemesis/include/mpid_nem_pkt_header.h"])
AC_CHECK_ALIGNOF(MPID_nem_pkt_header_t, [
typedef $MPI_PINT MPIR_Pint;
#include "${master_top_srcdir}/src/mpid/ch3/channels/nemesis/include/mpid_nem_pkt_header.h"])
# We're trying to get 'payload' to live at a double-aligned memory address
AS_VAR_ARITH([mpid_pkt_header_padding],
[ $ac_cv_alignof_MPID_nem_pkt_header_t % $ac_cv_sizeof_double])
AC_DEFINE_UNQUOTED(MPID_NEM_PKT_HEADER_PADDING, [$mpid_pkt_header_padding], [Amount of padding needed in the MPID_nem_pkt_header_t structure])
AC_SUBST(device_name)
AC_SUBST(channel_name)
AC_SUBST(nemesis_networks)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment