| 8524 | // ggml_compute_forward_concat |
| 8525 | |
| 8526 | static void ggml_compute_forward_concat_f32( |
| 8527 | const struct ggml_compute_params * params, |
| 8528 | const struct ggml_tensor * src0, |
| 8529 | const struct ggml_tensor * src1, |
| 8530 | struct ggml_tensor * dst) { |
| 8531 | |
| 8532 | if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) { |
| 8533 | return; |
| 8534 | } |
| 8535 | |
| 8536 | GGML_ASSERT(src0->nb[0] == sizeof(float)); |
| 8537 | |
| 8538 | const int ith = params->ith; |
| 8539 | |
| 8540 | GGML_TENSOR_BINARY_OP_LOCALS |
| 8541 | |
| 8542 | // TODO: support for transposed / permuted tensors |
| 8543 | GGML_ASSERT(nb0 == sizeof(float)); |
| 8544 | GGML_ASSERT(nb00 == sizeof(float)); |
| 8545 | GGML_ASSERT(nb10 == sizeof(float)); |
| 8546 | |
| 8547 | for (int i3 = 0; i3 < ne3; i3++) { |
| 8548 | for (int i2 = ith; i2 < ne2; i2++) { |
| 8549 | if (i2 < ne02) { // src0 |
| 8550 | for (int i1 = 0; i1 < ne1; i1++) { |
| 8551 | for (int i0 = 0; i0 < ne0; i0++) { |
| 8552 | const float * x = (float *)((char *) src0->data + i0 * nb00 + i1 * nb01 + i2 * nb02 + i3 * nb03); |
| 8553 | |
| 8554 | float * y = (float *)((char *)dst->data + i0 * nb0 + i1 * nb1 + i2 * nb2 + i3 * nb3); |
| 8555 | *y = *x; |
| 8556 | } |
| 8557 | } |
| 8558 | } // src1 |
| 8559 | else { |
| 8560 | for (int i1 = 0; i1 < ne1; i1++) { |
| 8561 | for (int i0 = 0; i0 < ne0; i0++) { |
| 8562 | const float * x = (float *)((char *) src1->data + i0 * nb10 + i1 * nb11 + (i2 - ne02) * nb12 + i3 * nb13); |
| 8563 | |
| 8564 | float * y = (float *)((char *)dst->data + i0 * nb0 + i1 * nb1 + i2 * nb2 + i3 * nb3); |
| 8565 | *y = *x; |
| 8566 | } |
| 8567 | } |
| 8568 | } |
| 8569 | } |
| 8570 | } |
| 8571 | } |
| 8572 | |
| 8573 | static void ggml_compute_forward_concat( |
| 8574 | const struct ggml_compute_params* params, |
no outgoing calls
no test coverage detected