Skip to content

[P0] Another simple test (hand-written) #189

@tancheng

Description

@tancheng

Follow fir test:

def sim_fir_return(cmdline_opts, mem_access_is_combinational):
src_ctrl_pkt = []
complete_signal_sink_out = []
src_query_pkt = []
# kernel specific parameters.
kStoreAddress = 16 # We no longer need this for storing the result, as we can directly return it to CPU.
kInputBaseAddress = 0
kCoefficientBaseAddress = 2
kSumInitValue = 3
kLoopLowerBound = 2
kLoopIncrement = 1
kLoopUpperBound = 10
kCtrlCountPerIter = 4
# Though kTotalCtrlSteps is way more than required loop iteration count,
# the stored result should still be correct thanks to the grant predicate.
kTotalCtrlSteps = kCtrlCountPerIter * \
(kLoopUpperBound - kLoopLowerBound) + \
10
kExpectedOutput = 2215
# Corresponding DFG:
#
# 0(phi_const) <---------┐
# / | \ |
# 2(+) 4(+) 8(+) |
# / / / | |
# 3(ld) 5(ld) 9(cmp) | |
# \ / | \ | |
# 6(x) 12(not) 10(grant_predicate)
# | |
# ┌--> 7(+) |
# | / \ |
# 1(phi_const) 11(grant_predicate)
# |
# 13(ret)
#
# Corresponding mapping:
'''
↑ Y
(0,5)| 🔳
(0,4)| .
(0,3)| .
(0,2)| .
(0,1)| 🔳
(0,0)+-------------→ X
(1,0)(2,0)(3,0)
===================================================
cycle 0:
[ 🔳 🔳 🔳 🔳 ]
[ 0(phi_const) → 🔳 🔳 🔳 ]
↓ ↺
[ 🔳 🔳 🔳 🔳 ]
[ 7(+) ───→ 🔳 🔳 🔳 ]
---------------------------------------------------
cycle 1:
[ 🔳 🔳 🔳 🔳 ]
[ 2(+ const) 8(+ const) 🔳 🔳 ]
↺ ↓ ↺
[ 4(+ const) 🔳 🔳 🔳 ]
[ 1(phi_const) 11(grant_pred) 🔳 🔳 ]
↺ ↺
---------------------------------------------------
cycle 2:
[ 🔳 🔳 🔳 🔳 ]
[ 3(ld) 🔳 🔳 🔳 ]
↓ ↑
[ 5(ld) 9(cmp) 🔳 🔳 ]
↺ ↺
[ 🔳 13(ret) 🔳 🔳 ]
---------------------------------------------------
cycle 3:
[ 🔳 🔳 🔳 🔳 ]
[ 🔳 ← 10(grant_predicate) 🔳 🔳 ]
[ 6(x) 12(not) 🔳 🔳 ]
↓ ↓
[ 🔳 🔳 🔳 🔳 ]
---------------------------------------------------
'''

create a CgraRTL_reduce_test.py by hand-writing the control signals based on the mapper generated mapping info: https://github.com/coredac/dataflow/blob/7f845d6a5b9dd3310c237dba5db9934b032f14f4/test/neura/ctrl/branch_for.mlir#L247-L304

This would make you understand the full-stack of the entire framework.

Metadata

Metadata

Labels

Projects

Status

No status

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions