did some formatting

This commit is contained in:
ct-clmsn 2023-12-21 11:10:28 -05:00
parent 6d08baccea
commit ecf9c7983c

View file

@ -151,13 +151,21 @@ static void ggml_openshmem_tensor_send(struct ggml_openshmem_context * ctx, stru
} }
int64_t init_segments = (xmt_size / OPENSHMEM_SYMMETRIC_BUFFER_SIZE); int64_t init_segments = (xmt_size / OPENSHMEM_SYMMETRIC_BUFFER_SIZE);
int64_t xmt_amount [2] = { OPENSHMEM_SYMMETRIC_BUFFER_SIZE, xmt_size - (OPENSHMEM_SYMMETRIC_BUFFER_SIZE * init_segments) }; int64_t xmt_amount [2] = {
OPENSHMEM_SYMMETRIC_BUFFER_SIZE,
xmt_size - (OPENSHMEM_SYMMETRIC_BUFFER_SIZE * init_segments)
};
int64_t xmt_byte_offset = 0; int64_t xmt_byte_offset = 0;
int64_t xmt_byte_amount = 0; int64_t xmt_byte_amount = 0;
const int64_t total_loop_count = init_segments + !( xmt_amount[1] < 1); const int64_t total_loop_count =
init_segments + !( xmt_amount[1] < 1);
memcpy(dst_symmetric_comm_offset, &total_loop_count, sizeof(int64_t)); memcpy(
dst_symmetric_comm_offset,
&total_loop_count,
sizeof(int64_t)
);
shmem_int64_put_signal( shmem_int64_put_signal(
dst_symmetric_comm_offset, dst_symmetric_comm_offset,
@ -227,14 +235,30 @@ static void ggml_openshmem_tensor_recv(struct ggml_openshmem_context * ctx, stru
int64_t total_loop_count = 0; int64_t total_loop_count = 0;
shmem_wait_until(my_recv_signal, SHMEM_CMP_EQ, 1); shmem_wait_until(
my_recv_signal,
SHMEM_CMP_EQ,
1
);
(*my_recv_signal) = 0; (*my_recv_signal) = 0;
memcpy(src_symmetric_comm_offset, &total_loop_count, sizeof(int64_t)); memcpy(src_symmetric_comm_offset, &total_loop_count, sizeof(int64_t));
shmem_uint8_put_signal(src_symmetric_comm_structure, src_symmetric_comm_structure, 0, src_recv_signal, 1, SHMEM_SIGNAL_SET, src_pe); shmem_uint8_put_signal(
src_symmetric_comm_structure,
src_symmetric_comm_structure,
0,
src_recv_signal,
1,
SHMEM_SIGNAL_SET,
src_pe
);
for(int32_t i = 0; i < total_loop_count; ++i) { for(int32_t i = 0; i < total_loop_count; ++i) {
shmem_wait_until(my_recv_signal, SHMEM_CMP_EQ, 1); shmem_wait_until(
my_recv_signal,
SHMEM_CMP_EQ,
1
);
(*my_recv_signal) = 0; (*my_recv_signal) = 0;
memcpy( memcpy(
@ -243,7 +267,15 @@ static void ggml_openshmem_tensor_recv(struct ggml_openshmem_context * ctx, stru
(*src_symmetric_comm_length) (*src_symmetric_comm_length)
); );
shmem_uint8_put_signal(src_symmetric_comm_structure, src_symmetric_comm_structure, 0, src_recv_signal, 1, SHMEM_SIGNAL_SET, src_pe); shmem_uint8_put_signal(
src_symmetric_comm_structure,
src_symmetric_comm_structure,
0,
src_recv_signal,
1,
SHMEM_SIGNAL_SET,
src_pe
);
} }
shmem_fence(); shmem_fence();