You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lit.cfg.py 1.8 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # -*- coding: utf-8 -*-
  2. # MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  3. #
  4. # Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
  5. #
  6. # Unless required by applicable law or agreed to in writing,
  7. # software distributed under the License is distributed on an
  8. # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. import os
  10. import platform
  11. import re
  12. import subprocess
  13. import tempfile
  14. import lit.formats
  15. import lit.util
  16. from lit.llvm import llvm_config
  17. from lit.llvm.subst import ToolSubst
  18. from lit.llvm.subst import FindTool
  19. # Configuration file for the 'lit' test runner.
  20. # name: The name of this test suite.
  21. config.name = 'MLIR_TEST'
  22. config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
  23. # suffixes: A list of file extensions to treat as test files.
  24. config.suffixes = ['.mlir']
  25. # test_source_root: The root path where tests are located.
  26. config.test_source_root = os.path.join(os.path.dirname(__file__), '../ir')
  27. # test_exec_root: The root path where tests should be run.
  28. config.test_exec_root = config.test_source_root
  29. # llvm_config.use_default_substitutions()
  30. # Tweak the PATH to include the tools dir.
  31. llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
  32. tool_dirs = [
  33. os.path.join(config.mgb_obj_root, 'tools/mlir'),
  34. os.path.join(config.mgb_obj_root, 'tools/mlir/mgb-opt'),
  35. os.path.join(config.mgb_obj_root, 'tools/mlir/mgb-file-check'),
  36. config.llvm_tools_dir]
  37. tool_names = [
  38. 'mgb-opt',
  39. 'mlir-tblgen',
  40. 'mlir-translate',
  41. 'mgb-file-check',
  42. ]
  43. tools = [ToolSubst(s, unresolved='ignore') for s in tool_names]
  44. llvm_config.add_tool_substitutions(tools, tool_dirs)
  45. lit.llvm.initialize(lit_config, config)

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台