Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jorendumoulin committed Mar 11, 2024
1 parent c4722fb commit cf5b6c6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
23 changes: 18 additions & 5 deletions pact/experiments/layout/create_summary.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
import json

import pandas as pd

# Open the test_results.json file
with open('test_results.json', 'r') as file:
with open("test_results.json") as file:
data = json.load(file)

# Convert the data into a pandas DataFrame
df = pd.DataFrame(data, columns=['layout', 'backend', 'size', 'success', 'cycles'])
df = pd.DataFrame(data, columns=["layout", "backend", "size", "success", "cycles"])

# order the data by layout, backend, and size
df = df.sort_values(by=['layout', 'backend', 'size'])

print(df)
def calculate_expected(size):
sizes = size.split("x")
sizes = [round(int(x) / 8) for x in sizes]
return sizes[0] * sizes[1] * sizes[2]


# Add a new column to the DataFrame with the expected number of cycles
df["expected"] = df["size"].apply(calculate_expected)

# add a new column to the DataFrame with the speedup
df["utilization"] = df["expected"] / df["cycles"]

# order the data by layout, backend, and size
df = df.sort_values(by=["layout", "backend", "size"])

print(df)
12 changes: 6 additions & 6 deletions pact/experiments/layout/generate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ class UnsupportedCombinationException(Exception):
[16, 16, 32], # ops = 16*16*32 = 8192
[16, 32, 32], # ops = 16*32*32 = 16384
[32, 32, 32], # ops = 32*32*32 = 32768
# [32, 32, 64], # ops = 32*32*64 = 65536
# [32, 64, 64], # ops = 32*64*64 = 131072
# [64, 64, 64], # ops = 64*64*64 = 262144
[32, 32, 64], # ops = 32*32*64 = 65536
[32, 64, 64], # ops = 32*64*64 = 131072
[64, 64, 64], # ops = 64*64*64 = 262144
# [64, 64, 128], # ops = 64*64*128 = 524288
# [64, 128, 128], # ops = 64*128*128 = 1048576
# [128, 128, 128], # ops = 128*128*128 = 2097152
]

layouts = [
"default",
# "default",
"tiled",
# "round-robin",
]

backends = [
# 'cpu', # cpu golden model
# 'base', # base system (no streamers)
"cpu", # cpu golden model
"base", # base system (no streamers)
"fifo-2", # streamer with a fifo depth of 2
]

Expand Down
11 changes: 6 additions & 5 deletions pact/experiments/layout/main_template_fifo.c_template
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ void set_block_gemm_start() {{ write_csr(986, 1); }}
void wait_streamer_gemm() {{
write_csr(981, 0);
write_csr(986, 0);

// implement some artificial delay
for (int i = 0; i < 1000; i++) {{
asm volatile("nop");
}}
write_csr(986, 0);

// // implement some artificial delay
// for (int i = 0; i < 1000; i++) {{
// asm volatile("nop");
// }}
}}

// Kernel provided via external definition
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ lit
numpy
xdsl @ git+https://github.com/xdslproject/xdsl.git@ad8f2e0c1af9dedd267a1e3e75634ebefee12710
tensorflow-cpu==2.14.0
pandas

0 comments on commit cf5b6c6

Please sign in to comment.