[Misc] Add ACL_OP_INIT_MODE env var and set default to 1 (#597)

### What this PR does / why we need it?
Fix the bug in torch 2.5.1 that raising segment fault when enable
`pin_memory` while creating a tensor using `torch.tensor`.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

---------

Signed-off-by: shen-shanshan <467638484@qq.com>
This commit is contained in:
Shanshan Shen
2025-06-06 20:22:51 +08:00
committed by GitHub
parent 11a7df4270
commit 5d0e9fd19a
2 changed files with 11 additions and 0 deletions

View File

@@ -112,6 +112,15 @@ env_variables: Dict[str, Callable[[], Any]] = {
"VLLM_ASCEND_MODEL_EXECUTE_TIME_OBSERVE":
lambda: bool(int(os.getenv("VLLM_ASCEND_MODEL_EXECUTE_TIME_OBSERVE", '0'))
),
# VLLM_ASCEND_ACL_OP_INIT_MODE:
# 0: default, normal init.
# 1: delay init until launch aclops.
# 2: forbid aclops init and launch.
# Find more details at https://gitee.com/ascend/pytorch/pulls/18094
# We set this var default to `1` in vllm-ascend to avoid segment fault when
# enable `pin_memory` while creating a tensor using `torch.tensor`.
"VLLM_ASCEND_ACL_OP_INIT_MODE":
lambda: os.getenv("VLLM_ASCEND_ACL_OP_INIT_MODE", '1'),
}
# end-env-vars-definition