MegEngine v1.12.0 Release Notes

MegEngine

HighLight

  • 针对 BaseDet 中一些 host bound 严重的算子进行了优化,整体模型较上个版本相比 fp32 下平均提速 12%,fp16 下平均提速 19%,其中包含 grounp_norm 算子的网络显存降低 20%,在与 cvpack2 中有对应 pytorch 模型的网络相比,速度差距在 2% 以内,基本与 pytorch 对应的模型持平。
  • 修改 「descending」 默认值为 true 以符合惯常情况下大家对 topK 的定义,topk 默认行为由升序改为降序。
  • 增加了对 python 3.10 的支持。

Bugfix

Dataloader

  • 修复 Infinite sampler 无法获取 batchsize 的问题,并增加了使用示例与参数说明。
  • 修复 ReplacementSampler 设置采样权重后采样结果不符合预期的 bug。
  • 修复 ReplacementSampler 有 weight 时输出的 indices 不符合预期的问题。

Python API

  • 修复 deconv 与 bn 融合错误的问题。
  • 修复 softmax 在 cpu 上计算结果不正确的问题。
  • 修复 ImageNet 解压路径错误的问题。

量化

  • 修复 matmul 对量化 dtype 推理错误的问题。
  • 禁止模型以非对称 qint8 的量化模式推理,去除 fake_quant_bias 里的 assert 以支持更多 QAT 量化模式。

CUDA

  • 修复 Region Restricted Conv 不支持输入的 group 维度等于 1 的情形。
  • 修复使用 --copt “-DMEGDNN_DISABLE_FLOAT16=0” 编译选项时,undefined 的报错。

ARM

  • 修复 fallback im2col 算子所需 workspace 比实际需求大的问题。

X86

  • 修复 x86 INT8 matmul 算子在代码重构时性能变差的问题。

通用组件

  • 无 cuda 环境中开启 subgraph jit 特性可能导致部分 functional API 调用报错,subgraph jit 特性临时改为默认不开启。
  • 修复模型多次初始化时偶发内存用量不一致的问题。
  • 修复 tensor astype 成量化类型时概率性 segmentfault 问题和内存泄露问题。
  • 修复 v1.11.0 及之后的版本 Elemwise multitype 的 loader 和 dumper 函数无法向前兼容的问题。
  • 对 mge(fbs) 格式化,补充 tensor_value_dumper 和 tensor_value_loader 用户接口,方便用户在模型 dump 和 load 阶段自定义一些行为,比如模型的压缩和解压。
  • 修复模型仅能通过 forward 函数进行参数统计导致的参数缺失的问题。
  • 修复 megengine 训练时默认 async_level 情况下的数据竞争导致的运行中随机报错。
  • 修复 load and run jit 设置对非 CUDA 后端无效的问题,增加了 jit 对 CPU 后端的支持。
  • 修复 dump 量化模型时,开启 enable_nchw4/32/64 等选项报 shape 或 channel 不匹配的问题。
  • 调整编译配置,使之对开发者模式更加友好:只需要设置 PYTHONPATH 到 imperative/python 即可, 详细参见 scripts/whl/BUILD_PYTHON_WHL_README.md。
  • 移除 python3.8 及之后的 SyntaxWarning。
  • 修复 MegEngine 和 python中 mod 计算结果不一致的问题。
  • 修复 symbolic trace时,3维输入的 matmul 输出 shape 计算错误问题。
  • 修复 ConvolutionBackwardData 算子推断 layout 错误导致的概率性训练崩溃 bug。
  • 加速 reshape、setsubtensor、subtensor、concat、stack 算子。
  • 修复 NormElemwisePass 中 named_args 接口未更新的问题。

文档

  • 修复 warp_affine 的文档错误。

New Features

Python API

  • deconv 支持 fuse bn 操作。

CUDA

  • CUDA 上customop 支持新的 RuntimeArgs 参数。
  • 取消 RegionRestrictedConv mask 类型为 uint8 时输入和输出 tensor size 必须为4的倍数的限制。

ARM

  • ARM 平台支持 fp16 nchw88 im2col 算法,此算法性能较 fp32 nchw44 快2倍左右,主要用于提升 ARM fp16 模型推理速度。
  • 添加 ARM NCHW88 fp16 pooling 算法。

