-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[software] Add kernel for fixed-point q16 MIMO MMSE estimation
- Loading branch information
1 parent
734cd31
commit 8649ee5
Showing
23 changed files
with
1,266 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2021 ETH Zurich and University of Bologna. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Author: Marco Bertuletti, ETH Zurich | ||
|
||
#include "dma.h" | ||
#include "encoding.h" | ||
#include "printf.h" | ||
#include "runtime.h" | ||
#include "synchronization.h" | ||
#include "xpulp/builtins_v2.h" | ||
|
||
#include "data/data_cholesky_q16.h" | ||
#include "kernel/mempool_checks.h" | ||
#include "kernel/mempool_cholesky_q16s.h" | ||
|
||
#define SINGLE | ||
|
||
int16_t l1_GIn[2 * dim_N * dim_N * N_SAMPLES] | ||
__attribute__((section(".l1_prio"))); | ||
int16_t l1_LOut[2 * dim_N * dim_N * N_SAMPLES] | ||
__attribute__((section(".l1_prio"))); | ||
|
||
int main() { | ||
uint32_t core_id = mempool_get_core_id(); | ||
uint32_t num_cores = mempool_get_core_count(); | ||
mempool_barrier_init(core_id); // Initialize barrier and synchronize | ||
|
||
/* Initialize matrices */ | ||
if (core_id == 0) { | ||
dma_memcpy_blocking(l1_GIn, l2_GIn, | ||
dim_N * dim_N * N_SAMPLES * sizeof(int32_t)); | ||
dma_memcpy_blocking(l1_LOut, l2_LOut, | ||
dim_N * dim_N * N_SAMPLES * sizeof(int32_t)); | ||
} | ||
// Wait at barrier until everyone is ready | ||
mempool_barrier(num_cores); | ||
|
||
#ifdef SINGLE | ||
/* Benchmark */ | ||
if (core_id == 0) { | ||
mempool_start_benchmark(); | ||
mempool_cholesky_q16vecs((v2s *)l1_GIn, (v2s *)l1_LOut, dim_N); | ||
mempool_stop_benchmark(); | ||
} | ||
mempool_barrier(num_cores); | ||
#endif | ||
|
||
#ifdef PARALLEL | ||
for (uint32_t i = core_id; i < N_SAMPLES; i += num_cores) { | ||
mempool_start_benchmark(); | ||
__fp16 *ptr_in_matrix = l1_GIn + i * 2 * dim_N * dim_N; | ||
__fp16 *ptr_out_matrix = l1_LOut + i * 2 * dim_N * dim_N; | ||
mempool_cholesky_q16s((v2s *)ptr_in_matrix, (v2s *)ptr_out_matrix, dim_N); | ||
} | ||
mempool_barrier(num_cores); | ||
mempool_stop_benchmark(); | ||
#endif | ||
|
||
mempool_check_q16(l1_LOut, l2_LOut, 2 * dim_N * dim_N, 0.01f, 0); | ||
mempool_barrier(num_cores); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.