diff options
author | Neil Fortner <fortnern@gmail.com> | 2023-08-24 17:44:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-24 17:44:34 (GMT) |
commit | 8063108578873e512c4e5432955086c0bb04b878 (patch) | |
tree | 01fdb382d20a856ea9af1a0aa3d39476d6c2863d | |
parent | 0a0245d171ab1cd36991c6912c993cf033d83a6f (diff) | |
download | hdf5-8063108578873e512c4e5432955086c0bb04b878.zip hdf5-8063108578873e512c4e5432955086c0bb04b878.tar.gz hdf5-8063108578873e512c4e5432955086c0bb04b878.tar.bz2 |
Fix possible performance regression introduced with in-place type conversion in 1.14.2 (#3424)
* Fix possible performance regression introduced with in-place type conversion in 1.14.2 (#3376)
* Add RELEASE.txt entry for compound performance regression fix (#3376) (#3416)
* Fix errors in release notes from forgetting to hit save.
-rw-r--r-- | release_docs/RELEASE.txt | 12 | ||||
-rw-r--r-- | src/H5Dscatgath.c | 20 |
2 files changed, 31 insertions, 1 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a083c13..40faff6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -109,7 +109,17 @@ Bug Fixes since HDF5-1.14.2 release =================================== Library ------- - - + - Fixed performance regression with some compound type conversions + + In-place type conversion was introduced for most use cases in 1.14.2. + While being able to use the read buffer for type conversion potentially + improves performance by performing the entire I/O at once, it also + disables the optimized compound type conversion used when the destination + is a subset of the source. Disabled in-place type conversion when using + this optimized conversion and there is no benefit in terms of the I/O + size. + + - Fixed an assertion in a previous fix for CVE-2016-4332 Java Library diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index cf6b4fd..4516f1f 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -478,6 +478,16 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_ in_place_tconv = dset_info->layout_io_info.contig_piece_info && dset_info->layout_io_info.contig_piece_info->in_place_tconv; + /* Check if we should disable in-place type conversion for performance. Do so if we can use the optimized + * compound read function, if this is not a selection I/O operation (so we have normal size conversion + * buffers), and the either entire I/O operation can fit in the type conversion buffer or we need to use a + * background buffer (and therefore could not do the I/O in one operation with in-place conversion + * anyways). */ + if (in_place_tconv && H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, FALSE) && + (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON) && + (dset_info->type_info.need_bkg || (dset_info->nelmts <= dset_info->type_info.request_nelmts))) + in_place_tconv = FALSE; + /* Allocate the iterators */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); @@ -653,6 +663,16 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset in_place_tconv = dset_info->layout_io_info.contig_piece_info && dset_info->layout_io_info.contig_piece_info->in_place_tconv; + /* Check if we should disable in-place type conversion for performance. Do so if we can use the optimized + * compound write function, if this is not a selection I/O operation (so we have normal size conversion + * buffers), and the either entire I/O operation can fit in the type conversion buffer or we need to use a + * background buffer (and therefore could not do the I/O in one operation with in-place conversion + * anyways). */ + if (in_place_tconv && H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, FALSE) && + (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON) && + (dset_info->type_info.need_bkg || (dset_info->nelmts <= dset_info->type_info.request_nelmts))) + in_place_tconv = FALSE; + /* Allocate the iterators */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); |