Skip to content

Commit 8c1d476

Browse files
committed
Revert "[libc] Explicitly pin memory for the client symbol lookup (#73988)"
Summary: This caused the bots to begin failing. Revert for now to get the bot green. This reverts commit 8bea804. This reverts commit e1395c7.
1 parent aa7e873 commit 8c1d476

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

libc/utils/gpu/loader/amdgpu/Loader.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,20 +464,18 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
464464
executable, rpc_client_symbol_name, &dev_agent, &rpc_client_sym))
465465
handle_error(err);
466466

467+
void *rpc_client_host;
468+
if (hsa_status_t err =
469+
hsa_amd_memory_pool_allocate(coarsegrained_pool, sizeof(void *),
470+
/*flags=*/0, &rpc_client_host))
471+
handle_error(err);
472+
467473
void *rpc_client_dev;
468474
if (hsa_status_t err = hsa_executable_symbol_get_info(
469475
rpc_client_sym, HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS,
470476
&rpc_client_dev))
471477
handle_error(err);
472478

473-
// Pin some memory we can use to obtain the address of the rpc client.
474-
void *rpc_client_storage = malloc(sizeof(void *));
475-
void *rpc_client_host = nullptr;
476-
if (hsa_status_t err =
477-
hsa_amd_memory_lock(rpc_client_storage, sizeof(void *),
478-
/*agents=*/nullptr, 0, &rpc_client_host))
479-
handle_error(err);
480-
481479
// Copy the address of the client buffer from the device to the host.
482480
if (hsa_status_t err = hsa_memcpy(rpc_client_host, host_agent, rpc_client_dev,
483481
dev_agent, sizeof(void *)))
@@ -499,9 +497,8 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
499497
if (hsa_status_t err = hsa_amd_memory_unlock(
500498
const_cast<void *>(rpc_get_client_buffer(device_id))))
501499
handle_error(err);
502-
if (hsa_status_t err = hsa_amd_memory_unlock(rpc_client_host))
500+
if (hsa_status_t err = hsa_amd_memory_pool_free(rpc_client_host))
503501
handle_error(err);
504-
free(rpc_client_storage);
505502

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

0 commit comments

Comments
 (0)