Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sycl/test-e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ unavailable.
* **gpu-intel-dg2** - Intel GPU DG2 availability;
* **gpu-intel-pvc** - Intel GPU PVC availability;
* **dump_ir**: - compiler can / cannot dump IR;
* **llvm-spirv** - llvm-spirv tool availability;
* **llvm-link** - llvm-link tool availability;

## llvm-lit parameters

Expand Down
45 changes: 30 additions & 15 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import lit.util

from lit.llvm import llvm_config
from lit.llvm.subst import ToolSubst, FindTool

# Configuration file for the 'lit' test runner.

Expand All @@ -34,6 +35,9 @@
# test_exec_root: The root path where tests should be run.
config.test_exec_root = config.sycl_obj_root

# allow expanding substitutions that are based on other substitutions
config.recursiveExpansionLimit = 10

# Cleanup environment variables which may affect tests
possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS',
'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH',
Expand Down Expand Up @@ -385,7 +389,6 @@

if config.run_launcher:
config.substitutions.append(('%e2e_tests_root', config.test_source_root))
config.recursiveExpansionLimit = 10

if config.sycl_be == 'ext_oneapi_cuda' or (config.sycl_be == 'ext_oneapi_hip' and config.hip_platform == 'NVIDIA'):
config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda" ) )
Expand All @@ -394,9 +397,6 @@
else:
config.substitutions.append( ('%sycl_triple', "spir64" ) )

if find_executable('sycl-ls'):
config.available_features.add('sycl-ls')

# TODO properly set XPTIFW include and runtime dirs
xptifw_lib_dir = os.path.join(config.dpcpp_root_dir, 'lib')
xptifw_dispatcher = ""
Expand All @@ -413,17 +413,32 @@
else:
config.substitutions.append(('%xptifw_lib', " -L{} -lxptifw -I{} ".format(xptifw_lib_dir, xptifw_includes)))


llvm_tools = ["llvm-spirv", "llvm-link"]
for llvm_tool in llvm_tools:
llvm_tool_path = find_executable(llvm_tool)
if llvm_tool_path:
lit_config.note("Found " + llvm_tool)
config.available_features.add(llvm_tool)
config.substitutions.append( ('%' + llvm_tool.replace('-', '_'),
os.path.realpath(llvm_tool_path)) )
else:
lit_config.warning("Can't find " + llvm_tool)
# Tools for which we add a corresponding feature when available.
feature_tools = [
ToolSubst('llvm-spirv', unresolved='ignore'),
ToolSubst('llvm-link', unresolved='ignore'),
]

tools = [
ToolSubst('FileCheck', unresolved='ignore'),
# not is only substituted in certain circumstances; this is lit's default
# behaviour.
ToolSubst(r'\| \bnot\b', command=FindTool('not'),
verbatim=True, unresolved='ignore'),
ToolSubst('sycl-ls', unresolved='ignore'),
] + feature_tools

# Try and find each of these tools in the llvm tools directory or the PATH, in
# that order. If found, they will be added as substitutions with the full path
# to the tool. This allows us to support both in-tree builds and standalone
# builds, where the tools may be externally defined.
llvm_config.add_tool_substitutions(tools, [config.llvm_tools_dir,
os.environ.get('PATH', '')])
for tool in feature_tools:
if tool.was_resolved:
config.available_features.add(tool.key)
else:
lit_config.warning("Can't find " + tool.key)

if find_executable('cmc'):
config.available_features.add('cm-compiler')
Expand Down