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
21 changes: 11 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ bin
# cmake build directory
build
.lintbin
nvfuser/version.py
nvfuser/include
nvfuser/lib
nvfuser/share
nvfuser/cmake

python/build
nvfuser_common/version.py
nvfuser_common/include
nvfuser_comon/lib
nvfuser_common/share
nvfuser_common/cmake

python/nvfuser/version.py
python/nvfuser/include
python/nvfuser/lib
python/nvfuser/share
python/nvfuser/cmake
python/nvfuser_common/build
python/nvfuser_common/include
python/nvfuser_common/lib
python/nvfuser_common/share
python/nvfuser_common/cmake

.hypothesis
*.egg-info/
Expand Down
23 changes: 12 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(NVFUSER_ROOT ${PROJECT_SOURCE_DIR})
set(NVFUSER_SRCS_DIR "${NVFUSER_ROOT}/csrc")
set(NVFUSER_PYTHON_DIR "${NVFUSER_ROOT}/python")
set(NVFUSER_PYTHON_BINDINGS "${NVFUSER_ROOT}/python/python_frontend")
set(NVFUSER_THIRD_PARTY_DIR "${NVFUSER_ROOT}/third_party")

option(NVFUSER_STANDALONE_BUILD_WITH_UCC "" OFF)
Expand Down Expand Up @@ -296,13 +297,13 @@ endif()

if(BUILD_PYTHON)
list(APPEND NVFUSER_SRCS
${NVFUSER_PYTHON_DIR}/python_frontend/distributed_tensor.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/fusion_cache.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/fusion_definition.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/fusion_state.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/segmentation.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/translation.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/translation_utils.cpp
${NVFUSER_PYTHON_BINDINGS}/distributed_tensor.cpp
${NVFUSER_PYTHON_BINDINGS}/fusion_cache.cpp
${NVFUSER_PYTHON_BINDINGS}/fusion_definition.cpp
${NVFUSER_PYTHON_BINDINGS}/fusion_state.cpp
${NVFUSER_PYTHON_BINDINGS}/segmentation.cpp
${NVFUSER_PYTHON_BINDINGS}/translation.cpp
${NVFUSER_PYTHON_BINDINGS}/translation_utils.cpp
${NVFUSER_SRCS_DIR}/serde/fusion_record.cpp
)
endif()
Expand Down Expand Up @@ -465,10 +466,10 @@ if(BUILD_PYTHON)
# nvfuser python API sources
set(NVFUSER_PYTHON_SRCS)
list(APPEND NVFUSER_PYTHON_SRCS
${NVFUSER_PYTHON_DIR}/python_frontend/multidevice_bindings.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/python_bindings.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/python_bindings_extension.cpp
${NVFUSER_PYTHON_DIR}/python_frontend/schedule_bindings.cpp
${NVFUSER_PYTHON_BINDINGS}/multidevice_bindings.cpp
${NVFUSER_PYTHON_BINDINGS}/python_bindings.cpp
${NVFUSER_PYTHON_BINDINGS}/python_bindings_extension.cpp
${NVFUSER_PYTHON_BINDINGS}/schedule_bindings.cpp
)

add_library(nvf_py_internal OBJECT ${NVFUSER_PYTHON_SRCS})
Expand Down
2 changes: 1 addition & 1 deletion examples/sinh_extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# Ensure nvfuser is installed before trying to find its path
try:
nvfuser_spec = importlib.util.find_spec("nvfuser")
nvfuser_spec = importlib.util.find_spec("nvfuser_common")
if nvfuser_spec is None or nvfuser_spec.origin is None:
raise ImportError("Could not find nvfuser. Is it installed?")
nvfuser_lib_dir = str(pathlib.Path(nvfuser_spec.origin).parent / "lib")
Expand Down
2 changes: 1 addition & 1 deletion examples/sinh_libtorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
```
mkdir build
cd build
CMAKE_PREFIX_PATH=$(python -c 'import nvfuser.utils; import torch.utils; print(nvfuser.utils.cmake_prefix_path, torch.utils.cmake_prefix_path, sep=";")')
CMAKE_PREFIX_PATH=$(python -c 'import nvfuser_common.utils; import torch.utils; print(nvfuser_common.utils.cmake_prefix_path, torch.utils.cmake_prefix_path, sep=";")')
cmake -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -G Ninja ..
cmake --build .
```
Expand Down
3 changes: 3 additions & 0 deletions python/nvfuser_common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-present NVIDIA CORPORATION & AFFILIATES.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
2 changes: 1 addition & 1 deletion python/nvfuser/utils.py → python/nvfuser_common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

cmake_prefix_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"nvfuser",
"nvfuser_common",
"share",
"cmake",
"nvfuser",
Expand Down
12 changes: 8 additions & 4 deletions python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ def build_extension(self, ext):
filename = self.get_ext_filename(self.get_ext_fullname(ext.name))
fileext = os.path.splitext(filename)[1]

libnvfuser_path = os.path.join("./nvfuser/lib", f"libnvfuser{fileext}")
libnvfuser_path = os.path.join(
"./nvfuser_common/lib", f"libnvfuser{fileext}"
)
assert os.path.exists(libnvfuser_path)
install_dst = os.path.join(self.build_lib, filename)
if not os.path.exists(os.path.dirname(install_dst)):
Expand Down Expand Up @@ -391,7 +393,9 @@ def cmake(config, relative_path):
os.makedirs(cmake_build_dir)

install_prefix = (
os.path.join(cwd, "nvfuser") if not config.install_dir else config.install_dir
os.path.join(cwd, "nvfuser_common")
if not config.install_dir
else config.install_dir
)

from tools.gen_nvfuser_version import (
Expand Down Expand Up @@ -518,7 +522,7 @@ def run(config, version_tag, relative_path):
# NOTE: package include files for cmake
# TODO(crcrpar): Better avoid hardcoding `libnvfuser_codegen.so`
# might can be treated by using `exclude_package_data`.
nvfuser_package_data = [
nvfuser_common_package_data = [
"lib/libnvfuser_codegen.so",
"include/nvfuser/*.h",
"include/nvfuser/struct.inl",
Expand Down Expand Up @@ -559,7 +563,7 @@ def run(config, version_tag, relative_path):
"clean": create_clean(relative_path),
},
package_data={
"nvfuser": nvfuser_package_data,
"nvfuser_common": nvfuser_common_package_data,
},
install_requires=config.install_requires,
extras_require={
Expand Down