Skip to content

Commit 2817bf5

Browse files
committed
pack external32 long double conversion (extended 80 / quad 128)
On architectures that store long doubles as 80 bit extended precisions or as 64 bit "float64"s, we need conversions to 128 bit quad precision to satisfy MPI_Pack_external/Unpack_external. I added a couple more arguments to pFunction to know what architecture the 'to' and 'from' buffers are. Previously we had architecture info 'local' and 'remote' but I don't know how to correlate local/remote with to/from without adding more arguments as I did. With the incresed information about the context, the conversion function can now convert the long double as needed. I'm using code Lisandro Dalcin contributed for the floating point conversions in f80_to_f128, f64_to_f128, f128_to_f80, and f128_to_f64. These conversion functions require the data to be in local endianness, but one of the sides in pack/unpack is always local so operations can be done in an order that allows the long double conversion to see the data in local endianness. I also added a path to use __float128 for the conversion for #ifdef HAVE___FLOAT128 as that ought to be the more reliable method than rolling our own bitwise conversions. The reason for all the arch.h changes is the former code was inconsistent as to how bits were labeled within a byte, and had masks like LONGISxx that didn't match the bits they were supposed to contain. Signed-off-by: Mark Allen <[email protected]>
1 parent 0e76855 commit 2817bf5

7 files changed

+619
-87
lines changed

opal/datatype/opal_convertor_internal.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
88
* Copyright (c) 2017 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
10+
* Copyright (c) 2021 IBM Corporation. All rights reserved.
1011
* $COPYRIGHT$
1112
*
1213
* Additional copyrights may follow
@@ -22,9 +23,12 @@
2223

2324
BEGIN_C_DECLS
2425

25-
typedef int32_t (*conversion_fct_t)(opal_convertor_t *pConvertor, uint32_t count, const void *from,
26-
size_t from_len, ptrdiff_t from_extent, void *to,
27-
size_t to_length, ptrdiff_t to_extent, ptrdiff_t *advance);
26+
typedef int32_t (*conversion_fct_t)(opal_convertor_t *pConvertor, uint32_t count,
27+
const void *from, size_t from_len,
28+
ptrdiff_t from_extent, uint32_t from_arch,
29+
void *to, size_t to_length,
30+
ptrdiff_t to_extent, uint32_t to_arch,
31+
ptrdiff_t *advance);
2832

2933
typedef struct opal_convertor_master_t {
3034
struct opal_convertor_master_t *next;

opal/datatype/opal_copy_functions.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* and Technology (RIST). All rights reserved.
99
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
1010
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
11+
* Copyright (c) 2021 IBM Corporation. All rights reserved.
1112
* $COPYRIGHT$
1213
*
1314
* Additional copyrights may follow
@@ -40,9 +41,10 @@
4041
* Return value: Number of elements of type TYPE copied
4142
*/
4243
#define COPY_TYPE(TYPENAME, TYPE, COUNT) \
43-
static int copy_##TYPENAME(opal_convertor_t *pConvertor, size_t count, char *from, \
44-
size_t from_len, ptrdiff_t from_extent, char *to, size_t to_len, \
45-
ptrdiff_t to_extent, ptrdiff_t *advance) \
44+
static int copy_##TYPENAME(opal_convertor_t *pConvertor, size_t count, \
45+
char *from, size_t from_len, ptrdiff_t from_extent, uint32_t from_arch, \
46+
char *to, size_t to_len, ptrdiff_t to_extent, uint32_t to_arch, \
47+
ptrdiff_t *advance) \
4648
{ \
4749
size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \
4850
size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \
@@ -92,8 +94,8 @@
9294
*/
9395
#define COPY_CONTIGUOUS_BYTES(TYPENAME, COUNT) \
9496
static size_t copy_##TYPENAME##_##COUNT(opal_convertor_t *pConvertor, size_t count, \
95-
char *from, size_t from_len, ptrdiff_t from_extent, \
96-
char *to, size_t to_len, ptrdiff_t to_extent, \
97+
char *from, size_t from_len, ptrdiff_t from_extent, uint32_t from_arch, \
98+
char *to, size_t to_len, ptrdiff_t to_extent, uint32_t to_arch, \
9799
ptrdiff_t *advance) \
98100
{ \
99101
size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \

0 commit comments

Comments
 (0)