forked from sjfeng1999/gpu-arch-microbenchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_sass.py
executable file
·44 lines (34 loc) · 1.33 KB
/
compile_sass.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import argparse
def camel_to_snake(name):
token_list = name.split("_")
camel_name = ""
for i, token in enumerate(token_list):
if i == 0:
camel_name += token
else:
camel_name += token.capitalize()
return camel_name
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-arch", type=int, default=75)
args = parser.parse_args()
ARCH_LIST = [70, 75, 80]
KERNEL_LIST = ["memory_latency",
"memory_bandwidth_thread", "memory_bandwidth_block",
"cache_linesize",
"reg_reuse_double", "reg_reuse_bankconflict", "reg_with_bankconflict", "reg_without_bankconflict",
"shared_bankconflict",
"warp_schedule"]
if args.arch not in ARCH_LIST:
print("Unsupported Gpu Arch: ", args.arch)
exit()
print(">>>")
for kernel in KERNEL_LIST:
source_sass = f"{kernel}.sass"
target_cubin = f"{kernel}.cubin"
target_kernel = camel_to_snake(kernel)
compile_command = f"python3 -m turingas.main -i ../sass_cubin/{source_sass} -o ../sass_cubin/{target_cubin} -arch {args.arch} -name {target_kernel}"
print(f" compile kernel: {target_kernel}")
os.system(compile_command)
print("<<<")