Skip to content

Commit

Permalink
Dense RV hacks + two input add
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoduoza committed Dec 20, 2024
1 parent 4a34309 commit eaf8a68
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Halide-to-Hardware
Submodule Halide-to-Hardware updated 91 files
+10 −0 apps/hardware_benchmarks/apps/two_input_add/CMakeLists.txt
+53 −0 apps/hardware_benchmarks/apps/two_input_add/Makefile
+28 −0 apps/hardware_benchmarks/apps/two_input_add/cgra_config.json
+ apps/hardware_benchmarks/apps/two_input_add/golden/golden_output.png
+29 −0 apps/hardware_benchmarks/apps/two_input_add/golden/pointwise_compute.h
+52 −0 apps/hardware_benchmarks/apps/two_input_add/golden/pointwise_memory.cpp
+1 −0 apps/hardware_benchmarks/apps/two_input_add/golden/pointwise_memory.h
+17,394 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/1.graph
+19,234 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/17.graph
+8 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/aws_compare_regressions.sh
+2 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/aws_run_tb_unoptimized_two_input_add.sh
+14 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/bit_io_header.json
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/build_kernel.sh
+28 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/cgra_config.json
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/clockwork_codegen
+68 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/clockwork_codegen.cpp
+23 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/clockwork_compute_debug.cpp
+74 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/clockwork_testscript.cpp
+305 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/clockwork_testscript.h
+9 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/compare_regressions.sh
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.freq
+2 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.info
+108 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.layout
+4 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.meta
+35 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.packed
+12 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.place
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.port_remap
+102 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design.route
+125 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design_meta.json
+43 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design_meta_halide.json
+385 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/design_top.json
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/gold.pgm
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/gold_output_array.npy
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/halide_gen_args
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_input_b_stencil.leraw
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_input_b_stencil.raw
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_input_stencil.leraw
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_input_stencil.raw
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_output.leraw
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_output.raw
+3 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/hw_output_header.txt
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/input.pgm
+14 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/io_header.json
+26 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/lassen_header.json
+10 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/manual.place
+451 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/map_result/two_input_add/two_input_add.json
+385 −0 ...dware_benchmarks/apps/two_input_add/hardcoded_bin/map_result/two_input_add/two_input_add_to_metamapper.json
+2,326 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/mem_cout
+35 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/mem_header.json
+59 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/netlist_info.txt
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/output.png
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/output_clockwork.png
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/output_cpu.png
+21 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/pe_header.json
+18 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/pond_header.json
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/process
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/process_targets
+31 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/rdai_clockwork_platform.h
+40 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/reg_write.h
+4,096 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/regression_result_unoptimized_two_input_add.txt
+45 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/regression_tb_unoptimized_two_input_add.cpp
+3 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/run_tb.sh
+2 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/run_tb_unoptimized_two_input_add.sh
+17 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/schedule_problem.mod
+2 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/set_app.sh
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/sim_output_array.npy
+183 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/soda_unoptimized_two_input_add_host.cpp
+37 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/tb_soda_unoptimized_two_input_add.cpp
+73 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.bs
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.bs.json
+ apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.generator
+1,972 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.h
+326 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.html
+36 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add.registration.cpp
+3,254 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_clockwork.cpp
+1,962 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_clockwork.h
+36 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_compute.h
+53 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_compute.json
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_compute_kernel_latencies.json
+119 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_compute_mapped.json
+62 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_debug.cpp
+3 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_flush_latencies.json
+71 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_memory.cpp
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_memory.h
+1 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_pond_latencies.json
+3 −0 apps/hardware_benchmarks/apps/two_input_add/hardcoded_bin/two_input_add_stencil_valid_latencies.json
+ apps/hardware_benchmarks/apps/two_input_add/input.png
+ apps/hardware_benchmarks/apps/two_input_add/input_copy.png
+65 −0 apps/hardware_benchmarks/apps/two_input_add/process.cpp
+90 −0 apps/hardware_benchmarks/apps/two_input_add/two_input_add_generator.cpp
+15 −4 apps/hardware_benchmarks/hw_support/parse_design_meta.py
6 changes: 4 additions & 2 deletions aha/util/pnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def dispatch(args, extra_args=None):
"--gold-file",
str(app_dir / f"bin/gold{ext}"),
"--input-broadcast-branch-factor", "2",
"--input-broadcast-max-leaves", "4",
"--pipeline-pnr"
# MO: DRV HACK
"--no-input-broadcast-pipelining",
"--input-broadcast-max-leaves", "4"
#"--pipeline-pnr"
]

