已关闭
【社区任务】#39 调研结论:torch._C._jit_set_texpr_fuser_enabled 无需 NPU 端变更 #2818
AZT创建于 7月12日关闭于 17 天前
7月12日 添加了label:event: api-consistency
7月15日 修改了issue 的描述
7月15日 修改了issue 的描述
7月15日 修改了issue 的描述
AZT
7月15日 评论:
7月15日 评论:


7月17日 修改了issue 的描述
7月17日 修改了issue 的描述
7月17日 修改了issue 的描述
26 天前 添加了label:bot-triaged
TorchNPU-Bot
26 天前 评论:
26 天前 评论:
检测到当前 issue 已关联 PR !40692,自动添加标签:bot-triaged


26 天前 修改了issue 的描述
AZT
19 天前 评论:
19 天前 评论:
17 天前 添加了label:resolved
任务编号
#39 (出自父任务 issue #2761)
任务要求
验证
torch._C._jit_set_texpr_fuser_enabled在 Ascend NPU 上的一致性,补齐缺失的代码 / 补丁 / 测试用例 / 文档。调研结论
无需任何 NPU 端代码、补丁、测试用例、文档改动。
依据
API 性质:
torch._C._jit_set_texpr_fuser_enabled(bool)是 PyTorch JIT 编译器内部的 Tensor Expressions Fuser 启停开关,注册位置torch/csrc/jit/python/init.cpp,完全在 CPU 侧,与设备硬件无关。NPU 无关性:JIT TexprFuser 在
torch._C命名空间下,未调用任何 NPU/CANN 接口,仅修改全局布尔状态位fuser_enabled_;NPU 不会改变其行为,set/查询/恢复 round-trip 不依赖任何设备。实测验证:
import torch assert torch._C._jit_texpr_fuser_enabled() is True torch._C._jit_set_texpr_fuser_enabled(False) assert torch._C._jit_texpr_fuser_enabled() is False torch._C._jit_set_texpr_fuser_enabled(True) # 恢复 assert torch._C._jit_texpr_fuser_enabled() is True全部通过。
一致性:该 API 在社区和 Ascend 分支行为完全一致(同一份
torch/csrc/jit/python/init.cpp代码),没有"差异"需要对齐。上游社区测试用例覆盖(逐文件核实):
test/jit/test_profiler.pysetUp/tearDown中保存并恢复全局 bool 开关test/test_jit.pytorch._C._jit_set_texpr_fuser_enabled(GRAPH_EXECUTOR == ProfilingMode.PROFILING)test/test_jit_fuser_te.pyTestLoopnestRandomizationParent.setUp/tearDown,覆盖整套 TensorExpr kernel 随机化套件(@onlyCPU保护)Ascend 分支通过
!10831/!11822/!13076自上游同步test/test_jit.py与test/test_jit_fuser_te.py,上述三处 API 引用逐字继承运行,无需新增任何测试用例即可在 NPU 构建下覆盖本 API 的 setter/getter/restore round-trip 行为。