Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/_runner-siracusa-redmule-tiled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: 2026 ETH Zurich and University of Bologna
#
# SPDX-License-Identifier: Apache-2.0

---
name: _runner-siracusa-redmule-tiled-sequential

"on":
workflow_call:
inputs:
runner:
required: true
type: string
docker-image:
required: true
type: string
pytest-marker:
required: true
type: string

jobs:
test-runner-siracusa-redmule-tiled:
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.docker-image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Mark workspace as safe
run: git config --global --add safe.directory '*'
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build Deeploy
shell: bash
run: pip install -e .
- name: Run Test
run: |
cd DeeployTest
mkdir -p /app/.ccache
export CCACHE_DIR=/app/.ccache
pytest test_platforms.py -v -n 4 -m "siracusa_redmule_tiled and ${{ inputs.pytest-marker }}"
shell: bash
7 changes: 7 additions & 0 deletions .github/workflows/ci-platform-gap9-tiled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ concurrency:
cancel-in-progress: true

jobs:
# GAP9 CI requires access to the private ghcr.io/pulp-platform/deeploy-gap9
# image; gate on upstream org so forks skip cleanly.
select-env:
if: github.repository_owner == 'pulp-platform'
uses: ./.github/workflows/_select-env.yml
with:
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || 'ghcr.io/pulp-platform/deeploy-gap9:devel' }}

gap9-kernels-tiled-singlebuffer-L2:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9-tiled.yml
with:
Expand All @@ -38,6 +42,7 @@ jobs:
pytest-markers: "gap9_tiled and kernels and singlebuffer and l2"

gap9-kernels-tiled-doublebuffer-L2:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9-tiled.yml
with:
Expand All @@ -46,6 +51,7 @@ jobs:
pytest-markers: "gap9_tiled and kernels and doublebuffer and l2"

gap9-models-tiled-singlebuffer-L2:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9-tiled.yml
with:
Expand All @@ -54,6 +60,7 @@ jobs:
pytest-markers: "gap9_tiled and models and singlebuffer and l2"

gap9-models-tiled-doublebuffer-L2:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9-tiled.yml
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci-platform-gap9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ concurrency:
cancel-in-progress: true

jobs:
# GAP9 CI requires access to the private ghcr.io/pulp-platform/deeploy-gap9
# image; gate on upstream org so forks skip cleanly.
select-env:
if: github.repository_owner == 'pulp-platform'
uses: ./.github/workflows/_select-env.yml
with:
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || 'ghcr.io/pulp-platform/deeploy-gap9:devel' }}

gap9-kernels:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9.yml
with:
Expand All @@ -39,6 +43,7 @@ jobs:
pytest-marker: "kernels"

gap9-models:
if: github.repository_owner == 'pulp-platform'
needs: select-env
uses: ./.github/workflows/_runner-gap9.yml
with:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/ci-platform-siracusa-redmule-tiled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2026 ETH Zurich and University of Bologna
#
# SPDX-License-Identifier: Apache-2.0

---
name: CI • Siracusa + RedMulE (Tiled)

"on":
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:
inputs:
docker_image_deeploy:
description: "Deeploy Image to use"
required: false
default: "ghcr.io/runwangdl/deeploy:redmule"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
select-env:
uses: ./.github/workflows/_select-env.yml
with:
# RedMulE CI needs the fork's custom Docker image that bundles a
# GVSoC build with the light_redmule model. Fall back to
# runwangdl/deeploy:redmule on push/PR events (when no input is
# provided) rather than the upstream devel image.
docker_image_deeploy: ${{ inputs.docker_image_deeploy || 'ghcr.io/runwangdl/deeploy:redmule' }}

siracusa-redmule-kernels-tiled-singlebuffer-L2:
needs: select-env
uses: ./.github/workflows/_runner-siracusa-redmule-tiled.yml
with:
runner: ${{ needs.select-env.outputs.runner }}
docker-image: ${{ needs.select-env.outputs.image }}
pytest-marker: "kernels and singlebuffer and l2"

siracusa-redmule-kernels-tiled-doublebuffer-L2:
needs: select-env
uses: ./.github/workflows/_runner-siracusa-redmule-tiled.yml
with:
runner: ${{ needs.select-env.outputs.runner }}
docker-image: ${{ needs.select-env.outputs.image }}
pytest-marker: "kernels and doublebuffer and l2"
4 changes: 2 additions & 2 deletions .github/workflows/infra-generate-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
sphinx-build docs _build
- name: Prepare Multipages
uses: xeratec/gh-pages-multibranch@pr/support_tags
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository_owner == 'pulp-platform' }}
with:
directory: _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch'}}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository_owner == 'pulp-platform' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ if(TOOLCHAIN STREQUAL GCC)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

