Debian Codegraph @

tensilelite/Tensile/TensileLogic/ParseArguments.py

raw symbols SCIP
1 ################################################################################
2 #
3 # Copyright (C) 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 from argparse import ArgumentParser
26
27 from Tensile.Toolchain.Validators import ToolchainDefaults
28
29
30 def parseArguments():
31 """
32 Returns:
33 A dictionary containing the keys representing options and their values.
34 """
35
36 argParser = ArgumentParser(
37 description="TensileLogic runs critical checks to ensure the "
38 "integrity of the supplied logic files.",
39 )
40 argParser.add_argument("LogicPath", help="path to library logic (yaml) files")
41
42 argParser.add_argument(
43 "-v",
44 "--verbose",
45 dest="Verbose",
46 type=int,
47 default=1,
48 choices=[0, 1, 2, 3],
49 help="set print level with `-v 2`",
50 )
51 argParser.add_argument(
52 "--jobs",
53 "-j",
54 dest="Jobs",
55 action="store",
56 default=48,
57 help="number of worker processes to use during validation checks",
58 )
59 argParser.add_argument(
60 "--cxx-compiler",
61 dest="CxxCompiler",
62 action="store",
63 default=ToolchainDefaults.CXX_COMPILER,
64 help=f"default: {ToolchainDefaults.CXX_COMPILER}",
65 )
66
67 group = argParser.add_mutually_exclusive_group()
68 group.add_argument(
69 "--check-all", dest="CheckAll", action="store_true", help="run all logic file checks"
70 )
71 group.add_argument(
72 "--check-only-custom-kernels",
73 dest="CheckOnlyCustomKernels",
74 action="store_true",
75 help="run logic file checks only on custom kernels",
76 )
77 args = argParser.parse_args()
78
79 return args