Skip to content

Commit b712a14

Browse files
committed
[libc] Fix memory leak and accidentally ignoring dimensions in loader
Summary: The loader had a bug where we weren't setting the dimensions correctly, also I forgot to delete the paths for this RPC call.
1 parent 1a9569c commit b712a14

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libc/utils/gpu/loader/amdgpu/amdhsa-loader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ hsa_status_t launch_kernel(hsa_agent_t dev_agent, hsa_executable_t executable,
231231
std::memcpy(args, &kernel_args, sizeof(args_t));
232232

233233
// Initialize the necessary implicit arguments to the proper values.
234-
bool dims = 1 + (params.num_blocks_y * params.num_threads_y != 1) +
235-
(params.num_blocks_z * params.num_threads_z != 1);
234+
int dims = 1 + (params.num_blocks_y * params.num_threads_y != 1) +
235+
(params.num_blocks_z * params.num_threads_z != 1);
236236
implicit_args_t *implicit_args = reinterpret_cast<implicit_args_t *>(
237237
reinterpret_cast<uint8_t *>(args) + sizeof(args_t));
238238
implicit_args->grid_dims = dims;

libc/utils/gpu/server/rpc_server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ rpc_status_t handle_server_impl(
285285
FILE *file = fopen(reinterpret_cast<char *>(paths[id]),
286286
reinterpret_cast<char *>(buffer->data));
287287
buffer->data[0] = reinterpret_cast<uintptr_t>(file);
288+
delete[] reinterpret_cast<uint8_t *>(paths[id]);
288289
});
289290
break;
290291
}

0 commit comments

Comments
 (0)