@@ -464,20 +464,18 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
464
464
executable, rpc_client_symbol_name, &dev_agent, &rpc_client_sym))
465
465
handle_error (err);
466
466
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
+
467
473
void *rpc_client_dev;
468
474
if (hsa_status_t err = hsa_executable_symbol_get_info (
469
475
rpc_client_sym, HSA_EXECUTABLE_SYMBOL_INFO_VARIABLE_ADDRESS,
470
476
&rpc_client_dev))
471
477
handle_error (err);
472
478
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
-
481
479
// Copy the address of the client buffer from the device to the host.
482
480
if (hsa_status_t err = hsa_memcpy (rpc_client_host, host_agent, rpc_client_dev,
483
481
dev_agent, sizeof (void *)))
@@ -499,9 +497,8 @@ int load(int argc, char **argv, char **envp, void *image, size_t size,
499
497
if (hsa_status_t err = hsa_amd_memory_unlock (
500
498
const_cast <void *>(rpc_get_client_buffer (device_id))))
501
499
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))
503
501
handle_error (err);
504
- free (rpc_client_storage);
505
502
506
503
// Obtain the GPU's fixed-frequency clock rate and copy it to the GPU.
507
504
// If the clock_freq symbol is missing, no work to do.
0 commit comments