[build] support build sm 80,86,89,90 to one whl package (#6173)

* support build sm 80,86,89,90 to one whl package

* create tmp dir before build custom ops in FD_UNIFY_BUILD mode

* typo fix

* ignore exceptions in xpu ..
This commit is contained in:
wangyifei
2026-01-26 11:30:02 +08:00
committed by GitHub
parent b5b28eea94
commit 84a1780814
4 changed files with 74 additions and 26 deletions
+24 -1
View File
@@ -19,7 +19,30 @@ from fastdeploy.import_ops import import_custom_ops
PACKAGE = "fastdeploy.model_executor.ops.gpu"
import_custom_ops(PACKAGE, ".fastdeploy_ops", globals())
def decide_module():
import paddle
prop = paddle.device.cuda.get_device_properties()
sm_version = prop.major * 10 + prop.minor
print(f"current sm_version={sm_version}")
import os
curdir = os.path.dirname(os.path.abspath(__file__))
sm_version_path = os.path.join(curdir, f"fastdeploy_ops_{sm_version}")
if os.path.exists(sm_version_path):
return f".fastdeploy_ops_{sm_version}.fastdeploy_ops"
return ".fastdeploy_ops"
module_path = ".fastdeploy_ops"
try:
module_path = decide_module()
except Exception as e:
print(f"decide_module error, load custom_ops from .fastdeploy_ops: {e}")
pass
import_custom_ops(PACKAGE, module_path, globals())
def tolerant_import_error():