Skip to content

[libc] Move the pointer to pin off the stack to the heap #74118

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

Merged
merged 5 commits into from
Dec 1, 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
5 changes: 3 additions & 2 deletions libc/utils/gpu/loader/amdgpu/Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
handle_error(err);

// Pin some memory we can use to obtain the address of the rpc client.
void *rpc_client_storage = nullptr;
void *rpc_client_storage = malloc(sizeof(void *));
void *rpc_client_host = nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably wrong that it used to be a void* and is now a void**, could that be why delete was a problem?

if (hsa_status_t err =
hsa_amd_memory_lock(&rpc_client_storage, sizeof(void *),
hsa_amd_memory_lock(rpc_client_storage, sizeof(void *),
/*agents=*/nullptr, 0, &rpc_client_host))
handle_error(err);

Expand All @@ -501,6 +501,7 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
handle_error(err);
if (hsa_status_t err = hsa_amd_memory_unlock(rpc_client_host))
handle_error(err);
free(rpc_client_storage);

// Obtain the GPU's fixed-frequency clock rate and copy it to the GPU.
// If the clock_freq symbol is missing, no work to do.
Expand Down