Debian Codegraph @

tensilelite/Tensile/Tensile.py

raw symbols SCIP
1 ################################################################################
2 #
3 # Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
22 #
23 ################################################################################
24
25 if __name__ == "__main__":
26 print("This file can no longer be run as a script. Run 'Tensile/bin/Tensile' instead.")
27 exit(1)
28
29 import os
30 import subprocess
31 import sys
32 import argparse
33
34 from datetime import datetime
35 from pathlib import Path
36 from typing import Dict
37
38 from Tensile import __version__
39 from Tensile.Common import print1, printExit, printWarning, ensurePath, HR, isRhel8, \
40 LIBRARY_LOGIC_DIR, setVerbosity, IsaInfo, makeDebugConfig, \
41 DebugConfig, IsaVersion, coVersionMap
42 from Tensile.Common.Architectures import detectGlobalCurrentISA, isaToGfx
43 from Tensile.Common.Capabilities import makeIsaInfoMap
44 from Tensile.Common.GlobalParameters import globalParameters, assignGlobalParameters, \
45 restoreDefaultGlobalParameters
46 from Tensile.Toolchain.Assembly import AssemblyToolchain, makeAssemblyToolchain
47 from Tensile.Toolchain.Source import SourceToolchain, makeSourceToolchain
48 from Tensile.Toolchain.Validators import validateToolchain, ToolchainDefaults
49 from Tensile.Utilities.Decorators.Profile import profile
50 from Tensile import BenchmarkProblems
51 from Tensile import ClientWriter
52 from Tensile import LibraryIO
53 from Tensile import LibraryLogic
54
55 TENSILE_SCRIPT_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
56 TENSILE_CLIENT_PATH = Path('build_tmp') / 'tensilelite' / 'client' / 'tensilelite-client'
57 TENSILE_CLIENT_PATH = TENSILE_SCRIPT_DIR.parent / TENSILE_CLIENT_PATH
58
59 ###############################################################################
60 # Execute Steps in Config
61 # called from Tensile() below
62 # calls
63 # BenchmarkProblems.main() to run benchmark steps
64 # LibraryLogic.main() to analyse final benchmark data and produce logic/yaml
65 # ClientWriter.main() to create client which calls library based on above yaml
66 ################################################################################
67 @profile
68 def executeStepsInConfig(
69 config: dict,
70 outputPath: Path,
71 asmToolchain: AssemblyToolchain,
72 srcToolchain: SourceToolchain,
73 isaInfoMap: Dict[str, IsaInfo],
74 cCompiler: str,
75 debugConfig: DebugConfig,
76 deviceId: int,
77 probSolDict: dict
78 ):
79 """Conducts the steps in the provided ``config`` according to the Tensile workflow.
80
81 The top-level steps are:
82 1. BenchmarkProblems: Runs the benchmarking steps and generates the directories
83 build_tmp, 1_BenchmarkProblems, 2_BenchmarkData
84 2. LibraryLogic: Analyzes the benchmark data, makes logic files, and generates
85 the directory 3_LibraryLogic
86 3. LibraryClient: Makes the client callable libraries and generates the
87 directory 4_LibraryClient
88
89 Args:
90 config (dict): The configuration dictionary.
91 outputPath (Path): The path to the top-level build directory.
92 asmToolchain (AssemblyToolchain): The toolchain for making assembly kernels.
93 srcToolchain (SourceToolchain): The toolchain for making source kernels.
94 cCompiler (str): The C compiler to use.
95 """
96
97 buildTmpPath = outputPath / "build_tmp"
98 ##############################################################################
99 # Benchmark Problems
100 ##############################################################################
101 gfxName = isaToGfx(next(iter(isaInfoMap)))
102 if "BenchmarkProblems" in config:
103 BenchmarkProblems.main(
104 config["BenchmarkProblems"],
105 config["UseCache"],
106 asmToolchain,
107 srcToolchain,
108 cCompiler,
109 outputPath,
110 buildTmpPath,
111 debugConfig,
112 deviceId,
113 gfxName,
114 isaInfoMap,
115 probSolDict,
116 )
117 print1("")
118
119 ##############################################################################
120 # Library Logic
121 ##############################################################################
122 libraryLogicDataPath = os.path.join(outputPath, LIBRARY_LOGIC_DIR)
123 if "LibraryLogic" in config:
124 if os.path.exists(libraryLogicDataPath):
125 libraryLogicFiles = os.listdir(libraryLogicDataPath)
126 else:
127 libraryLogicFiles = []
128 if len(libraryLogicFiles) < 1 or globalParameters["ForceRedoLibraryLogic"]:
129 if config["LibraryLogic"] != None:
130 libraryLogicConfig = config["LibraryLogic"]
131 else:
132 libraryLogicConfig = {}
133 LibraryLogic.main(
134 libraryLogicConfig,
135 srcToolchain.compiler,
136 outputPath,
137 debugConfig.splitGSU,
138 debugConfig.printSolutionRejectionReason,
139 debugConfig.printIndexAssignmentInfo,
140 isaInfoMap,
141 )
142 print1("")
143 else:
144 print1("# LibraryLogic already done.")
145 print1("")
146
147 ##############################################################################
148 # Write Client
149 ##############################################################################
150 if "LibraryClient" in config:
151 if config["LibraryClient"] != None:
152 libraryClientConfig = config["LibraryClient"]
153 else:
154 libraryClientConfig = {}
155 ClientWriter.main(
156 libraryClientConfig,
157 asmToolchain.assembler,
158 cCompiler,
159 isaInfoMap,
160 outputPath,
161 deviceId,
162 gfxName,
163 )
164 print1("")
165
166
167 def addCommonArguments(argParser):
168 """
169 Add a common set of arguments to `argParser`.
170
171 Currently used by the main Tensile script and the unit tests but could also be used for TensileCreateLibrary.
172 """
173
174 def splitExtraParameters(par):
175 """
176 Allows the --global-parameters option to specify any parameters from the command line.
177 """
178 (key, value) = par.split("=")
179 value = eval(value)
180 return (key, value)
181
182 argParser.add_argument("-d", "--device", dest="device", default=0, type=int, \
183 help="override which device to benchmark")
184 argParser.add_argument("-p", "--platform", dest="platform", type=int, \
185 help="override which OpenCL platform to benchmark")
186 argParser.add_argument("--runtime-language", dest="RuntimeLanguage", \
187 choices=["HIP", "OCL"], help="override which runtime language to use")
188 argParser.add_argument("--code-object-version", dest="CodeObjectVersion", \
189 choices=["4", "5", "V4", "V5", "default"], action="store", default="4", help="HSA code-object version")
190 argParser.add_argument("-v", "--verbose", action="store_true", \
191 help="set PrintLevel=2")
192 argParser.add_argument("--debug", dest="debug", action="store_true", \
193 help="set PrintLevel=2 and CMakeBuildType=Debug")
194 argParser.add_argument("--cxx-compiler", dest="CxxCompiler", \
195 action="store", default=ToolchainDefaults.CXX_COMPILER, help="select which C++/HIP compiler to use")
196 argParser.add_argument("--c-compiler", dest="CCompiler", \
197 action="store", default=ToolchainDefaults.C_COMPILER, help="select which C compiler to use")
198 argParser.add_argument("--assembler", dest="Assembler", \
199 action="store", default=ToolchainDefaults.ASSEMBLER, help="select which assembler to use")
200 argParser.add_argument("--offload-bundler", dest="OffloadBundler", \
201 action="store", default=ToolchainDefaults.OFFLOAD_BUNDLER, help="select which offload bundler to use")
202 argParser.add_argument("--device-enumerator", dest="DeviceEnumerator", \
203 action="store", default=ToolchainDefaults.DEVICE_ENUMERATOR, help="select which device enumerator to use")
204 argParser.add_argument("--logic-format", dest="LogicFormat", choices=["yaml", "json"], \
205 action="store", default="yaml", help="select which logic format to use")
206 argParser.add_argument("--library-format", dest="LibraryFormat", choices=["yaml", "msgpack"], \
207 action="store", default="yaml", help="select which library format to use")
208 argParser.add_argument("--client-lock", default=None)
209 argParser.add_argument("--prebuilt-client", default=str(TENSILE_CLIENT_PATH),
210 type=os.path.abspath, help="Specify the full path to a pre-built tensilelite-client executable")
211
212 argParser.add_argument("--global-parameters", nargs="+", type=splitExtraParameters, default=[])
213
214
215 def argUpdatedGlobalParameters(args):
216 """
217 Returns a dictionary with `globalParameters` keys that should be updated based on `args`.
218 """
219 rv = {}
220 # override config with command-line options
221 if args.platform:
222 print1("# Command-line override: Platform")
223 rv["Platform"] = args.platform
224 if args.RuntimeLanguage:
225 print1("# Command-line override: RuntimeLanguage")
226 rv["RuntimeLanguage"] = args.RuntimeLanguage
227 if args.CodeObjectVersion:
228 print1("# Command-line override: CodeObjectVersion")
229 rv["CodeObjectVersion"] = args.CodeObjectVersion
230 if args.debug:
231 print1("# Command-line override: Debug")
232 rv["CMakeBuildType"] = "Debug"
233 if args.client_lock:
234 rv["ClientExecutionLockPath"] = args.client_lock
235 if args.prebuilt_client:
236 rv["PrebuiltClient"] = args.prebuilt_client
237
238 for key, value in args.global_parameters:
239 rv[key] = value
240
241 PyTestBuildArchNames = os.environ.get("PyTestBuildArchNames")
242 if PyTestBuildArchNames != None and len(PyTestBuildArchNames) > 0:
243 rv["Architecture"] = PyTestBuildArchNames
244
245 return rv
246
247 def get_gpu_max_frequency_smi(device_id):
248 '''
249 Get the maximum frequency of the specified GPU device
250 '''
251 try:
252 # Run rocm-smi command and capture output
253 result = subprocess.run(['rocm-smi', '-s'], capture_output=True, text=True)
254
255 if result.returncode != 0:
256 print(f"Error running rocm-smi: {result.stderr}")
257 return None
258
259 # Parse the output
260 lines = result.stdout.split('\n')
261 sclk_section = False
262 frequencies = []
263
264 # Look for the sclk section of the specified device
265 for line in lines:
266 line = line.split(" ")
267 if 'sclk' in line and f"GPU{device_id}" in line:
268 sclk_section = True
269 continue
270
271 # Parse frequencies in the sclk section
272 if sclk_section:
273 for part in line:
274 if part.endswith("Mhz"):
275 try:
276 frequency = part.replace("Mhz", "")
277 frequencies.append(int(frequency))
278 except ValueError:
279 print(f"Error parsing frequency: {part}")
280 break
281 if "socclk" in line:
282 break
283
284 # Return the maximum frequency found
285 return max(frequencies) if frequencies else None
286
287 except Exception as e:
288 print(f"Error: {e}")
289 return None
290
291 def get_gpu_max_frequency(device_id):
292 try:
293 from hip import hip
294 except ImportError:
295 print("HIP module not found. Installing it now...")
296 # Install the HIP module using pip
297 subprocess.run("python3 -m pip install --upgrade pip", shell=True)
298 subprocess.run("python3 -m pip install --index-url https://test.pypi.org/simple/ hip-python", shell=True)
299
300 from hip import hip
301 print("HIP module successfully installed.")
302
303 def hip_check(call_result):
304 err, result = call_result[0], call_result[1]
305 if isinstance(err, hip.hipError_t) and err != hip.hipError_t.hipSuccess:
306 return None
307 return result
308
309 attrib = hip.hipDeviceAttribute_t.hipDeviceAttributeClockRate
310 try:
311 freq = hip_check(hip.hipDeviceGetAttribute(attrib, device_id))
312 except:
313 freq = None
314
315 return freq // 1000 if freq else None
316
317 def get_user_max_frequency():
318 '''
319 Get the maximum frequency from the user when the GPU frequency cannot be determined
320 '''
321 while True:
322 try:
323 user_input = input("Please enter the maximum frequency (MHz): ")
324
325 frequency = int(user_input)
326
327 if frequency <= 0:
328 print("Error: Frequency must be greater than 0 MHz")
329 continue
330
331 return frequency
332
333 except ValueError:
334 print("Error: Please enter a valid number")
335 except Exception as e:
336 print(f"Error: {str(e)}")
337 print("Please try again")
338
339 def store_max_frequency(max_frequency):
340 try:
341 os.environ["MAX_FREQ"] = str(max_frequency)
342 return True
343 except Exception as e:
344 print(f"Error setting MAX_FREQ environment variable: {e}")
345 return False
346
347 def restore_prob_sol_map(logfile):
348
349 print(f"# Restore Previous Tuning From Log File: {str(logfile)}")
350
351 startHint = "run,problem-progress,"
352 finTuningHint = "clientExit"
353 finProblemHint = "####"
354 keyword = "Contraction"
355 runningTuning = False
356
357 prob_best_us_record = {}
358 prob_sol_map = {}
359 cur_prob_idx = -1
360 cur_sol_idx = -1
361 last_fin_prob = -1
362 allProblems = 0
363 allSolutions = 0
364
365 try:
366 with open(logfile, 'r') as sh_file:
367 # Iterate over each line in the file
368 for line in sh_file:
369 line = line.strip()
370 # run until we see a line: "run,problem-progress,...."
371 if not runningTuning:
372 runningTuning = line.startswith(startHint)
373 continue
374
375 # following lines should be the bench results
376 if runningTuning:
377 # we see a line with clientExit, then finish parsing log.
378 if line.startswith(finTuningHint):
379 print1(f'# Parsed log finished the tuning with line: {line}')
380 break
381
382 # a line starts and ends with "####" is printed in postProblem() which means the cur_prob completed tuning.
383 elif line.startswith(finProblemHint) and line.endswith(finProblemHint):
384 # print1(f'# Parsed Prob-Idx: {cur_prob_idx} completed tuning.')
385 last_fin_prob = cur_prob_idx
386
387 # not a valid tuning result line (a valid tuning result line contains "Contraction")
388 elif keyword not in line:
389 continue
390
391 # a valid tuning result line
392 else:
393 tokens = line.split('"')
394 # split by '"' to extract "(problem-size-desc)"
395 # there should be 3 tokens: { "some-info," , "(problem-size-desc)" , ",rest-of-other-info"}
396 assert len(tokens) == 3, f'bench result line: {line} is not fitting the expected format'
397 # original tokens[1] looks like "(M,N,B,K)", replace it with a string without comma
398 tokens[1] = 'problem-sizes'
399 newline = tokens[0] + tokens[1] + tokens[2]
400 # now the new line = "some-info, 'problem-sizes' , rest-of-other-info"
401 # 0,29/31,8/247,Contraction....,'problem-sizes',None,,None,[SOLUTION-NAME],[VALIDATION],[53.6248(us)],[63354.7(gflops)],.........
402 tokens = newline.split(',')
403 probInfo = tokens[1].split('/')
404 solInfo = tokens[2].split('/')
405 assert len(probInfo) == 2, f'tokens[1]: {tokens[1]} should be a token as probId/AllProb'
406 assert len(solInfo) == 2, f'tokens[2]: {tokens[2]} should be a token as solId/AllSol'
407 # solName = tokens[8] # Might be another choice to put in map...
408 usTimeInfo = float(tokens[10]) # tokens[10] should be the mju-sec
409 cur_prob_idx = int(probInfo[0])
410 cur_sol_idx = int(solInfo[0])
411
412 # This can handle logs with or without PrintWinnerOnly
413 current_best_us_for_prob = prob_best_us_record.get(cur_prob_idx)
414 if current_best_us_for_prob is None:
415 # print(f"None, added for probID: {probInfo[0]}, time: {usTimeInfo}")
416 prob_best_us_record.update( {cur_prob_idx : usTimeInfo} )
417 prob_sol_map.update( {cur_prob_idx : cur_sol_idx} )
418 else:
419 # update the winner if better
420 if usTimeInfo < current_best_us_for_prob:
421 # print(f"Better, updated for probID: {probInfo[0]}, new time: {usTimeInfo}, old time: {current_best_us_for_prob}")
422 prob_best_us_record.update( {cur_prob_idx : usTimeInfo} )
423 prob_sol_map.update( {cur_prob_idx : cur_sol_idx} )
424
425 # for printing information
426 if allProblems == 0:
427 allProblems = int(probInfo[1]) + 1
428 if allSolutions == 0:
429 allSolutions = int(solInfo[1]) + 1
430
431 # The final updated "cur_prob_idx" is not finished since we don't see its postProblem() "####" line
432 # -> The problem did not complete tuning, so we need to remove it from map
433 if cur_prob_idx != last_fin_prob:
434 prob_sol_map.pop(cur_prob_idx)
435 print1(f'# Parsed Prob-Idx {cur_prob_idx} did not complete tuning. Remove it from map.')
436
437 except FileNotFoundError:
438 print(f'Error: The file {logfile} was not found.')
439
440 except Exception as e:
441 print(f'An error occurred: {e}')
442
443 print(f"# Parsed log is for a '{allProblems}-problems-vs-{allSolutions}-solutions' tuning.")
444
445 return prob_sol_map
446
447
448 ################################################################################
449 # Tensile
450 # - below entry points call here
451 ################################################################################
452 def Tensile(userArgs):
453 global globalParameters
454
455 print1("")
456 print1(HR)
457 print1("#")
458 print1("# Tensile v%s" % (__version__))
459
460 argParser = argparse.ArgumentParser()
461 argParser.add_argument("ConfigFile", type=os.path.realpath, nargs="+",
462 help="Benchmark config.yaml file")
463 argParser.add_argument("OutputPath", \
464 help="Path to conduct benchmark and write output files")
465 argParser.add_argument("--version", action="version", \
466 version="%(prog)s {version}".format(version=__version__))
467 argParser.add_argument("--alternate-format", dest="AlternateFormat", action="store_true",
468 help="Alternate format for config_file(s): first file is alternate config "
469 "and optional second file is size list")
470 argParser.add_argument("--use-cache", dest="useCache", action="store_true",
471 help="Ignore cache; redo parameter forking and solution generation")
472 argParser.add_argument("--restore-from-log", type=str, dest="RestoreLog",
473 help="A log file captured in previous tuning. ONLY RELIABLE when configs yaml not changes")
474
475 addCommonArguments(argParser)
476 args = argParser.parse_args(userArgs)
477 configPaths = args.ConfigFile
478 altFormat = args.AlternateFormat
479 useCache = args.useCache
480 outputPath = Path(ensurePath(os.path.abspath(args.OutputPath)))
481 print1(f"# OutputPath: {str(outputPath)}")
482
483 setVerbosity(2 if (args.debug or args.verbose) else 1)
484
485 if altFormat and len(configPaths) > 2:
486 printExit("Only 1 or 2 config_files are accepted for the alternate config format: "
487 "the alternate config file and an optional size list")
488 elif not altFormat and len(configPaths) != 1:
489 printExit("Only 1 config_file is accepted for the default config format. "
490 "Did you mean to add '--alternate-formate'?")
491
492 prob_sol_map = {}
493 if args.RestoreLog:
494 restoreLogPath = Path(os.path.abspath(args.RestoreLog))
495 if not os.path.exists(restoreLogPath):
496 printExit(f'restore log file: {restoreLogPath} is not existing, abort. Please check')
497 prob_sol_map = restore_prob_sol_map(restoreLogPath)
498 for key,value in prob_sol_map.items():
499 print1(f'# Restored Prob-Solution From Log: [Prob:{key},Sol:{value}]')
500
501 # 2nd half of splash
502 if len(configPaths) == 1:
503 print1("# Config: {}".format(configPaths[0]))
504 else:
505 print1("# Configs: {} and {}".format(configPaths[0], configPaths[1]))
506 print1("# Date & Time: %s" % (datetime.now().strftime("%d/%m/%Y %H:%M:%S")))
507 print1("#")
508 print1(HR)
509 print1("")
510
511 print1("# Restoring default globalParameters")
512 restoreDefaultGlobalParameters()
513
514 if args.LogicFormat:
515 globalParameters['LogicFormat'] = args.LogicFormat
516 if args.LibraryFormat:
517 globalParameters['LibraryFormat'] = args.LibraryFormat
518 globalParameters['CodeObjectVersion'] = coVersionMap[args.CodeObjectVersion]
519 print1(f"# Code Object Version: {globalParameters['CodeObjectVersion']}")
520
521 # default config format
522 if not altFormat:
523 config = LibraryIO.read(configPaths[0])
524 # convert alternate format into default format
525 else:
526 base = LibraryIO.read(configPaths[0])
527 sizes = []
528 if len(configPaths) == 2:
529 sizes = LibraryIO.read(configPaths[1])
530
531 config = {"GlobalParameters": base.get("GlobalParameters")}
532 if "LibraryLogic" in base and len(sizes) > 0:
533 config["LibraryLogic"] = base["LibraryLogic"]
534 if "LibraryClient" in base and len(sizes) > 0:
535 config["LibraryClient"] = None
536
537 solParams = {
538 "BenchmarkCommonParameters": base.get("BenchmarkCommonParameters"),
539 "ForkParameters": base.get("ForkParameters"),
540 "GroupForkParameters": base.get("GroupForkParameters"),
541 "BenchmarkFinalParameters": [{
542 "ProblemSizes": sizes
543 }]
544 }
545 config["BenchmarkProblems"] = [[base["ProblemType"], solParams]]
546
547 config["UseCache"] = useCache
548 globalParameters["ConfigPath"] = configPaths
549
550 asm_debug = config["GlobalParameters"].get("AsmDebug", False)
551 device_id = config["GlobalParameters"].get("Device", int(args.device))
552 UseEffLike = config["GlobalParameters"].get("UseEffLike", globalParameters["UseEffLike"])
553 UseEffLike = False if isRhel8() else UseEffLike
554
555 if 'LibraryLogic' in config and UseEffLike:
556 max_frequency = get_gpu_max_frequency(device_id)
557
558 if not max_frequency or max_frequency <= 0:
559 max_frequency = get_gpu_max_frequency_smi(device_id) # Using rocm-smi just in case
560
561 if not max_frequency or max_frequency <= 0:
562 print(f"Could not detect valid GPU frequency for device {device_id}")
563 max_frequency = get_user_max_frequency()
564
565 print(f"Successfully retrieve Max frequency: {max_frequency} for device {device_id}")
566 store_max_frequency(max_frequency)
567
568 cxxCompiler, \
569 cCompiler, \
570 offloadBundler, \
571 enumerator = validateToolchain(args.CxxCompiler,
572 args.CCompiler,
573 args.OffloadBundler,
574 ToolchainDefaults.DEVICE_ENUMERATOR)
575 asmToolchain = makeAssemblyToolchain(
576 cxxCompiler,
577 offloadBundler,
578 args.CodeObjectVersion,
579 debug=asm_debug,
580 )
581 srcToolchain = makeSourceToolchain(
582 cxxCompiler,
583 offloadBundler,
584 )
585
586 if "ISA" in config["GlobalParameters"]:
587 isaList = [IsaVersion(isa[0], isa[1], isa[2]) for isa in config["GlobalParameters"]["ISA"]]
588
589 else:
590 isaList = [detectGlobalCurrentISA(device_id, enumerator)]
591
592 if IsaVersion(9,5,0) in isaList:
593 printWarning("HardwareMonitor currently disabled for gfx950")
594 globalParameters["HardwareMonitor"] = False
595
596 isaInfoMap = makeIsaInfoMap(isaList, cxxCompiler)
597 assignGlobalParameters(config.get("GlobalParameters", {}), isaInfoMap)
598
599 overrideParameters = argUpdatedGlobalParameters(args)
600
601 debugConfig = makeDebugConfig(config["GlobalParameters"])
602
603 for key, value in overrideParameters.items():
604 print("Overriding {0}={1}".format(key, value))
605 globalParameters[key] = value
606
607 if "MaxFileName" in globalParameters or "MaxFileName" in config:
608 printWarning("MaxFileName is no longer configurable, it will be automatically set to 64")
609
610 executeStepsInConfig(config, outputPath, asmToolchain, srcToolchain, isaInfoMap, cCompiler, debugConfig, device_id, prob_sol_map)
611
612 def TensileConfigPath(*args):
613 return os.path.join(os.path.dirname(os.path.realpath(__file__)), "Configs", *args)
614
615
616 def TensileTestPath(*args):
617 return os.path.join(os.path.dirname(os.path.realpath(__file__)), "Tests", *args)
618
619
620 ################################################################################
621 # Entry points
622 # the first several of these can be deprecated, only main() is used
623 ################################################################################
624
625
626 # installed "tensile_rocblas_sgemm" command
627 def TensileROCBLASSGEMM():
628 Tensile([TensileConfigPath("rocblas_sgemm.yaml"), "."])
629
630
631 # installed "tensile_rocblas_dgemm" command
632 def TensileROCBLASDGEMM():
633 Tensile([TensileConfigPath("rocblas_dgemm.yaml"), "."])
634
635
636 # installed "tensile_rocblas_cgemm" command
637 def TensileROCBLASCGEMM():
638 Tensile([TensileConfigPath("rocblas_cgemm.yaml"), "."])
639
640
641 # installed "tensile_rocblas_zgemm" command
642 def TensileROCBLASZGEMM():
643 Tensile([TensileConfigPath("rocblas_zgemm.yaml"), "."])
644
645
646 # installed "tensile_sgemm" command
647 def TensileSGEMM5760():
648 Tensile([TensileConfigPath("sgemm_5760.yaml"), "."])
649
650
651 # installed "tensile" command
652 def main():
653 Tensile(sys.argv[1:])