Skip to content

Commit 5502d04

Browse files
committed
Merge latest devel including TinyViT tiling support
2 parents 3f5a042 + e07cd13 commit 5502d04

File tree

19 files changed

+841
-190
lines changed

19 files changed

+841
-190
lines changed

.github/workflows/ci-platform-siracusa-tiled.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,20 @@ jobs:
4747
{"name":"Hardswish","L1":[750]},
4848
{"name":"RQHardswish","L1":[750]},
4949
{"name":"testFloatGEMM","L1":[8000]},
50-
{"name":"testFloat2DConvolution","L1":[8000]},
50+
51+
{"name":"testFloat2DConvolution","L1":[1600]},
52+
{"name":"testFloat2DConvolutionBias","L1":[6600]},
53+
{"name":"testFloat2DConvolutionZeroBias","L1":[6600]},
54+
55+
{"name":"testFloat2DDWConvolution","L1":[7200]},
56+
{"name":"testFloat2DDWConvolutionBias","L1":[7200]},
57+
{"name":"testFloat2DDWConvolutionZeroBias","L1":[7200]},
58+
5159
{"name":"testFloatLayerNorm","L1":[2000]},
52-
{"name":"testFloatRelu","L1":[2000]},
5360
{"name":"testFloatMaxPool","L1":[2000]},
5461
{"name":"testFloatMatmul","L1":[2000]},
62+
{"name":"testFloatRelu","L1":[2000]},
63+
{"name":"testFloatReshapeWithSkipConnection","L1":[1400]},
5564
{"name":"testFloatSoftmax","L1":[4000]},
5665
{"name":"testFloatTranspose","L1":[2000]},
5766
{"name":"testFloatMul","L1":[2000]},
@@ -78,11 +87,20 @@ jobs:
7887
{"name":"Hardswish","L1":[750]},
7988
{"name":"RQHardswish","L1":[800]},
8089
{"name":"testFloatGEMM","L1":[8000]},
81-
{"name":"testFloat2DConvolution","L1":[15000]},
90+
91+
{"name":"testFloat2DConvolution","L1":[2000]},
92+
{"name":"testFloat2DConvolutionBias","L1":[8800]},
93+
{"name":"testFloat2DConvolutionZeroBias","L1":[8800]},
94+
95+
{"name":"testFloat2DDWConvolution","L1":[9800]},
96+
{"name":"testFloat2DDWConvolutionBias","L1":[10000]},
97+
{"name":"testFloat2DDWConvolutionZeroBias","L1":[9800]},
98+
8299
{"name":"testFloatLayerNorm","L1":[2000]},
83-
{"name":"testFloatRelu","L1":[2000]},
84100
{"name":"testFloatMaxPool","L1":[5000]},
85101
{"name":"testFloatMatmul","L1":[5000]},
102+
{"name":"testFloatRelu","L1":[20]},
103+
{"name":"testFloatReshapeWithSkipConnection","L1":[2600]},
86104
{"name":"testFloatSoftmax","L1":[8000]},
87105
{"name":"testFloatTranspose","L1":[2000]},
88106
{"name":"testFloatMul","L1":[2000]}
@@ -118,8 +136,8 @@ jobs:
118136
L1: [64000]
119137
- name: "CCT/CCT_1_16_16_8"
120138
L1: [64000]
121-
- name: "testTrainCCT/CCT2_FT2"
122-
L1: [128000]
139+
- name: "testFloatDemoTinyViT"
140+
L1: [4000]
123141
num-cores: [8]
124142
uses: ./.github/workflows/_runner-siracusa-tiled.yml
125143
with:
@@ -151,6 +169,8 @@ jobs:
151169
L1: [128000]
152170
- name: "testTrainCCT/CCT2_FT2"
153171
L1: [128000]
172+
- name: "testFloatDemoTinyViT"
173+
L1: [4000]
154174
num-cores: [8]
155175
default-memory-level: ["L3"]
156176
uses: ./.github/workflows/_runner-siracusa-tiled.yml
@@ -189,6 +209,8 @@ jobs:
189209
L1: [128000]
190210
- name: "testTrainCCT/CCT2_FT2"
191211
L1: [128000]
212+
- name: "testFloatDemoTinyViT"
213+
L1: [4000]
192214
num-cores: [8]
193215
double-buffer: [true]
194216
default-memory-level: ["L3"]

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This file contains the changelog for the Deeploy project. The changelog is divid
44
## Unreleased (Planned Release Target: v0.2.1)
55