need_daemon = False
Expand Down
60 changes: 57 additions & 3 deletions aha/util/regress.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,16 @@ def test_dense_app(test, width, height, env_parameters, extra_args, layer=None,
except:
pass

# MO: DRV HACK
env_vars = {}
env=env_vars
dense_ready_valid = True
if dense_ready_valid:
env_vars["PIPELINED"] = "0"
env_vars["MATCH_BRANCH_DELAY"] = "0"

start = time.time()
buildkite_call(["aha", "map", test, "--chain", "--env-parameters", env_parameters] + layer_array)
buildkite_call(["aha", "map", test, "--chain", "--env-parameters", env_parameters] + layer_array, env=env_vars)
time_compile = time.time() - start

print(f"--- {testname} - pnr and pipelining", flush=True)
Expand All @@ -351,6 +359,9 @@ def test_dense_app(test, width, height, env_parameters, extra_args, layer=None,

env_vars = {}

# MO: DRV HACK, temporarily setting this so FIFOs are placed properly
#env_vars["EXHAUSTIVE_PIPE"] = "1"

if using_matrix_unit:
buildkite_args.append("--using-matrix-unit")
buildkite_args.append("--give-north-io-sbs")
Expand All @@ -364,8 +375,9 @@ def test_dense_app(test, width, height, env_parameters, extra_args, layer=None,
env_vars["OC_0"] = str(2*cgra_height)
env_vars["MU_DATAWIDTH"] = str(mu_datawidth)

buildkite_call(buildkite_args)

#buildkite_call(buildkite_args)

buildkite_call(buildkite_args, env=env_vars)
time_map = time.time() - start

print(f"--- {testname} - glb testing", flush=True)
Expand Down Expand Up @@ -468,6 +480,41 @@ def test_hardcoded_dense_app(test, width, height, env_parameters, extra_args, la

return time_compile, time_map, time_test

def test_matrix_unit_app(test, width, height, env_parameters, extra_args, layer=None, dense_only=False, use_fp=False, using_matrix_unit=False, cgra_height=32, mu_datawidth=16, num_fabric_cols_removed=0):
env_parameters = str(env_parameters)
testname = layer if layer is not None else test
print(f"--- {testname}")
print(f"--- {testname} - Skipping compiling and mapping")
app_path = "/aha/Halide-to-Hardware/apps/hardware_benchmarks/" + test
print(app_path, flush=True)

print(f"--- {testname} - Skipping pnr and pipelining", flush=True)

env_vars = {}
if using_matrix_unit:
# buildkite_args.append("--using-matrix-unit")
# buildkite_args.append("--give-north-io-sbs")
# buildkite_args.append("--num-fabric-cols-removed")
# buildkite_args.append(str(num_fabric_cols_removed))

if num_fabric_cols_removed == 0:
env_vars["WEST_IN_IO_SIDES"] = "1"

env_vars["USING_MATRIX_UNIT"] = "1"
env_vars["OC_0"] = str(2*cgra_height)
env_vars["MU_DATAWIDTH"] = str(mu_datawidth)

#buildkite_call(buildkite_args)

print(f"--- {testname} - glb testing", flush=True)
start = time.time()
if use_fp:
buildkite_call(["aha", "test", test, "--dense-fp"], env=env_vars)
else:
buildkite_call(["aha", "test", test], env=env_vars)
time_test = time.time() - start

return 0, 0, time_test

def dispatch(args, extra_args=None):
seed_flow = not args.non_seed_flow
Expand Down Expand Up @@ -522,6 +569,7 @@ def dispatch(args, extra_args=None):
resnet_tests = imported_tests.resnet_tests
resnet_tests_fp = imported_tests.resnet_tests_fp
hardcoded_dense_tests = imported_tests.hardcoded_dense_tests
matrix_unit_tests = imported_tests.matrix_unit_tests

print(f"--- Running regression: {args.config}", flush=True)
info = []
Expand Down Expand Up @@ -627,6 +675,12 @@ def dispatch(args, extra_args=None):
using_matrix_unit=using_matrix_unit, cgra_height=height, mu_datawidth=mu_datawidth, num_fabric_cols_removed=num_fabric_cols_removed)
info.append([test + "_glb", t0 + t1 + t2, t0, t1, t2])

for test in matrix_unit_tests:
t0, t1, t2 = test_matrix_unit_app(test,
width, height, args.env_parameters, extra_args,
using_matrix_unit=using_matrix_unit, cgra_height=height, mu_datawidth=mu_datawidth, num_fabric_cols_removed=num_fabric_cols_removed)
info.append([test + "_glb", t0 + t1 + t2, t0, t1, t2])

if args.include_dense_only_tests:
# DENSE ONLY TESTS
# Remove sparse+dense garnet.v first
Expand Down
16 changes: 13 additions & 3 deletions aha/util/regress_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@ def __init__(self, testname):
resnet_tests = []
resnet_tests_fp = []
hardcoded_dense_tests = []
matrix_unit_tests = []

# FAST test suite should complete in just a minute or two
if testname == "fast":
width, height = 8, 8,
sparse_tests = [
"vec_identity"
# "vec_identity"
]
glb_tests = [
"apps/pointwise"
# "apps/two_input_add",
# "apps/pointwise"
]
glb_tests_fp = [
"tests/fp_pointwise",
# "tests/fp_pointwise",
]
resnet_tests = []
resnet_tests_fp = []
hardcoded_dense_tests = []
matrix_unit_tests = [
"apps/two_input_add"
]

# PR_AHA test suite for aha-repo push/pull
elif testname == "pr_aha":
Expand Down Expand Up @@ -80,6 +85,7 @@ def __init__(self, testname):
hardcoded_dense_tests = [
"apps/depthwise_conv"
]
matrix_unit_tests = []

# Found the better way maybe
#
Expand Down Expand Up @@ -159,6 +165,7 @@ def __init__(self, testname):
hardcoded_dense_tests = [
"apps/depthwise_conv"
]
matrix_unit_tests = []

# FULL test is used by scheduled weekly aha regressions
elif testname == "full":
Expand Down Expand Up @@ -273,6 +280,7 @@ def __init__(self, testname):
hardcoded_dense_tests = [
"apps/depthwise_conv"
]
matrix_unit_tests = []
elif testname == "resnet":
width, height = 28, 16
sparse_tests = []
Expand All @@ -294,6 +302,7 @@ def __init__(self, testname):
]
resnet_tests_fp = []
hardcoded_dense_tests = []
matrix_unit_tests = []

# BLANK can be used to return default height, width, and blank test lists
elif testname == "BLANK":
Expand All @@ -309,3 +318,4 @@ def __init__(self, testname):
self.resnet_tests = resnet_tests
self.resnet_tests_fp = resnet_tests_fp
self.hardcoded_dense_tests = hardcoded_dense_tests
self.matrix_unit_tests = matrix_unit_tests
2 changes: 1 addition & 1 deletion archipelago
2 changes: 1 addition & 1 deletion lake

0 comments on commit eaf8a68

Please sign in to comment.