Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hardware][Xilinx] explicitly specify acc dep distance to avoid hidden pitfall #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions config/pkg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class PkgConfig(object):
"LOG_INP_BUFF_SIZE",
"LOG_WGT_BUFF_SIZE",
"LOG_ACC_BUFF_SIZE",
"ACC_DEP_DISTANCE",
]

def __init__(self, cfg):
Expand All @@ -73,6 +74,10 @@ def __init__(self, cfg):
cfg["LOG_OUT_WIDTH"] -
cfg["LOG_ACC_WIDTH"])

# export VTA_ACC_DEP_DISTANCE env so that VTA runtime can use it to VerifyDep
if "ACC_DEP_DISTANCE" in cfg:
os.environ['VTA_ACC_DEP_DISTANCE'] = str(cfg['ACC_DEP_DISTANCE'])

# Update cfg now that we've extended it
self.__dict__.update(cfg)

Expand Down
3 changes: 2 additions & 1 deletion config/vta_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"LOG_UOP_BUFF_SIZE" : 15,
"LOG_INP_BUFF_SIZE" : 15,
"LOG_WGT_BUFF_SIZE" : 18,
"LOG_ACC_BUFF_SIZE" : 17
"LOG_ACC_BUFF_SIZE" : 17,
"ACC_DEP_DISTANCE" : 3
}
4 changes: 4 additions & 0 deletions hardware/xilinx/src/vta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,11 @@ PRAGMA_HLS(HLS INTERFACE s_axilite port = done bundle = CONTROL_BUS offset = VTA
static bus_T acc_mem[VTA_ACC_BUFF_DEPTH][ACC_MAT_AXI_RATIO];
#pragma HLS ARRAY_RESHAPE variable = acc_mem complete dim=2
// This is necessary to obtain II=1
#ifdef VTA_ACC_DEP_DISTANCE
#pragma HLS DEPENDENCE variable = acc_mem inter distance=VTA_ACC_DEP_DISTANCE true
#else
#pragma HLS DEPENDENCE variable = acc_mem inter false
#endif

// Pop GEMM instruction
insn_T raw_insn = gemm_queue.read();
Expand Down