Fix python shadowing builtins

This commit is contained in:
Jordan Carlin 2025-02-15 17:05:37 -08:00
parent 4595e2cfb6
commit 87ae668442
No known key found for this signature in database
4 changed files with 10 additions and 7 deletions

View file

@ -14,10 +14,13 @@ select = [
"W", # warnings (pycodestyle)
"I", # Import related rules (isort)
"UP", # Upgraded version available in newer Python
"B", # bugbear rules
"A", # shadow builtins
"EXE", # Executable file shebangs
"Q003", # Avoidable escaped quotes
"Q004", # Unnecessary esacpe character
"RUF", # Ruff specific rules
]
ignore = [
@ -27,5 +30,6 @@ ignore = [
"E741", # ambiguous variable name
"W291", # trailing whitespace
"W293", # blank line contains whitespace
"B007", # loop control variable not used
"RUF005", # iterable unpacking in list
]

View file

@ -48,7 +48,6 @@ arch_list = [
"rv64gc",
"rv64gc_zba_zbb_zbs"
]
str="32"
# Define regular expressions to match the desired fields
mt_regex = r"Elapsed MTIME: (\d+).*?Elapsed MINSTRET: (\d+).*?COREMARK/MHz Score: [\d,]+ / [\d,]+ = (\d+\.\d+).*?CPI: \d+ / \d+ = (\d+\.\d+).*?Load Stalls (\d+).*?Store Stalls (\d+).*?D-Cache Accesses (\d+).*?D-Cache Misses (\d+).*?I-Cache Accesses (\d+).*?I-Cache Misses (\d+).*?Branches (\d+).*?Branches Miss Predictions (\d+).*?BTB Misses (\d+).*?Jump and JR (\d+).*?RAS Wrong (\d+).*?Returns (\d+).*?BP Class Wrong (\d+)"
@ -66,7 +65,7 @@ with open(resultfile, mode='w', newline='') as csvfile:
# Loop through each architecture and run the make commands
for arch in arch_list:
xlen_value = "32" if str in arch else "64"
xlen_value = "32" if "32" in arch else "64"
os.system("make clean")
make_all = f"make all XLEN={xlen_value} ARCH={arch}"
os.system(make_all)

View file

@ -64,9 +64,9 @@ def run_arch_sweep():
current_date = datetime.now()
# Format date as a string in the format YYYYMMDD
date_string = current_date.strftime('%Y%m%d_%H%M%S')
dir = "run_"+date_string
target_dir = "run_"+date_string
# Create a directory with the date string as its name
os.mkdir(dir)
os.mkdir(target_dir)
# make a directory with the current date as its name
@ -75,8 +75,8 @@ def run_arch_sweep():
os.system("make clean")
os.system("make run ARCH="+arch)
for res in ["SizeOpt_size", "SizeOpt_speed", "SpeedOpt_size", "SpeedOpt_speed"]:
os.system("mv -f wally"+res+".json "+dir+"/wally"+res+"_"+arch+".json")
return dir
os.system("mv -f wally"+res+".json "+target_dir+"/wally"+res+"_"+arch+".json")
return target_dir
directory = run_arch_sweep()
#directory = "run_20231120_072037-caches"

View file

@ -262,7 +262,7 @@ def ReportAsText(benchmarkDict):
if(not args.summary):
for benchmark in benchmarkDict:
print(benchmark)
for (name, type, entries, size, val) in benchmarkDict[benchmark]:
for (name, prefixName, entries, size, val) in benchmarkDict[benchmark]:
sys.stdout.write(f'{name} {entries if not args.size else size} {val if not args.invert else 100 - val:0.2f}\n')
def Inversion(lst):