5
5
6
6
import argparse
7
7
import json
8
+ import os
8
9
import re
10
+ import sys
11
+ from os .path import abspath , exists
9
12
from pathlib import Path
10
13
11
14
from typing import Any , Dict , List , Tuple
15
18
"name" : "gcp-h100-runner" ,
16
19
"gpu_count" : 1 ,
17
20
"avail_gpu_mem_in_gb" : 80 ,
18
- }
21
+ },
22
+ "amd-mi350-runner" : {
23
+ "name" : "amd-mi350-runner" ,
24
+ "gpu_count" : 1 ,
25
+ "avail_gpu_mem_in_gb" : 288 ,
26
+ },
19
27
}
20
28
21
29
30
+ def setup_tritonbench_cwd ():
31
+ original_dir = abspath (os .getcwd ())
32
+
33
+ for tritonbench_dir in (
34
+ "." ,
35
+ "../../tritonbench" ,
36
+ ):
37
+ if exists (tritonbench_dir ):
38
+ break
39
+
40
+ if exists (tritonbench_dir ):
41
+ tritonbench_dir = abspath (tritonbench_dir )
42
+ os .chdir (tritonbench_dir )
43
+ sys .path .append (tritonbench_dir )
44
+ return original_dir
45
+
46
+
47
+ setup_tritonbench_cwd ()
48
+
49
+ from tritonbench .utils .scuba_utils import get_github_env
50
+
51
+
22
52
def parse_runners (
23
53
runner_name : str , runner_type : str , envs : Dict [str , str ]
24
54
) -> List [Dict [str , Any ]]:
@@ -130,6 +160,11 @@ def v3_json_to_str(v3_json: List[Dict[str, Any]], to_lines: bool = True) -> str:
130
160
required = True ,
131
161
help = "Upload benchmark result json file." ,
132
162
)
163
+ parser .add_argument (
164
+ "--add-github-env" ,
165
+ action = "store_true" ,
166
+ help = "Add github env to the result json file." ,
167
+ )
133
168
parser .add_argument ("--output" , required = True , help = "output json." )
134
169
args = parser .parse_args ()
135
170
upload_file_path = Path (args .json )
@@ -138,8 +173,13 @@ def v3_json_to_str(v3_json: List[Dict[str, Any]], to_lines: bool = True) -> str:
138
173
), f"Specified result json path { args .json } does not exist."
139
174
with open (upload_file_path , "r" ) as fp :
140
175
benchmark_result = json .load (fp )
141
- oss_ci_v3_json = generate_oss_ci_benchmark_v3_json (benchmark_result )
142
- out_str = v3_json_to_str (oss_ci_v3_json )
176
+ if args .add_github_env :
177
+ github_env = get_github_env ()
178
+ benchmark_result ["github" ] = github_env
179
+ out_str = v3_json_to_str (benchmark_result , to_lines = False )
180
+ else :
181
+ oss_ci_v3_json = generate_oss_ci_benchmark_v3_json (benchmark_result )
182
+ out_str = v3_json_to_str (oss_ci_v3_json )
143
183
output_dir = Path (args .output ).parent
144
184
output_dir .mkdir (parents = True , exist_ok = True )
145
185
with open (args .output , "w" ) as fp :
0 commit comments