通用组件

  • Region Restricted Conv 支持 bias。
  • nchw44/nchw88/nchw44-dot 三种 layout 在 channel 上不满足要求时会 padding channel。
  • 添加 grouonorm 算子。
  • 增加了对 python 3.10 的支持。
  • 为 custom op 新增 cuda 相关的辅助函数,以允许 custom op 异步执行。

Improvements

Python API

  • 修改 descending 默认值为 true ,topk 默认行为由升序改为降序。

CUDA

  • 完善了 dump 和 load 使用的 tensorrt 版本不一致时的错误信息。

MegEngine Lite

Bugfix

通用组件

  • 修复 lite 运行跨 compnode 的模型时 zero copy 不生效的问题。
  • 修复 lite zero copy pass 触发 的 UAF 问题。

周边工具

  • 修复 load_and_run fitting 模式下 fast-run 不工作的问题。

MegEngine

Bugfix

Dataloader

  • Fixed the problem that Infinite sampler cannot getbatchsize, and added usage examples and parameter descriptions.
  • Fix the bug that ReplacementSampler gets wrong sampling results after setting the sampling weights.
  • Fix the problem that the indices output by ReplacementSampler does not meet expectations when it has weight.

Python API

  • Fixed deconv and bn fusion error.
  • Fixed softmax calculation result incorrectly on cpu.
  • Fix bad path when untarring imagenet data.

Quantify

  • Fixed matmul inference error for quantized dtypes.
  • Forbid the model to reason in the quantization mode of asymmetric qint8, and remove the assert in fake_quant_bias to support more QAT quantization modes.

CUDA

  • Fixed the issue when Region Region Restrict Conv’s group is 1.
  • Fix the undefined error when using the – copt “- DMEGDNN_DISABLE_FLOAT16=0” compilation option.

ARM

  • Fix the problem that the workspace required by the fallback im2col operator is larger than the actual requirement.

X86

  • Fix x86 INT8 matmul operator’s poor performance during code refactoring.

Common components

  • Enabling the subgraph jit feature in a non-cuda environment may cause some functional API calls to throw errors.
    The subgraph jit feature is temporarily changed to be disabled by default.
  • Fix occasional inconsistent memory usage when the model was initialized multiple times.
  • Fixed probabilistic segmentfault and memory leak when when set tensor dtype to Quantized.
  • Fixed the problem that the loader and dumper functions of Elemwise multitype cannot be forward compatible in v1.11.0 and later versions.
  • Implement user interface ‘tensor_value_dumper’ and ‘tensor_value_loader’ for fbs model, used for user register some behavior at model dump and load stage, for example model compress and decompression.
  • Fixed an issue where module_stats does not support information statistics for axion models.
  • Fixed random errors during operation caused by data races in the case of default async_level during megengine training.
  • Support JIT CPU backend and fix load and run jit options invalid for backend exclude CUDA.
  • Fix the error when dump model to nchw4/32/64 tensor format.
  • Fix build CMakeLists and script to get better experience.
  • Remove SyntaxWarning after python3.8.
  • Fix the problem of mod op get the different result between MegEngine and python.
  • Fix the probabilistic training crash bug caused by the deduce layout error of ConvolutionBackwardData operator.
  • Speed up reshape, setsubtensor, subtensor, concat, stack operators.
  • Fix the problem that the named_args interface in NormElemwisePass is not updated.

Documentation

  • Fix documentation error of warp_affine.

New Features

Python API

  • Deconv supports fuse bn operations.

CUDA

  • Add param RuntimeArgs to customop kernel on CUDA.
  • Cancel the restriction that the input and output tensor size must be a multiple of 4 when the RegionRestrictedConv mask type is uint8.

ARM

  • The ARM platform supports the fp16 nchw88 im2col algorithm, which is about twice faster than the fp32 nchw44 algorithm, and is mainly used to improve the reasoning speed of the ARM fp16 model.
  • Add ARM NCHW88 fp16 pooling algorithm.

Common components

  • Region Restricted Conv support bias.
  • Three layouts (nchw44/nchw88/nchw44-dot) will padding the channel when the channel does not meet the requirements.
  • Add grouonorm operator.
  • Add support for python 3.10.

Improvments

Python API

  • Change the default value of descending to true , and the default behavior of topk is changed from ascending to descending.

CUDA

  • Improve the error message when the tensorrt versions used by dump and load are inconsistent.

MegEngine Lite

Bugfix

Common components

  • Fix lite zero copy issue at cross compnode env.
  • Fix var UAF in lite zero copy pass.

Peripheral tools

  • Fixed fast-run not working in load_and_run fitting mode.