Skip to content

Commit 320e823

Browse files
authored
[0.7.3] Update patch timing and CMake to adjust to more user envs (#535)
### What this PR does / why we need it? To make compile adjust to more user envs. To make patch timing better to adjust to more conditions. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Tested the same as #416 Signed-off-by: Shuqiao Li <celestialli@outlook.com>
1 parent e5b746f commit 320e823

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(vllm_ascend_C)
33

44
# include(CheckCXXcompilerFlag)
55
# check_cxx_compiler_flag("-std=c++17", COMPILER_SUPPORTS_CXX17)
6-
6+
set(CMAKE_CXX_STANDARD 17)
77

88
include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake)
99

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def configure(self, ext: CMakeExtension) -> None:
123123
cmake_args += [f"-DCMAKE_BUILD_TYPE={envs.CMAKE_BUILD_TYPE}"]
124124
# Default dump the compile commands for lsp
125125
cmake_args += ["-DCMAKE_EXPORT_COMPILE_COMMANDS=1"]
126+
if envs.CXX_COMPILER is not None:
127+
cmake_args += [f"-DCMAKE_CXX_COMPILER={envs.CXX_COMPILER}"]
128+
if envs.C_COMPILER is not None:
129+
cmake_args += [f"-DCMAKE_C_COMPILER={envs.C_COMPILER}"]
126130
if envs.VERBOSE:
127131
cmake_args += ["-DCMAKE_VERBOSE_MAKEFILE=ON"]
128132

vllm_ascend/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
def register():
2020
"""Register the NPU platform."""
2121
# To ensure that the module is correctly replaced, add it at the beginning
22-
import vllm_ascend.patch_config # noqa: F401
2322
import vllm_ascend.patch_module # noqa: F401
2423
return "vllm_ascend.platform.NPUPlatform"
2524

vllm_ascend/device_allocator/camem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def find_loaded_library(lib_name) -> Optional[str]:
6565
init_module, python_create_and_map, python_unmap_and_release)
6666
lib_name = find_loaded_library("vllm_ascend_C")
6767
camem_available = True
68-
except ModuleNotFoundError as e:
68+
except ImportError as e:
6969
logger.error("Failed to import vllm_ascend_C:%s", e)
7070
init_module = None
7171
python_create_and_map = None

vllm_ascend/envs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
"LLMDATADIST_COMM_PORT":
2828
lambda: os.getenv("LLMDATADIST_COMM_PORT", "26000"),
2929
"LLMDATADIST_SYNC_CACHE_WAIT_TIME":
30-
lambda: os.getenv("LLMDATADIST_SYNC_CACHE_WAIT_TIME", "5000")
30+
lambda: os.getenv("LLMDATADIST_SYNC_CACHE_WAIT_TIME", "5000"),
31+
"CXX_COMPILER":
32+
lambda: os.getenv("CXX_COMPILER", None),
33+
"C_COMPILER":
34+
lambda: os.getenv("C_COMPILER", None)
3135
}
3236

3337

@@ -39,4 +43,4 @@ def __getattr__(name: str):
3943

4044

4145
def __dir__():
42-
return list(env_variables.keys())
46+
return list(env_variables.keys())

vllm_ascend/platform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class NPUPlatform(Platform):
6363
def pre_register_and_update(cls,
6464
parser: Optional[FlexibleArgumentParser] = None
6565
) -> None:
66+
import vllm_ascend.patch_config # noqa: F401
6667
from vllm_ascend.quantization.quant_config import \
6768
AscendQuantConfig # noqa: F401
6869

0 commit comments

Comments
 (0)