forked from iree-org/iree-nvgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
107 lines (76 loc) · 4.87 KB
/
Copy pathCMakeLists.txt
File metadata and controls
107 lines (76 loc) · 4.87 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
# Copyright 2023 The OpenXLA Authors
#
# 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
cmake_minimum_required(VERSION 3.21...3.24)
project(OPENXLA_NVGPU)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(OPENXLA_NVGPU_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# TODO: Fix this once the project is slotted into place.
if(NOT IREE_ROOT_DIR)
set(IREE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../iree")
endif()
set(IREE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
# Enable testing before any subdirectories are added.
enable_testing()
#-------------------------------------------------------------------------------
# Customize IREE defaults.
#-------------------------------------------------------------------------------
option(IREE_BUILD_COMPILER "Enable IREE compiler build" ON)
option(IREE_BUILD_SAMPLES "Disable IREE samples build" OFF)
option(IREE_HAL_DRIVER_DEFAULTS "Disable all HAL drivers by default" OFF)
option(IREE_HAL_DRIVER_CUDA "Enables the 'cuda' runtime HAL driver" ON)
option(IREE_TARGET_BACKEND_DEFAULTS "Disables target backend" OFF)
option(IREE_TARGET_BACKEND_CUDA "Enables CUDA target backend" ON)
option(IREE_COMPILER_BUILD_SHARED_LIBS "Enables shared libraries in the compiler by default" ON)
# TODO(ezhulenev): We enable LLVM CPU target backend only to build `iree-lld`
# tool currently required by the Python bindings. We should figure out how
# to remove this dependency, because we don't need it for CUDA backend.
option(IREE_TARGET_BACKEND_LLVM_CPU "Enables LLVM CPU target backend" ON)
#-------------------------------------------------------------------------------
# Customize IREE LIT test runner.
#-------------------------------------------------------------------------------
# TODO(ezhulenev): Python3 executable and LLVM LIT are required for running lit
# tests under `runtime` folder. Figure out how to initialize them as a part of
# `iree_setup_toolchain` invoked below.
find_package(Python3 COMPONENTS Interpreter QUIET)
set(IREE_TEST_TMPDIR_ROOT "${CMAKE_CURRENT_BINARY_DIR}/test_tmpdir")
set(LLVM_EXTERNAL_LIT "${IREE_ROOT_DIR}/third_party/llvm-project/llvm/utils/lit/lit.py")
#-------------------------------------------------------------------------------
# Add OpenXLA Nvgpu compiler plugin to IREE compiler tools.
#-------------------------------------------------------------------------------
set(IREE_COMPILER_PLUGIN_PATHS "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "OpenXLA Nvgpu plugins")
#-------------------------------------------------------------------------------
# Add OpenXLA Nvgpu runtime modules too IREE runtime tools.
#-------------------------------------------------------------------------------
set(IREE_EXTERNAL_TOOLING_MODULES "cudnn" CACHE STRING "OpenXLA Nvgpu cuDNN module")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime/src/openxla/runtime/nvgpu" CACHE STRING "OpenXLA Nvgpu cuDNN module source dir")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/runtime/src/openxla/runtime/nvgpu" CACHE STRING "OpenXLA Nvgpu cuDNN module binary dir")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_TARGET "openxla_runtime_nvgpu_cudnn_cudnn_module" CACHE STRING "OpenXLA Nvgpu cuDNN module target")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_NAME "cudnn" CACHE STRING "OpenXLA Nvgpu cuDNN module name")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_REGISTER_TYPES "openxla_nvgpu_cudnn_module_register_types" CACHE STRING "OpenXLA Nvgpu cuDNN module type registration")
set(IREE_EXTERNAL_TOOLING_MODULE_CUDNN_CREATE "openxla_nvgpu_cudnn_module_create" CACHE STRING "OpenXLA Nvgpu cuDNN module creator")
#-------------------------------------------------------------------------------
# Set up IREE toolchain with OpenXLA Nvgpu modules.
#-------------------------------------------------------------------------------
add_subdirectory("${IREE_ROOT_DIR}" "iree_core")
# Handle various global definitions that need to be set at the global
# toolchain level.
iree_setup_toolchain()
#-------------------------------------------------------------------------------
# OpenXLA NVGPU Runtime.
#
# Integration of libraries with IREE runtime via custom VM modules.
#-------------------------------------------------------------------------------
add_subdirectory(runtime)
#-------------------------------------------------------------------------------
# NVIDIA dependencies
#-------------------------------------------------------------------------------
add_subdirectory(build_tools/third_party/cudnn-frontend EXCLUDE_FROM_ALL)
#-------------------------------------------------------------------------------
# Triton dependencies
#-------------------------------------------------------------------------------
add_subdirectory(build_tools/third_party/triton EXCLUDE_FROM_ALL)