-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add cmake to the test app * Add neureka_v2 * Add NnxBuildFlow and CmakeBuildFlow * Use gcc toolchain for testing * Remove wmem validation from testconf and add it in NnxWeight
- Loading branch information
Showing
174 changed files
with
2,428 additions
and
420 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,14 @@ | ||
name: Test Neureka v2 | ||
on: push | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/pulp-platform/pulp-nnx:main-test | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run test | ||
shell: bash | ||
working-directory: test | ||
run: | | ||
pytest test.py -T tests -R -A neureka_v2 --build-flow=cmake --wmem=mram |
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
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,65 @@ | ||
/* | ||
* Luka Macan <[email protected]> | ||
* | ||
* Copyright 2023 ETH Zurich and University of Bologna | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "neureka_v2.h" | ||
#include "neureka_v2_siracusa_bsp.h" | ||
#include "neureka_v2_task.h" | ||
#include <stdint.h> | ||
|
||
/* PULP-NNX interface */ | ||
|
||
void neureka_v2_nnx_init(const neureka_v2_dev_t *dev, | ||
neureka_v2_siracusa_conf_t *conf); | ||
void neureka_v2_nnx_term(const neureka_v2_dev_t *dev); | ||
|
||
/** neureka_v2_nnx_dispatch_check | ||
* | ||
* Check whether you can dispatch to the accelerator. | ||
*/ | ||
int neureka_v2_nnx_dispatch_check(const neureka_v2_dev_t *dev); | ||
|
||
/** neureka_v2_nnx_dispatch_wait | ||
* | ||
* Block until you can dispatch to the accelerator. | ||
*/ | ||
void neureka_v2_nnx_dispatch_wait(const neureka_v2_dev_t *dev); | ||
|
||
/** neureka_v2_nnx_dispatch | ||
* | ||
* Dispatch a task to the accelerator. | ||
* Fails with return code 1 if the task cannot be dispatched. Otherwise returns | ||
* 0. | ||
*/ | ||
int neureka_v2_nnx_dispatch(const neureka_v2_dev_t *dev, | ||
neureka_v2_task_t *task); | ||
|
||
/** neureka_v2_nnx_resolve_check | ||
* | ||
* Check whether the task has been resolved. | ||
*/ | ||
int neureka_v2_nnx_resolve_check(const neureka_v2_dev_t *dev, | ||
neureka_v2_task_t *task); | ||
|
||
/** neureka_v2_nnx_resolve_wait | ||
* | ||
* Block until you can resolve the task. | ||
*/ | ||
void neureka_v2_nnx_resolve_wait(const neureka_v2_dev_t *dev, | ||
neureka_v2_task_t *task); |
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,37 @@ | ||
# Neureka v2 | ||
|
||
## Docs | ||
|
||
Gvsoc model repo [link](https://github.com/lukamac/gvsoc-pulp/tree/fix-vectorload). | ||
|
||
## Implemented features | ||
|
||
- [x] Convolution w/ kernel shape 1x1 | ||
- [x] Convolution w/ kernel shape 3x3 | ||
- [x] Depthwise convolution w/ kernel shape 3x3 | ||
- [ ] Normalization and quantization | ||
- [x] With | ||
- [ ] Without | ||
- [x] Relu (w/ and w/o) | ||
- [x] Bias (w/ and w/o) | ||
- [ ] Per-channel shift | ||
- [x] Per-layer shift | ||
- [x] Input type | ||
- [x] uint8 | ||
- [x] int8 | ||
- [x] Output type | ||
- [x] int8 | ||
- [x] uint8 (only w/ Relu) | ||
- [ ] int32 | ||
- [x] Scale type | ||
- [x] int8 | ||
- [ ] int32 | ||
- [x] Bias type | ||
- [x] int32 | ||
- [ ] Weight type | ||
- [x] int8 | ||
- [ ] int2-7 | ||
- [ ] Weight memory | ||
- [ ] Shared TCDM | ||
- [x] Private SRAM | ||
- [x] Private MRAM |
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,78 @@ | ||
/* | ||
* Luka Macan <[email protected]> | ||
* | ||
* Copyright 2023 ETH Zurich and University of Bologna | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "neureka_v2_siracusa_bsp.h" | ||
#include <pmsis.h> | ||
|
||
#define NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_BASE_ADDR (0x00200000) | ||
#define NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_OFFS 0x18 | ||
#define NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_ADDR \ | ||
(NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_BASE_ADDR + \ | ||
NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_OFFS) | ||
#define NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_PRIO 0x100 | ||
#define NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_MAXSTALL 0xff | ||
#define NEUREKA_V2_SIRACUSA_MAX_STALL (8) | ||
#define NEUREKA_V2_SIRACUSA_EVENT (1 << 12) | ||
#define NEUREKA_V2_SIRACUSA_BASE_ADDR (0x00201000) | ||
#define NEUREKA_V2_SIRACUSA_WEIGHT_MEM_BASE_ADDR (0x10400000) | ||
#define NEUREKA_V2_SIRACUSA_WEIGHT_MEM_MRAM_OFFSET (0x00000000) | ||
#define NEUREKA_V2_SIRACUSA_WEIGHT_MEM_SRAM_OFFSET (0x00400000) | ||
|
||
void neureka_v2_siracusa_hci_setpriority_neureka_v2() { | ||
*(volatile uint32_t *)NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_ADDR |= | ||
NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_PRIO; | ||
} | ||
|
||
void neureka_v2_siracusa_hci_setpriority_core() { | ||
*(volatile uint32_t *)NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_ADDR &= | ||
~NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_PRIO; | ||
} | ||
|
||
void neureka_v2_siracusa_hci_reset_max_stall() { | ||
*(volatile uint32_t *)NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_ADDR &= | ||
~NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_MAXSTALL; | ||
} | ||
|
||
void neureka_v2_siracusa_hci_set_max_stall(uint32_t max_stall) { | ||
*(volatile uint32_t *)NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_ADDR |= | ||
max_stall & NEUREKA_V2_SIRACUSA_CLUSTER_CTRL_HWPE_MASK_HCI_MAXSTALL; | ||
} | ||
|
||
void neureka_v2_siracusa_open(neureka_v2_siracusa_conf_t *conf) { | ||
neureka_v2_siracusa_hci_setpriority_neureka_v2(); | ||
neureka_v2_siracusa_hci_set_max_stall(conf->max_stall); | ||
} | ||
|
||
void neureka_v2_siracusa_close() { | ||
neureka_v2_siracusa_hci_reset_max_stall(); | ||
neureka_v2_siracusa_hci_setpriority_core(); | ||
} | ||
|
||
void neureka_v2_siracusa_event_wait_and_clear() { | ||
eu_evt_maskWaitAndClr(NEUREKA_V2_SIRACUSA_EVENT); | ||
} | ||
|
||
static const neureka_v2_dev_t neureka_v2_siracusa_dev = { | ||
.hwpe_dev = (struct hwpe_dev_t){ | ||
.base_addr = (volatile uint32_t *)NEUREKA_V2_SIRACUSA_BASE_ADDR}}; | ||
|
||
const neureka_v2_dev_t *neureka_v2_siracusa_get_dev() { | ||
return &neureka_v2_siracusa_dev; | ||
} |
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,67 @@ | ||
/* | ||
* Luka Macan <[email protected]> | ||
* | ||
* Copyright 2023 ETH Zurich and University of Bologna | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef __NEUREKA_V2_SIRACUSA_BSP_H__ | ||
#define __NEUREKA_V2_SIRACUSA_BSP_H__ | ||
|
||
#include "neureka_v2.h" | ||
#include <stdint.h> | ||
|
||
/** | ||
* neureka_v2_siracusa_setpriority_neureka_v2 | ||
* | ||
* Set HCI interconnect bus priority to prioritize neureka_v2. | ||
*/ | ||
void neureka_v2_siracusa_hci_setpriority_neureka_v2(); | ||
|
||
/** | ||
* neureka_v2_siracusa_setpriority_core | ||
* | ||
* Set HCI bus priority to prioritize cores. | ||
*/ | ||
void neureka_v2_siracusa_hci_setpriority_core(); | ||
|
||
/** | ||
* neureka_v2_siracusa_hci_reset_maxstall | ||
* | ||
* Reset the HCI bus maxstall parameter. | ||
* TODO: Check if it disables it also or just resets? | ||
*/ | ||
void neureka_v2_siracusa_hci_reset_max_stall(); | ||
|
||
/** | ||
* neureka_v2_siracusa_hci_set_maxstall | ||
* | ||
* Set the HCI bus maxstall. Maxstall defines how many cycles | ||
* will the HCI bus stall the lower priority master, i.e. neureka_v2 or core, | ||
* before letting it do a transaction. | ||
*/ | ||
void neureka_v2_siracusa_hci_set_max_stall(uint32_t max_stall); | ||
|
||
typedef struct neureka_v2_siracusa_conf_t { | ||
int max_stall; | ||
} neureka_v2_siracusa_conf_t; | ||
|
||
void neureka_v2_siracusa_open(neureka_v2_siracusa_conf_t *conf); | ||
void neureka_v2_siracusa_close(); | ||
void neureka_v2_siracusa_event_wait_and_clear(); | ||
const neureka_v2_dev_t *neureka_v2_siracusa_get_dev(); | ||
|
||
#endif // !__NEUREKA_V2_SIRACUSA_BSP_H__ |
Oops, something went wrong.