Skip to content

bugfix: add calculation of mm_embedding size in shm manager.#1298

Open
shan-chen-feng wants to merge 2 commits intojd-opensource:mainfrom
shan-chen-feng:mm_embedding_bug_fix
Open

bugfix: add calculation of mm_embedding size in shm manager.#1298
shan-chen-feng wants to merge 2 commits intojd-opensource:mainfrom
shan-chen-feng:mm_embedding_bug_fix

Conversation

@shan-chen-feng
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the serialization and size calculation for DiT forward outputs by replacing specialized functions with a generic get_vector_tensor_size helper and standard vector tensor utilities. It also updates the vector size header from uint64_t to int32_t. A review comment identifies that the new get_vector_tensor_size function should be placed in an anonymous namespace to comply with the repository's style guide regarding file-local functions.

inline size_t get_dit_forward_output_size(const DiTForwardOutput& output) {
size_t size = type_size<uint64_t>; // vector size
for (const auto& tensor : output.tensors) {
inline size_t get_vector_tensor_size(
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.

high

According to the repository style guide (Rule 177), file-local functions used only within a single .cpp file must be placed in an anonymous namespace to ensure internal linkage and avoid potential symbol collisions. Since get_vector_tensor_size is not declared in the header file, it should be moved into an anonymous namespace.

References
  1. File-local functions and variables (used only within a single .cpp file) must be placed in an anonymous namespace. (link)

} else {
sample_output.embeddings = embeddings;
output.sample_output = sample_output;
output.embedding = embeddings;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we remove the output.embedding = embeddings ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants