文档
注册

single stream功能

功能简介

图执行时,是否使用单Stream流运行,默认不开启。其中,Stream流用于维护一些异步操作的执行顺序,确保按照应用程序中的代码调用顺序在Device上执行。

对于模型结构无实际并发效果且又采用了多Stream执行的模型,会因流间切换带来额外的计算耗时,影响性能,此时可通过开启单Stream来提高图执行性能。

使用方法

设置config时使用下列开关进行配置,默认False,如需开启设为True。

import torchair as tng
config = tng.CompilerConfig()

# 开启图单流执行功能
config.ge_config.enable_single_stream = True
npu_backend = tng.get_npu_backend(compiler_config=config)
...
model = Model()
model = torch.compile(model, backend=npu_backend, dynamic=False)
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词