Skip to content

Commit 25dd2e8

Browse files
committed
pack external32 long double conversion (extended 80 / quad 128)
On architectures that store long doubles as 80 bit extended precisions we need conversions to 128 bit quad precision. 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. 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_pack/unpack. I have my own conversions I could also contribute, and a rough list of differences/tradeoffs between our code is: dalcini's: operates on 32-bits at a time, is probably faster only works if the machine's endianness matches the data being converted mine: operates on chars, is probably slower doesn't care what endianness the data is in But since we're doing multiple conversions, it's possible to order the conversions in such a way that dalcini's code always gets to operate on data in local-machine-endianness format, so that's what this commit is doing. 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. Signed-off-by: Mark Allen <[email protected]>
1 parent 0e76855 commit 25dd2e8

5 files changed

+450
-67
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)