Skip to content

Conversation

@yoniko
Copy link
Contributor

@yoniko yoniko commented Mar 7, 2023

Part 1 of #3528

  • Adds memory type that is guaranteed to have been initialized at least once in the workspace's lifetime.
  • Changes tag space in row hash to be based on init once memory.
  • Unaligned buffers are now allocated after aligned buffers to allow aligned init once buffers to be allocated at the end of the workspace.

Update: now maintains the usage of unaligned buffers

@yoniko
Copy link
Contributor Author

yoniko commented Mar 7, 2023

Note: I explore reducing the scope of changes in this path by maintaining the buffer space.
Update: PR update to maintain buffer space.

@yoniko yoniko linked an issue Mar 8, 2023 that may be closed by this pull request
if (ws->tableValidEnd < ws->tableEnd) {
ws->tableValidEnd = ws->tableEnd;
} } }
} } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: doesn't seem to be the proper bracket alignment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* 2. Another initOnce buffer that has been allocated before (and so was previously memset)
* 3. An ASAN redzone, in which case we don't want to write on it
* For these reasons it should be fine to not explicitly zero every byte up to ws->initOnceStart.
* Note that we assume here tha MSAN and ASAN cannot run in the same time. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we assume here that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


if (ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)) {
/* Row match finder needs an additional table of hashes ("tags") */
size_t const tagTableSize = hSize * sizeof(U16);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate if we really need U16 space for the tags table.

Copy link
Contributor Author

@yoniko yoniko Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we need it

@yoniko
Copy link
Contributor Author

yoniko commented Mar 9, 2023

@Cyan4973 - see CR fixes

@yoniko yoniko force-pushed the init-once-memory-3528-part1 branch from baefad5 to 70d69dc Compare March 10, 2023 22:19
yoniko added 3 commits March 13, 2023 10:21
- Adds memory type that is guaranteed to have been initialized at least once in the workspace's lifetime.
- Changes tag space in row hash to be based on init once memory.
- Moves buffers to aligned memory and removes the buffer memory type.
@yoniko yoniko force-pushed the init-once-memory-3528-part1 branch from 70d69dc to f4aab97 Compare March 13, 2023 17:22
@yoniko yoniko merged commit 9420bce into facebook:dev Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Row hash tag space initialization speed regression

3 participants