Skip to content

Add init once memory (#3528)#3529

Merged
yoniko merged 3 commits into
facebook:devfrom
yoniko:init-once-memory-3528-part1
Mar 13, 2023
Merged

Add init once memory (#3528)#3529
yoniko merged 3 commits into
facebook:devfrom
yoniko:init-once-memory-3528-part1

Conversation

@yoniko

@yoniko yoniko commented Mar 7, 2023

Copy link
Copy Markdown
Contributor

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

yoniko commented Mar 7, 2023

Copy link
Copy Markdown
Contributor Author

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
Comment thread lib/compress/zstd_cwksp.h Outdated
if (ws->tableValidEnd < ws->tableEnd) {
ws->tableValidEnd = ws->tableEnd;
} } }
} } }

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread lib/compress/zstd_cwksp.h Outdated
* 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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread lib/compress/zstd_compress.c Outdated

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
Copy Markdown
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.

@yoniko yoniko Mar 9, 2023

Copy link
Copy Markdown
Contributor Author

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

yoniko commented Mar 9, 2023

Copy link
Copy Markdown
Contributor Author

@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