set(platform MemPool CACHE STRING "Platform (MemPool, SoftHier, QEMU, Siracusa, Siracusa_w_neureka, PULP-Open, GAP9, Generic, Snitch)")
set_property(CACHE platform PROPERTY STRINGS MemPool SoftHier QEMU Siracusa Siracusa_w_neureka PULP-Open GAP9 Generic Snitch)
set(platform MemPool CACHE STRING "Platform (MemPool, SoftHier, QEMU, Siracusa, Siracusa_w_neureka, Siracusa_w_redmule, PULP-Open, GAP9, Generic, Snitch)")
set_property(CACHE platform PROPERTY STRINGS MemPool SoftHier QEMU Siracusa Siracusa_w_neureka Siracusa_w_redmule PULP-Open GAP9 Generic Snitch)

if(platform STREQUAL MemPool)
message(STATUS "Building for platform 'MemPool'")
Expand All @@ -31,6 +31,8 @@ elseif(platform STREQUAL Siracusa)
message(STATUS "Building for platform 'Siracusa'")
elseif(platform STREQUAL Siracusa_w_neureka)
message(STATUS "Building for platform 'Siracusa_w_neureka'")
elseif(platform STREQUAL Siracusa_w_redmule)
message(STATUS "Building for platform 'Siracusa_w_redmule'")
elseif(platform STREQUAL PULPOpen)
message(STATUS "Building for platform 'PULP-Open'")
elseif(platform STREQUAL GAP9)
Expand Down Expand Up @@ -196,7 +198,7 @@ if(platform STREQUAL QEMU-ARM)

endif()

if(platform STREQUAL Siracusa OR platform STREQUAL Siracusa_w_neureka OR platform STREQUAL PULPOpen)
if(platform STREQUAL Siracusa OR platform STREQUAL Siracusa_w_neureka OR platform STREQUAL Siracusa_w_redmule OR platform STREQUAL PULPOpen)

if(TOOLCHAIN STREQUAL LLVM)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/cmake/pulp/toolchain_llvm.cmake)
Expand All @@ -206,7 +208,7 @@ if(platform STREQUAL Siracusa OR platform STREQUAL Siracusa_w_neureka OR platfor

include(${CMAKE_CURRENT_LIST_DIR}/cmake/pulp/pulp.cmake)

if(platform STREQUAL Siracusa OR platform STREQUAL Siracusa_w_neureka)
if(platform STREQUAL Siracusa OR platform STREQUAL Siracusa_w_neureka OR platform STREQUAL Siracusa_w_redmule)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/pulp/siracusa/siracusa.cmake)
elseif(platform STREQUAL PULPOpen)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/pulp/pulp-open/pulp-open.cmake)
Expand Down
Empty file.
5 changes: 4 additions & 1 deletion Deeploy/Targets/PULPOpen/Templates/FloatGemmTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

from typing import Dict, List, Tuple

from Deeploy.AbstractDataTypes import float32_tPtr
from Deeploy.AbstractDataTypes import PointerClass
from Deeploy.CommonExtensions.DataTypes import float32_t
from Deeploy.DeeployTypes import NetworkContext, NodeTemplate, OperatorRepresentation

float32_tPtr = PointerClass(float32_t)


class PULPFloatGEMMTemplate(NodeTemplate):

Expand Down
52 changes: 52 additions & 0 deletions Deeploy/Targets/Redmule/Bindings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ----------------------------------------------------------------------
#
# File: NeurekaBindings.py
#
# Last edited: 10.07.2024
#
# Copyright (C) 2024, ETH Zurich and University of Bologna.
#
# Author:
# Luka Macan, University of Bologna
# Moritz Scherer, ETH Zurich
#
# ----------------------------------------------------------------------
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# 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.

from Deeploy.AbstractDataTypes import PointerClass
from Deeploy.CommonExtensions.DataTypes import float32_t
from Deeploy.DeeployTypes import NodeBinding
from Deeploy.Targets.Generic.TypeCheckers import ConvChecker, GEMMChecker, MatMulChecker
from Deeploy.Targets.PULPOpen.Bindings import ForkTransformer
from Deeploy.Targets.Redmule.Templates import ConvTemplate, GEMMTemplate, MatmulTemplate