66
### List of Pull Requests
7+
- Demo TinyViT compatibility with tiled Siracusa [#124](https://github.com/pulp-platform/Deeploy/pull/124)
78
- TinyViT on non-tiled Siracusa [#117](https://github.com/pulp-platform/Deeploy/pull/117)
89
- Support Fully Asynchronous DMAs [#114](https://github.com/pulp-platform/Deeploy/pull/114)
910
- Disallow shape inference [#128](https://github.com/pulp-platform/Deeploy/pull/128)
@@ -25,6 +26,10 @@ This file contains the changelog for the Deeploy project. The changelog is divid
2526
- Fix bias hoisting in generic GEMM with no bias [#126](https://github.com/pulp-platform/Deeploy/pull/126)
2627

2728
### Added
29+
- Support for input tiling for PULP FP regular and DW conv 2D.
30+
- CI tests for tiled Siracusa FP regular and DW conv 2D, with and without bias, for skip connections, and for the demo version of TinyViT.
31+
- Documentation for PULP FP regular and DW conv 2D and MatMul tile constraints.
32+
- PULP ReduceMean and Slice tile constraints.
2833
- PULP 2D FP DW conv Im2Col template and kernel, with bias support.
2934
- Bias support for PULP 2D FP regular conv Im2Col in template & kernel.
3035
- PULP FP DW conv 2D parser.
@@ -70,6 +75,7 @@ This file contains the changelog for the Deeploy project. The changelog is divid
7075
- annotateNCores method to PULPDeployer that adds an `n_cores` key to all PULPClusterEngine templates' operatorRepresentations
7176

7277
### Changed
78+
- Decreased L1 maximal memory limit for CI pipeline tests where compatible thanks to the implementation of Conv2D input tiling support.
7379
- Reduced size of reshape & skip connection test, for non-tiled Siracusa memory compatibility.
7480
- Replaced platform-specific tags (`*-amd64`, `*-arm64`) with direct digest references in `Noelware/docker-manifest-action`.
7581
- mchan HAL is now reduced to bare-bones
@@ -109,6 +115,10 @@ This file contains the changelog for the Deeploy project. The changelog is divid
109115
- changed `_mapNode` to `_selectEngine` which reduces the responsibility of that function to, as the name states, just engine selection
110116

111117
### Fixed
118+
- Fixed PULP FP32 regular and DW Conv2D, and MatMul tile constraints.
119+
- Fixed type casting for tiling code generation.
120+
- Fixed bug in buffer name identification in code generation for tests with L3 default memory level.
121+
- PULP GELU kernel to use tanh approximation.
112122
- Fixed bug for non-batched elements in the PULPOpen FP GEMM and matmul templates.
113123
- Added underscore to the beginning of closure names to avoid naming issues when they start with unsupported first characters (like numbers).
114124
- Data types in the PULPOpen FP add and mul templates.

Deeploy/DeeployTypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ class _ReferenceBuffer(VariableBuffer):
480480
% if offset is None:
481481
${type.typeName} ${name} = (${type.typeName}) ${referenceName};\\
482482
% else:
483-
${type.typeName} ${name} = (${type.typeName}) ${referenceName} + ${offset};\\
483+
${type.typeName} ${name} = (${type.typeName})((char*) ${referenceName} + ${offset});\\
484484
% endif
485485
""")
486486
deallocTemplate = NodeTemplate("")

Deeploy/Targets/PULPOpen/Bindings.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@
154154

155155
PULPSliceBindings = [
156156
NodeBinding(
157-
SliceChecker([
158-
PointerClass(type),
159-
PointerClass(uint8_t),
160-
PointerClass(uint8_t),
161-
PointerClass(uint8_t),
162-
PointerClass(uint8_t)
163-
], [PointerClass(type)]), SliceTemplate.referenceTemplate, ForkTransformer) for type in FloatDataTypes
157+
SliceChecker(
158+
[
159+
PointerClass(float_type), # data_in
160+
PointerClass(int_type), # starts
161+
PointerClass(int_type), # ends
162+
PointerClass(int_type), # axes
163+
PointerClass(int_type) # steps
164+
],
165+
[PointerClass(float_type)]),
166+
SliceTemplate.referenceTemplate,
167+
ForkTransformer) for float_type in FloatDataTypes for int_type in IntegerDataTypes
164168
]
165169

166170
PULPReshapeBindings = [

Deeploy/Targets/PULPOpen/Platform.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,23 @@
3030
MergeConstAddAndRequantPass, MergeTrueIntegerDivRequantShiftPass, QuantPatternPass, RQSSplitPass, \
3131
SkipEmptyConcatPass, SkipUnityRequantPass, iGELURequantMergePass, iHardswishRequantMergePass
3232
from Deeploy.Targets.PULPOpen.Bindings import BasicDequantBindings, BasicQuantBindings, PULPConv1DBinding, \
33-
PULPDMASliceBindings, PULPDWConv1DBinding, PULPFloatDWConv2DBindings, PULPReduceMeanBindings, PULPSliceBindings
33+
PULPDMASliceBindings, PULPDWConv1DBinding
3434
from Deeploy.Targets.PULPOpen.Layers import PULPRQSConvLayer, PULPRQSGEMMLayer
3535
from Deeploy.Targets.PULPOpen.Parsers import PULPConv1DParser, PULPConv2DParser, PULPDWConv1DParser, \
3636
PULPDWConv2DParser, PULPFPConv2DParser, PULPFPDWConv2DParser, PULPGEMMParser, PULPMatrixVecParser, \
3737
PULPTallGEMMParser
3838
from Deeploy.Targets.PULPOpen.Templates import AllocateTemplate, FreeTemplate
3939
from Deeploy.Targets.PULPOpen.Tiler import PULPAddTilingReadyBindings, PULPConcatTilingReadyBindings, \
40-
PULPConv2DTilingReadyBindings, PULPFlattenTilingReadyBindings, PULPFPGELUGradTilingReadyBindings, \
41-
PULPFPGELUTilingReadyBindings, PULPFPGEMMTilingReadyBindings, PULPGatherTilingReadyBindings, \
42-
PULPiHardswishTilingReadyBindings, PULPiRMSNormTilingReadyBindings, PULPiRQSGELUTilingReadyBindings, \
43-
PULPLayernormGradTilingReadyBindings, PULPLayernormTilingReadyBindings, PULPMatMulTilingReadyBindings, \
44-
PULPMaxPool2DTilingReadyBindings, PULPMulTilingReadyBindings, PULPReduceSumTilingReadyBindings, \
45-
PULPReluTilingReadyBindings, PULPRQAddTilingReadyBindings, PULPRQSConv2DTilingReadyBindings, \
46-
PULPRQSDWConv2DTilingReadyBindings, PULPRQSGEMMTilingReadyBindings, PULPRQSiHardswishTilingReadyBindings, \
47-
PULPRQSMatrixVecTilingReadyBindings, PULPRQSTallGEMMTilingReadyBindings, PULPRQSTilingReadyBindings, \
48-
PULPSGDTilingReadyBindings, PULPSoftmaxCrossEntropyGradTilingReadyBindings, \
40+
PULPConv2DTilingReadyBindings, PULPDWConv2DTilingReadyBindings, PULPFlattenTilingReadyBindings, \
41+
PULPFPGELUGradTilingReadyBindings, PULPFPGELUTilingReadyBindings, PULPFPGEMMTilingReadyBindings, \
42+
PULPGatherTilingReadyBindings, PULPiHardswishTilingReadyBindings, PULPiRMSNormTilingReadyBindings, \
43+
PULPiRQSGELUTilingReadyBindings, PULPLayernormGradTilingReadyBindings, PULPLayernormTilingReadyBindings, \
44+
PULPMatMulTilingReadyBindings, PULPMaxPool2DTilingReadyBindings, PULPMulTilingReadyBindings, \
45+
PULPReduceMeanTilingReadyBindings, PULPReduceSumTilingReadyBindings, PULPReluTilingReadyBindings, \
46+
PULPRQAddTilingReadyBindings, PULPRQSConv2DTilingReadyBindings, PULPRQSDWConv2DTilingReadyBindings, \
47+
PULPRQSGEMMTilingReadyBindings, PULPRQSiHardswishTilingReadyBindings, PULPRQSMatrixVecTilingReadyBindings, \
48+
PULPRQSTallGEMMTilingReadyBindings, PULPRQSTilingReadyBindings, PULPSGDTilingReadyBindings, \
49+
PULPSliceTilingReadyBindings, PULPSoftmaxCrossEntropyGradTilingReadyBindings, \
4950
PULPSoftmaxCrossEntropyTilingReadyBindings, PULPSoftmaxGradTilingReadyBindings, PULPSoftmaxTilingReadyBindings, \
5051
PULPTransposeTilingReadyBindings, PULPUniformRQSTilingReadyBindings
5152
from Deeploy.Targets.PULPOpen.TopologyOptimizationPasses.Passes import PULPAddRequantMergePass, \
@@ -67,7 +68,7 @@
6768
RequantShiftMapper = NodeMapper(RequantShiftParser(), PULPRQSTilingReadyBindings)
6869
UniformRequantShiftMapper = NodeMapper(UniformRequantShiftParser(), PULPUniformRQSTilingReadyBindings)
6970

70-
ReduceMeanMapper = NodeMapper(ReduceMeanParser(), PULPReduceMeanBindings)
71+
ReduceMeanMapper = NodeMapper(ReduceMeanParser(), PULPReduceMeanTilingReadyBindings)
7172
ReduceSumMapper = NodeMapper(ReduceSumParser(), PULPReduceSumTilingReadyBindings)
7273
MatMulMapper = NodeMapper(MatMulParser(), PULPMatMulTilingReadyBindings)
7374
RQIntegerDivMapper = NodeMapper(RQIntegerDivParser(), [BasicRQIntegerDivBinding])
@@ -77,7 +78,7 @@
7778
DWConv1DMapper = NodeMapper(PULPDWConv1DParser(), [PULPDWConv1DBinding])
7879
FPConv2DMapper = NodeMapper(PULPFPConv2DParser(), PULPConv2DTilingReadyBindings)
7980
Conv2DMapper = NodeMapper(PULPConv2DParser(), PULPRQSConv2DTilingReadyBindings)
80-
FPDWConv2DMapper = NodeMapper(PULPFPDWConv2DParser(), PULPFloatDWConv2DBindings)
81+
FPDWConv2DMapper = NodeMapper(PULPFPDWConv2DParser(), PULPDWConv2DTilingReadyBindings)
8182
DWConv2DMapper = NodeMapper(PULPDWConv2DParser(), PULPRQSDWConv2DTilingReadyBindings)
8283
GEMMMapper = NodeMapper(PULPGEMMParser(), PULPRQSGEMMTilingReadyBindings)
8384
FloatGEMMMapper = NodeMapper(GEMMParser(), PULPFPGEMMTilingReadyBindings)
@@ -95,7 +96,7 @@
9596

9697
DMASliceMapper = NodeMapper(SliceParser(), PULPDMASliceBindings)
9798

98-
SliceMapper = NodeMapper(SliceParser(), PULPSliceBindings)
99+
SliceMapper = NodeMapper(SliceParser(), PULPSliceTilingReadyBindings)
99100

100101
iRMSNormMapper = NodeMapper(iRMSNormParser(), PULPiRMSNormTilingReadyBindings)
101102

0 commit comments

Comments
 (0)