aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2023-12-01 13:02:29 -0600
committerJoseph Huber <huberjn@outlook.com>2023-12-01 13:04:49 -0600
commit8c1d476db0ac73df44b1b9db66fdac45473dea68 (patch)
tree199883745c5274385391acc489b2410a3c2af419
parentaa7e873f2f52938ffa4d4711dbe494feb49535c8 (diff)
downloadllvm-8c1d476db0ac73df44b1b9db66fdac45473dea68.zip
llvm-8c1d476db0ac73df44b1b9db66fdac45473dea68.tar.gz
llvm-8c1d476db0ac73df44b1b9db66fdac45473dea68.tar.bz2
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 8bea804923a1b028e86b177caccb3258708ca01c. This reverts commit e1395c7bdbe74b632ba7fbd90e2be2b4d82ee09e.
-rw-r--r--libc/utils/gpu/loader/amdgpu/Loader.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/Loader.cpp
index 61b86bc..5c28607 100644
--- a/libc/utils/gpu/loader/amdgpu/Loader.cpp
+++ b/libc/utils/gpu/loader/amdgpu/Loader.cpp
@@ -464,20 +464,18 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
executable, rpc_client_symbol_name, &dev_agent, &rpc_client_sym))
handle_error(err);
+ void *rpc_client_host;
+ if (hsa_status_t err =
+ hsa_amd_memory_pool_allocate(coarsegrained_pool, sizeof(void *),
+ /*flags=*/0, &rpc_client_host))
+ handle_error(err);
+
void *rpc_client_dev;
if (hsa_status_t err = hsa_executable_symbol_get_info(
rpc_client_sym, HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS,
&rpc_client_dev))
handle_error(err);
- // Pin some memory we can use to obtain the address of the rpc client.
- void *rpc_client_storage = malloc(sizeof(void *));
- void *rpc_client_host = nullptr;
- if (hsa_status_t err =
- hsa_amd_memory_lock(rpc_client_storage, sizeof(void *),
- /*agents=*/nullptr, 0, &rpc_client_host))
- handle_error(err);
-
// Copy the address of the client buffer from the device to the host.
if (hsa_status_t err = hsa_memcpy(rpc_client_host, host_agent, rpc_client_dev,
dev_agent, sizeof(void *)))
@@ -499,9 +497,8 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
if (hsa_status_t err = hsa_amd_memory_unlock(
const_cast<void *>(rpc_get_client_buffer(device_id))))
handle_error(err);
- if (hsa_status_t err = hsa_amd_memory_unlock(rpc_client_host))
+ if (hsa_status_t err = hsa_amd_memory_pool_free(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.