diff --git a/pact/experiments/layout/create_summary.py b/pact/experiments/layout/create_summary.py index 5a4bb0a5..582f0882 100644 --- a/pact/experiments/layout/create_summary.py +++ b/pact/experiments/layout/create_summary.py @@ -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) diff --git a/pact/experiments/layout/generate_tests.py b/pact/experiments/layout/generate_tests.py index 7e79214b..82edc8ce 100644 --- a/pact/experiments/layout/generate_tests.py +++ b/pact/experiments/layout/generate_tests.py @@ -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 ] diff --git a/pact/experiments/layout/main_template_fifo.c_template b/pact/experiments/layout/main_template_fifo.c_template index 21039650..440e3921 100644 --- a/pact/experiments/layout/main_template_fifo.c_template +++ b/pact/experiments/layout/main_template_fifo.c_template @@ -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 diff --git a/requirements.txt b/requirements.txt index ba04092b..9cf2bdb8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ lit numpy xdsl @ git+https://github.com/xdslproject/xdsl.git@ad8f2e0c1af9dedd267a1e3e75634ebefee12710 tensorflow-cpu==2.14.0 +pandas