Skip to content

Commit cc1db2a

Browse files
authored
default enable npu launch (#188)
1 parent 2fd4bc5 commit cc1db2a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

dlinfer/graph/dicp/vendor/AtbGraph/codegen/runtime/model.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ atb::Tensor Model::CreateInternalTensorFromDesc(const atb::TensorDesc& tensorDes
159159

160160
Model::Model(const std::string& modelId, const std::string& modelPath) : modelId_(modelId), modelPath_(modelPath) {
161161
const char* envStr = std::getenv("DICP_USE_TORCH_NPU_LAUNCHER");
162-
UseTorchNpuLauncher_ = (envStr != nullptr && std::string(envStr) == "1");
162+
UseTorchNpuLauncher_ = (envStr == nullptr || std::string(envStr) == "1");
163163
auto st = BuildGraph();
164164

165165
RegisterToGlobalDict(modelId_);
@@ -300,7 +300,8 @@ atb::Status Model::ExecuteNode(int nodeId) {
300300
std::function<int()> task = [&]() {
301301
atb::Status tmp_st = node.operation->Execute(node.variantPack, (uint8_t*)(node.workspace), node.workspaceSize, context_);
302302
if (tmp_st != 0) {
303-
DICP_LOG(ERROR) << "op command execute node[" << nodeId << "] fail, error code: " << st;
303+
DICP_LOG(ERROR) << "op command execute node[" << nodeId << "] fail, error code: " << st
304+
<< "\n please set DICP_USE_TORCH_NPU_LAUNCHER=0 to avoid this error";
304305
}
305306
return 0;
306307
};

dlinfer/graph/dicp/vendor/AtbGraph/compile_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, source_code) -> None:
3131
def _compile(self):
3232
try:
3333
if not hasattr(torch.classes.DICPModel, "DICPModel"):
34-
if os.getenv("DICP_USE_TORCH_NPU_LAUNCHER", "0") != "0":
34+
if os.getenv("DICP_USE_TORCH_NPU_LAUNCHER", "1") == "1":
3535
os.environ["ATB_CONTEXT_HOSTTILING_RING"] = "1"
3636
os.environ["ATB_CONTEXT_HOSTTILING_SIZE"] = "102400"
3737
os.environ["ATB_WORKSPACE_MEM_ALLOC_GLOBAL"] = "1"

dlinfer/graph/dicp/vendor/AtbGraph/conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(self, gm):
8787
super().__init__(gm, conversions)
8888
self._register_binary_ops()
8989
self.use_torch_npu_launcher = (
90-
os.getenv("DICP_USE_TORCH_NPU_LAUNCHER", "0") != "0"
90+
os.getenv("DICP_USE_TORCH_NPU_LAUNCHER", "1") == "1"
9191
)
9292
self.graph_op_group = None
9393

0 commit comments

Comments
 (0)