Skip to content

Commit

Permalink
Introduce a CMake compiler engine (facebookincubator#674)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookincubator#674

Reviewed By: ipiszy, chenyang78

Differential Revision: D45664779

fbshipit-source-id: 2220f1d30aa50df6b4dbbd11ea5ecf85b3079cf5
  • Loading branch information
Alexandr Guzhva authored and facebook-github-bot committed May 11, 2023
1 parent 0481d1b commit d1d66fb
Show file tree
Hide file tree
Showing 6 changed files with 507 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/source/reference/env.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Codegen

**AIT_MULTISTREAM_MAX_MEM_PARALLEL_OPS**: Maximum number of parallel operators used in memory planning for simple multi-stream mode. Default value is "99999999" (basically, unlimited).

**AIT_USE_CMAKE_COMPILATION**: (An experimental feature) If set to "1", then `cmake` will used instead of `make`. This allows to build AITemplate using MSVC Compiler + MSBuild on Windows, and it works for linux as well. This builder does not support many features (such as caching) yet. But it allows to generate a cmake project that can be loaded to a modern IDE. Default value is "0".

Profiling
---------

Expand Down
9 changes: 8 additions & 1 deletion python/aitemplate/backend/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

from aitemplate.utils.debug_settings import AITDebugSettings

from aitemplate.utils.environ import is_cmake_compilation
from aitemplate.utils.misc import is_debug, is_windows

# pylint: disable=W0221,C0103
Expand Down Expand Up @@ -898,5 +899,11 @@ def make(


def get_compile_engine():
compile_engine = Builder()
if is_cmake_compilation():
from aitemplate.backend.cuda import builder_cmake

compile_engine = builder_cmake.BuilderCMake()
else:
compile_engine = Builder()

return compile_engine
8 changes: 7 additions & 1 deletion python/aitemplate/backend/cuda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
"""
CUDA backend codegen functions.
"""
from aitemplate.backend.cuda import cuda_common, lib_template, target_def, utils
from aitemplate.backend.cuda import (
builder_cmake,
cuda_common,
lib_template,
target_def,
utils,
)
from aitemplate.backend.cuda.common import *
from aitemplate.backend.cuda.conv2d import *
from aitemplate.backend.cuda.conv3d import *
Expand Down
Loading

0 comments on commit d1d66fb

Please sign in to comment.