Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible performance regression introduced with in-place type conversion in 1.14.2 #3376

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/H5Dscatgath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down