forked from Xilinx/mlir-aie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlit.cfg.py
More file actions
executable file
·107 lines (83 loc) · 3.07 KB
/
lit.cfg.py
File metadata and controls
executable file
·107 lines (83 loc) · 3.07 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# ./lit.cfg.py -*- Python -*-
#
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Copyright (C) 2022, Advanced Micro Devices, Inc.
import os
import sys
# Add shared AIE lit utilities to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "python"))
import lit.formats
from lit.llvm import llvm_config
from aie_lit_utils import LitConfigHelper
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
config.name = "AIE_PROGRAMMING_GUIDE"
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
# suffixes: A list of file extensions to treat as test files.
config.suffixes = [".lit"]
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
# Setup standard environment (PYTHONPATH, AIETOOLS, system env, etc.)
LitConfigHelper.setup_standard_environment(
llvm_config, config, config.aie_obj_root, config.vitis_aietools_dir
)
# Add Vitis components as features
LitConfigHelper.add_vitis_components_features(config, config.vitis_components)
# Detect XRT and Ryzen AI NPU devices
xrt_config = LitConfigHelper.detect_xrt(
config.xrt_lib_dir,
config.xrt_include_dir,
config.xrt_bin_dir,
config.aie_src_root,
config.vitis_components,
)
llvm_config.use_default_substitutions()
# excludes: A list of files and directories to exclude from the testsuite
config.excludes = [
"lit.cfg.py",
]
config.aie_tools_dir = os.path.join(config.aie_obj_root, "bin")
# Setup the PATH with all necessary tool directories
LitConfigHelper.prepend_path(llvm_config, config.aie_tools_dir)
if config.vitis_root:
config.vitis_aietools_bin = os.path.join(config.vitis_aietools_dir, "bin")
LitConfigHelper.prepend_path(llvm_config, config.vitis_aietools_bin)
llvm_config.with_environment("VITIS", config.vitis_root)
# Prepend path to XRT installation, which contains a more recent `aiebu-asm` than the Vitis installation.
LitConfigHelper.prepend_path(llvm_config, config.xrt_bin_dir)
peano_tools_dir = os.path.join(config.peano_install_dir, "bin")
LitConfigHelper.prepend_path(llvm_config, config.llvm_tools_dir)
LitConfigHelper.prepend_path(llvm_config, peano_tools_dir)
config.substitutions.append(("%LLVM_TOOLS_DIR", config.llvm_tools_dir))
tool_dirs = [config.aie_tools_dir, config.llvm_tools_dir]
# Detect Peano backend
peano_config = LitConfigHelper.detect_peano(
peano_tools_dir, config.peano_install_dir, llvm_config
)
# Detect Chess compiler
chess_config = LitConfigHelper.detect_chess(
config.vitis_root, config.enable_chess_tests, llvm_config
)
# Apply all hardware/tool configurations
LitConfigHelper.apply_config_to_lit(
config,
{
"xrt": xrt_config,
"peano": peano_config,
"chess": chess_config,
},
)
tools = [
"aie-opt",
"aie-translate",
"aiecc",
"ld.lld",
"llc",
"llvm-objdump",
"opt",
"xchesscc_wrapper",
]
llvm_config.add_tool_substitutions(tools, tool_dirs)