Skip to content

Commit 6ae1864

Browse files
q10facebook-github-bot
authored andcommitted
Add FB python sources into genai CMakeLists.txt (#3886)
Summary: X-link: facebookresearch/FBGEMM#978 Pull Request resolved: #3886 - Add FB python sources into genai CMakeLists.txt Reviewed By: renganxu Differential Revision: D71930483
1 parent ee4c88b commit 6ae1864

File tree

6 files changed

+26
-8
lines changed

6 files changed

+26
-8
lines changed

.github/scripts/fbgemm_gpu_build.bash

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,20 @@ __configure_fbgemm_gpu_build () {
357357

358358
# Set debugging options
359359
if [ "$fbgemm_release_channel" != "release" ] || [ "$BUILD_DEBUG" -eq 1 ]; then
360+
echo "[BUILD] Enabling debug features in the build ..."
360361
build_args+=(
361362
--debug
362363
)
363364
fi
364365

366+
# Set FB-only options
367+
if [ "$BUILD_INCLUDE_FB_ONLY" -eq 1 ]; then
368+
echo "[BUILD] Enabling build of FB-only code ..."
369+
build_args+=(
370+
--use_fb_only
371+
)
372+
fi
373+
365374
# shellcheck disable=SC2145
366375
echo "[BUILD] FBGEMM_GPU build arguments have been set: ${build_args[@]}"
367376
}

.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
BUILD_ENV: build_binary
5050
BUILD_VARIANT: genai
5151
BUILD_CUDA_VERSION: ${{ matrix.cuda-version }}
52+
# BUILD_INCLUDE_FB_ONLY: 1
5253
continue-on-error: true
5354
strategy:
5455
fail-fast: false

fbgemm_gpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
2626
option(FBGEMM_CPU_ONLY "Build FBGEMM_GPU without GPU support" OFF)
2727
option(USE_ROCM "Build FBGEMM_GPU for ROCm" OFF)
2828
option(FBGEMM_GENAI_ONLY "Build FBGEMM_GPU with GEN AI only support" OFF)
29-
option(USE_FB_ONLY "Build FBGEMM_GPU FB only operators" OFF)
29+
option(USE_FB_ONLY "Build FBGEMM_GPU FB-only operators" OFF)
3030

3131
if((NOT FBGEMM_CPU_ONLY) AND
3232
((EXISTS "/opt/rocm/") OR (EXISTS $ENV{ROCM_PATH})) AND

fbgemm_gpu/bench/tbe/split_table_batched_embeddings_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import os
1313
import tempfile
1414
from contextlib import nullcontext
15-
from typing import Any, Callable, Dict, List, Optional
15+
from typing import Any, Callable, Dict, Optional
1616

1717
import click
1818
import numpy as np

fbgemm_gpu/experimental/gen_ai/CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ file(GLOB experimental_gen_ai_cpp_source_files_gpu
2828

2929
# Set the source file for FB only CPP
3030
if(USE_FB_ONLY)
31-
file(GLOB fb_only_ops_sources
32-
fb/src/*/*.cu
33-
fb/src/*/*.cpp)
34-
list(APPEND experimental_gen_ai_cpp_source_files_gpu ${fb_only_ops_sources})
31+
file(GLOB fb_only_cxx_sources
32+
fb/src/moe/*.cu
33+
fb/src/moe/*.cpp
34+
fb/src/trt_llm/*.cu
35+
fb/src/trt_llm/*.cpp)
36+
list(APPEND experimental_gen_ai_cpp_source_files_gpu ${fb_only_cxx_sources})
3537
endif()
3638

3739
# CUDA-specific sources
@@ -82,3 +84,9 @@ add_to_package(
8284
DESTINATION fbgemm_gpu/experimental/gen_ai
8385
TARGETS fbgemm_gpu_experimental_gen_ai
8486
FILES ${experimental_gen_ai_python_source_files})
87+
88+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/fb/gen_ai)
89+
install(
90+
DIRECTORY fb/gen_ai
91+
DESTINATION fbgemm_gpu/experimental)
92+
endif()

fbgemm_gpu/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def from_args(cls, argv: List[str]):
7979
parser.add_argument(
8080
"--use_fb_only",
8181
action="store_true",
82-
help="Build FB only operators.",
82+
help="Build FB-only operators.",
8383
)
8484
parser.add_argument(
8585
"--cxxprefix",
@@ -93,7 +93,7 @@ def from_args(cls, argv: List[str]):
9393
print(f"[SETUP.PY] Other arguments: {other_args}")
9494
return FbgemmGpuBuild(setup_py_args, other_args)
9595

96-
def nova_flag(self) -> Optional[bool]:
96+
def nova_flag(self) -> Optional[int]:
9797
if "BUILD_FROM_NOVA" in os.environ:
9898
if str(os.getenv("BUILD_FROM_NOVA")) == "0":
9999
return 0

0 commit comments

Comments
 (0)