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

Buffer allocation code could be put in separate function #10

Open
johnramsden opened this issue Oct 25, 2020 · 3 comments
Open

Buffer allocation code could be put in separate function #10

johnramsden opened this issue Oct 25, 2020 · 3 comments

Comments

@johnramsden
Copy link
Collaborator

A large part of populate_mram is dedicated to allocating and reallocating buffers. For readability and maintainability it should (or could) be put in a separate function which returns 0 if allocation was successful.

We could then focus on loading the dpu in populate_mram.

@nzarif
Copy link
Collaborator

nzarif commented Oct 28, 2020

What do you have in mind for the prototype of the function?

@johnramsden
Copy link
Collaborator Author

/**
 * @brief Allocate buffers
 * @param table_id   embedding table number.
 * @param nr_rows    number of rows of the embedding table
 * @param nr_cols    number of columns of the embedding table
 * @param table_data a pointer of the size nr_rows*nr_cols containing table's data
 * @return 0 on success, ENOMEM on allocation failure
 */
static int
alloc_buffers(uint32_t table_id, uint64_t nr_rows, uint64_t nr_cols, const int32_t *table_data);

@nzarif
Copy link
Collaborator

nzarif commented Oct 28, 2020

I see! so every time before calling populate_mram on each table this function will be called. So then populate_mram() will only be copying data to buffers and allocating dpus when needed and copying to dpus?

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

No branches or pull requests

2 participants