update scripts

This commit is contained in:
Richard Yan
2025-01-30 18:03:21 -08:00
parent 7a88736430
commit ce3fa99465
6 changed files with 135 additions and 28 deletions

View File

@@ -156,7 +156,9 @@ def main():
print(translated_line, end='')
sys.stdout.flush()
print("")
print("\033[s", end='')
print("\033[" + str(lineno) + "H\033[2K\033[1m" + run_label, "DONE", "\033[0m", end='')
print("\033[u", end='', flush=True)
if __name__ == '__main__':
main()

View File

@@ -47,7 +47,6 @@ suffix="-debug"
dims=(256 512 1024)
for dim in "${dims[@]}"; do
echo "$element"
start_run VirgoFP16Config sgemm_tcore/kernel.radiance.gemm.tcore.volta.dim${dim}.elf "volta${dim} " "${suffix}"
start_run VirgoFP16Config sgemm_tcore/kernel.radiance.gemm.tcore.ampere.dim${dim}.elf "ampere${dim}" "${suffix}"
start_run VirgoHopperConfig sgemm_tcore/kernel.radiance.gemm.tcore.hopper.dim${dim}.elf "hopper${dim}" "${suffix}"

43
sims/vcs/scripts/runtime_all.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -e
echoerr() { echo "$@" 1>&2; }
CURRENT_DIR="${PWD##*/}"
if [[ "$CURRENT_DIR" != "vcs" ]]; then
echoerr "Error: This script must be run from chipyard/sims/vcs."
exit 1
fi
source ./scripts/env.sh > /dev/null
rm -f /tmp/markers.log
runtime() {
log_path="output/chipyard.harness.TestHarness.$1/kernel.radiance.gemm.$2.log"
check_exists "${log_path}"
if [ -z "$(tail -n10 ${log_path} | rg 'finish called')" ]; then
echo "$3,0"
return
fi
rg "(e0d0a013|be90a013)" ${log_path} > /tmp/markers.log
echo -n "$3,"
python3 ./scripts/runtime_fast.py /tmp/markers.log
rm -f /tmp/markers.log
}
check_exists() {
if ! [ -f "$1" ]; then
echoerr "Error: looked for file $1 that does not exist."
exit 1
fi
}
echo ",cycles"
dims=(256 512 1024)
for dim in "${dims[@]}"; do
runtime VirgoFP16Config tcore.volta.dim${dim} "volta${dim}"
runtime VirgoFP16Config tcore.ampere.dim${dim} "ampere${dim}"
runtime VirgoHopperConfig tcore.hopper.dim${dim} "hopper${dim}"
runtime VirgoHopperConfig virgo.hopper.dim${dim} "virgo${dim}"
done

View File

@@ -0,0 +1,48 @@
import re
import argparse
def parse_log(file_path):
# Compile regular expressions for the required substrings and format
pc_line_pattern = re.compile(r"^\s+(\d+):.*?PC=0x([\da-f]+).*?instr=(0xbe90a013|0xe0d0a013).*?$")
commit_line_pattern = re.compile(r"^\s+(\d+):.*commit:.*$")
# PC=0x800007a0, instr=0xbe90a013
# Initialize dictionaries to track first and last occurrences
beg_const = "0xbe90a013"
end_const = "0xe0d0a013"
occurrences = {
beg_const: {"first": None, "last": None},
end_const: {"first": None, "last": None}
}
# pc = {
# "0xbe90a013": None,
# "0xe0d0a013": None
# }
with open(file_path, 'r') as log_file:
for line in log_file:
match = pc_line_pattern.search(line)
if match:
timestamp = int(match.group(1))
pc_value = match.group(2)
data_value = match.group(3)
if occurrences[data_value]["first"] is None:
occurrences[data_value]["first"] = timestamp
occurrences[data_value]["last"] = timestamp
return occurrences
if __name__ == "__main__":
# Set up command-line argument parsing
parser = argparse.ArgumentParser(description="Parse log file for specific substrings and their timestamps.")
parser.add_argument("file_path", help="Path to the log file to parse")
# Parse command-line arguments
args = parser.parse_args()
# Parse the log file and print the result
result = parse_log(args.file_path)
# print(result)
print(f"{int((result['0xe0d0a013']['last'] - result['0xbe90a013']['first']) * 0.4)}")

View File

@@ -9,8 +9,6 @@ fsdbs=(
)
for fsdb_file in "${fsdbs[@]}"; do
#n=${files_and_n_values[$fsdb_file]}
n=256
echo "parsing sharedmem reads for file $fsdb_file"
@@ -24,11 +22,11 @@ for fsdb_file in "${fsdbs[@]}"; do
# Clean up temp file
rm -f /tmp/smem_activity.log
echo "reads: $reads"
echo "number of 4-byte reads: $reads"
# Calculate final value
result=$(echo "scale=6; $reads / ($n * $n / 64)" | bc)
result=$(echo "scale=3; $reads * 4 / 1048576" | bc)
echo -e "multiple of input data size: $result\n"
echo -e "total read data in MiB: $result\n"
done