mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
# Motivation As mentioned in [[RFC] Intel GPU Runtime Upstreaming](https://github.com/pytorch/pytorch/issues/114842), The first runtime component we would like to upstream is `Device` which contains the device management functions of Intel GPU's runtime. To facilitate the code review, we split the code changes into 4 PRs. This is one of the 4 PRs and covers the changes under `c10`. # Design Intel GPU device is a wrapper of sycl device on which kernels can be executed. In our design, we will maintain a sycl device pool containing all the GPU devices of the current machine, and manage the status of the device pool by PyTorch. The thread local safe is considered in this design. The corresponding C++ files related to `Device` will be placed in c10/xpu folder. And we provide the c10 device runtime APIs, like - `c10::xpu::device_count` - `c10::xpu::set_device` - ... # Additional Context In our plan, 4 PRs should be submitted to PyTorch for `Device`: 1. for c10 2. for aten 3. for python frontend 4. for lazy initialization shared with CUDA Pull Request resolved: https://github.com/pytorch/pytorch/pull/116019 Approved by: https://github.com/gujinghui, https://github.com/jgong5, https://github.com/EikanWang, https://github.com/malfet
53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
load("//tools/build_defs:glob_defs.bzl", "subdir_glob")
|
|
|
|
cxx_library(
|
|
name = "c10",
|
|
srcs = glob(
|
|
["**/*.cpp"],
|
|
exclude = [
|
|
"test/**/*.cpp",
|
|
"benchmark/**/*.cpp",
|
|
"cuda/**/*.cpp",
|
|
"xpu/**/*.cpp",
|
|
],
|
|
),
|
|
deps = [
|
|
"//third_party:cpuinfo",
|
|
"//third_party:fmt",
|
|
"//third_party:glog",
|
|
],
|
|
exported_deps = [],
|
|
compiler_flags = [
|
|
"-Werror",
|
|
"-Wno-global-constructors",
|
|
"-DDISABLE_NAMEDTENSOR",
|
|
"-DSUPPORTS_BACKTRACE=0"
|
|
],
|
|
exported_headers = subdir_glob(
|
|
[
|
|
("", "**/*.h"),
|
|
],
|
|
exclude = [
|
|
"test/**/*.h",
|
|
"benchmark/**/*.h",
|
|
"cuda/**/*.h",
|
|
"xpu/**/*.h",
|
|
],
|
|
),
|
|
exported_linker_flags = [],
|
|
exported_preprocessor_flags = [
|
|
'-DC10_USING_CUSTOM_GENERATED_MACROS',
|
|
'-DC10_USE_GLOG',
|
|
'-DC10_USE_MINIMAL_GLOG',
|
|
'-DC10_MOBILE',
|
|
'-fexceptions',
|
|
'-Wno-global-constructors'
|
|
],
|
|
header_namespace = "c10",
|
|
link_whole = True,
|
|
platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]],
|
|
preprocessor_flags = ['-DC10_BUILD_MAIN_LIB'],
|
|
reexport_all_header_dependencies = True,
|
|
visibility = ['PUBLIC'],
|
|
)
|