RedmuleMatmulBindings = [
NodeBinding(MatMulChecker([PointerClass(float32_t), PointerClass(float32_t)], [PointerClass(float32_t)]),
MatmulTemplate.referenceTemplate, ForkTransformer)
]

RedmuleConv2DBindings = [
NodeBinding(
ConvChecker([PointerClass(float32_t), PointerClass(float32_t),
PointerClass(float32_t)], [PointerClass(float32_t)]), ConvTemplate.reference2DIm2ColTemplate,
ForkTransformer)
]

RedmuleGEMMBindings = [
NodeBinding(
GEMMChecker([PointerClass(float32_t), PointerClass(float32_t),
PointerClass(float32_t)], [PointerClass(float32_t)]), GEMMTemplate.referenceTemplate,
ForkTransformer)
]
55 changes: 55 additions & 0 deletions Deeploy/Targets/Redmule/Deployer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ----------------------------------------------------------------------
#
# File: Deployer.py
#
# Last edited: 08.05.2025
#
# Copyright (C) 2024, ETH Zurich and University of Bologna.
#
# Author: Run Wang, ETH Zurich
#
# ----------------------------------------------------------------------
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# 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.

from typing import Callable, Dict, Type

import onnx_graphsurgeon as gs

from Deeploy.AbstractDataTypes import Pointer
from Deeploy.DeeployTypes import DeploymentPlatform, TopologyOptimizer
from Deeploy.Targets.PULPOpen.Deployer import PULPDeployer
from Deeploy.Targets.Redmule.TopologyOptimizationPasses.Passes import RedMuleAdjustWeightMemoryLayoutPass, \
RedMuleGEMMTransposePass


class RedmuleDeployer(PULPDeployer):

def __init__(self,
graph: gs.Graph,
deploymentPlatform: DeploymentPlatform,
inputTypes: Dict[str, Type[Pointer]],
loweringOptimizer: TopologyOptimizer,
scheduler: Callable = lambda graph: list(graph.nodes),
name: str = 'DeeployNetwork',
default_channels_first = False,
deeployStateDir: str = "DeeployStateDir",
inputOffsets = {}):
super().__init__(graph, deploymentPlatform, inputTypes, loweringOptimizer, scheduler, name,
default_channels_first, deeployStateDir, inputOffsets)

self.loweringOptimizer.passes += [
RedMuleAdjustWeightMemoryLayoutPass("Redmule"),
RedMuleGEMMTransposePass("Redmule")
]
60 changes: 60 additions & 0 deletions Deeploy/Targets/Redmule/Engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ----------------------------------------------------------------------
#
# File: Engine.py
#
# Last edited: 26.07.2024
#
# Copyright (C) 2024, ETH Zurich and University of Bologna.
#
# Author: Moritz Scherer, ETH Zurich
#
# ----------------------------------------------------------------------
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# 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.

from typing import List

from Deeploy.DeeployTypes import DeploymentEngine, NodeMapper
from Deeploy.Targets.Generic.Layers import ConvLayer, GEMMLayer, MatMulLayer
from Deeploy.Targets.Generic.Parsers import MatMulParser
from Deeploy.Targets.PULPOpen.Parsers import PULPFPConv2DParser
from Deeploy.Targets.Redmule.Parsers import GEMMRedmuleParser
from Deeploy.Targets.Redmule.Tiler import RedmuleConvTilingReadyBindings, RedmuleGEMMTilingReadyBindings, \
RedmuleMatMulTilingReadyBindings

MatMulRedmuleMapper = NodeMapper(MatMulParser(), RedmuleMatMulTilingReadyBindings)
Conv2DRedmuleMapper = NodeMapper(PULPFPConv2DParser(), RedmuleConvTilingReadyBindings)
GEMMMRedmuleMapper = NodeMapper(GEMMRedmuleParser(), RedmuleGEMMTilingReadyBindings)

RedmuleMapping = {
'MatMul': MatMulLayer([MatMulRedmuleMapper]),
'Conv': ConvLayer([Conv2DRedmuleMapper]),
'Gemm': GEMMLayer([GEMMMRedmuleMapper]),
}

_includeList = []

_redmuleInitCode = r"""
// Redmule engine initialization
"""


class RedmuleEngine(DeploymentEngine):

def __init__(self,
name: str,
Mapping = RedmuleMapping,
initCode: str = _redmuleInitCode,
includeList: List[str] = _includeList) -> None:
super().__init__(name, Mapping, initCode, includeList)
Loading
Loading