2.3.0 Release Note

1. Important Updates

We are excited to release the PaddlePaddle Framework V2.3.0. This version contains the following highlights.


  • Added more than 100 new APIs, covering automatic differentiation, linear algebra, probability distribution, sparse tensor, framework performance analysis, hardware device management, vision domain, etc.

  • Added 4 new automatic differentiation APIs, 11 new linear algebra APIs, and 21 new probability distribution APIs to better support use cases in scientific computing, reinforcement learning, xand other application areas.

  • Added 11 new Sparse Tensor APIs including basic functions of sparse tensor construction and conversion. The COO and CSR formats are supported.

  • Added 9 new framework performance analysis APIs. The new performance profiling APIs, centered around Paddle.Profiler.Profiler, help users collect and analyze performance statistics during training and inference.

  • Added 7 APIs for device management, facilitating hardware information acquistion.

  • Added several visual and text domain APIs to facilitate ~~the~~ reusability of MobileNetV3, ResNeXt and other backbone networks, to achieve the fast networking.

Paddle HIgh reusability operator library

  • We announce PHI as the new Paddle HIgh reusability operator library. PHI provides Primitive API, enabling kernel reuse for operator development. As a refactored functional operator library, PHI aims to solve legacy problems that harm the framework’s performance and reusability, in particular on the operator development. Such problems include inefficient ways of cross using operators, unclear operator interfaces and lacking direct calls to the operator library in C++. With PHI, new operators can be easily implemented by composing functions available in the functional library. The library provides over 200 C++ operator class APIs and nearly 500 kernels. Composing new operators through these built-in functions can greatly reduce the user’s development effort. PHI supports different types of hardware (e.g., GPU and XPU). In addition, PHI is extensible with plugins for accommodating third party accelerators (such as NPU) in a low cost and reusable fashion. In short, PHI supports low level operator composability, the reuse of kernels through Primitives, and accelerators through plugins.

Distributed Training

  • Fully upgrade the adaptive distributed training architecture, including multiple modules such as elastic resource management, asynchronous pipelined executor, heterogeneous communication, and automatic parallelism, and support the hard-aware distributed training and inference under a variety of heterogeneous hardware.

  • Add MoE parallel strategy, GroupSharded parallel strategy, and Pure FP16 under dynamic graph hybrid Parallelism, which further supports the efficient distributed training of large models under the dynamic graph.

  • Comprehensively upgrade and optimize the architecture of general heterogeneous parameter server, and simplify each module, such as communication and storage, to improve the secondary development experience of parameter server. The performance of GPU parameter server is improved by 2.38 times under 100 billion parameters and 10 billion data.

Compile and Install

  • From version 2.3.0, PaddlePaddle upgrades GPU architectures supported.

Inference Deployment

  • Add the Java API and ONNX Runtime CPU backend.

  • Support the TensorRT 8.0 / 8.2 and structured sparsity, with deep performance optimization for ERNIE-like structural models.

Hardware Backend Extention

  • Add custom device support: provide a plug-in way to extend PaddlePaddle hardware backend.

  • Add training/inference support for multiple heterogeneous chips such as HUAWEI Ascend 910 / GraphCore IPU / Cambricon MLU / KUNLUNXIN 2.

Framework Architecture

2. Incompatibility Upgrade

  • Due to limitation of the binary size, sm35 CUDA ARCH is dropped in pre-compiled binaries. (#41754)

  • When paddle.to_tensor converts a python int scalar to a Tensor, the default data type on Windows changes from int32 to int64, thus alignment with Linux/Mac. (#39662)

  • To keep consistency with division behavior under python3, the division symbol / has been changed from “rounding divide” to “true divide”, and the data type of the computed output has been switched from int to float. (#40890)

2.2 2.3.0
>>> import paddle
>>> a = paddle.to_tensor([327])
>>> b = paddle.to_tensor([80])
>>> a / b
Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
>>> import paddle
>>> a = paddle.to_tensor([327])
>>> b = paddle.to_tensor([80])
>>> a / b
Tensor(shape=[1], dtype=float32, place=Place(gpu:0), stop_gradient=True,
  • Revise the ELU’s formula. The computing method in case of alpha <0 aligns with the original paper, thus fixing a small number of cases where the results are incorrectly calculated. Meanwhile, elu_ will report an error in case of alpha <0, because it is not mathematically possible to compute the inverse gradient from the output only at alpha <0. (#37316)

2.2 2.3.0
# elu(x) = max(0, x) + min(0, α ∗ (e^x − 1))
>>> import paddle
>>> x = paddle.to_tensor([-1. ,6.])
>>> m = paddle.nn.ELU(-0.2)
>>> out = m(x)
>>> out
Tensor(shape=[2], dtype=float32, place=CUDAPlace(0), stop_gradient=True,
       [ 0.         , -74.48576355])
>>> out = paddle.nn.functional.elu_(x, alpha=-0.2, name=None)
>>> out
Tensor(shape=[2], dtype=float32, place=CUDAPlace(0), stop_gradient=True,
       [ 0.         , -74.48576355])
# elu(x) = x, if x > 0
# elu(x) = α ∗ (e^x − 1), if x <= 0
>>> import paddle
>>> x = paddle.to_tensor([-1. ,6.])
>>> m = paddle.nn.ELU(-0.2)
>>> out = m(x)
>>> out
Tensor(shape=[2], dtype=float32, place=CUDAPlace(0), stop_gradient=True,
       [0.12642412,  6.        ])
>>> out = paddle.nn.functional.elu_(x, alpha=-0.2, name=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/inplace_utils.py", line 34, in __impl__
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/paddle/nn/functional/activation.py", line 89, in elu_
    assert alpha >= 0., "elu_ only support alpha >= 0, please use elu instead."
AssertionError: elu_ only support alpha >= 0, please use elu instead.

3. Training Framework (with the distributed function)

(1) New functions


  • Add 4 new automatic differentiation APIs to support scientific computing, as listed below: (#40692)

    • paddle.incubate.autograd.vjp, compute vector-Jacobi matrix product.

    • paddle.incubate.autograd.jvp, compute Jacobi matrix-vector product.

    • paddle.incubate.autograd.Jacobian, compute Jacobi matrix.

    • paddle.incubate.autograd.Hessian, compute Hessian matrix.

  • Add linear algebra class API

    • Add paddle.linalg.triangular_solve, to compute a system of linear equations with unique solutions through a triangular coefficient. (#36714)

    • Add paddle.linalg.eig, to compute the characteristic decomposition of the general square matrix. (#35764)

    • Add paddle.linalg.sovle, to compute solutions to systems of linear equations. (#35715)

    • Add paddle.linalg.lstsq, to compute least-squares solutions to systems of linear equations. (#38585, #38621)

    • Add paddle.linalg.qr, compute QR decomposition of matrix. (#35742, #38824

    • Add paddle.inner, to compute inner product of a matrix. (#37706)

    • Add paddle.outer, to compute outer product of a matrix. (#37706)

    • Add paddle.linalg.cov, to compute covariance between vectors. (#38392)

    • Add paddle.linalg.cholesky_sovle, to compute the cholesky solution of the equation. (#38167)

    • Add paddle.linalg.lu and paddle.linalg.lu_unpack, to compute matrix lu decomposition, and decompress lu matrix. (#38617, #38559, #38616)

  • Add 21 new probability distribution class APIs for reinforcement learning, variation inference, scientific computing, and other scenarios. Including 6 random variable distributions, 13 random variable transformations, and 2 KL divergence computing. as listed below: (#40536, #38820, #38558, #38445, #38244, #38047)

    • paddle.distribution.ExponentialFamily, exponential distribution family base class.

    • paddle.distribution.Beta, Beta distribution.

    • paddle.distribution.Dirichlet, Dirichlet distribution.

    • paddle.distribution.Independent, Independent distribution, used to create higher order distributions.

    • paddle.distribution.TransformedDistribution, Transform distribution, used to generate higher-order distributions through the base distribution and a series of transformations.

    • paddle.distribution.Multionmial, a multinomial distribution.

    • paddle.distribution.Transform, base class for transforming random variables.

    • paddle.distribution.AbsTransform, take absolute value transform.

    • paddle.distribution.AffineTransform, affine transform.

    • paddle.distribution.ChainTransform, chain combination of the transform.

    • paddle.distribution.ExpTransform, exponential transform.

    • paddle.distribution.IndependentTransform, independent transform, used to extend the event_dim of the transform definition field.

    • paddle.distribution.PowerTransform, power transform.

    • paddle.distribution.ReshapeTransform, reshape transform.

    • paddle.distribution.SigmoidTransform, sigmoid transform.

    • paddle.distribution.SoftmaxTransform, softmax transform.

    • paddle.distribution.StackTransform, stack transform, used to combine multiple transforms in a stack method.

    • paddle.distribution.StickBreakingTransform , stickbreaking transform.

    • paddle.distribution.TanhTransform, tanh transform.

    • paddle.distribution.kl_divergence, compute KL divergence.

    • paddle.distribution.register_kl, register user-defined KL divergence calculation function.

  • Add high-level API

    • Add paddle.vision.models.AlexNet and paddle.vision.models.alexnet, to use AlexNet models directly. (#36058)

    • Add paddle.vision.models.DenseNet, paddle.vision.models.densenet121, paddle.vision.models.densenet161, paddle.vision.models. densenet169, paddle.vision.models.densenet201, and paddle.vision.models.densenet264, to use DenseNet models directly. (#36069)

    • Add paddle.vision.models.GoogLeNet and paddle.vision.models.googlenet, to use GoogLeNet models directly. (#36034)

    • Add paddle.vision.models.InceptionV3, paddle.vision.models.inception_v3, to use InceptionV3 models directly. (#36064)

    • Add paddle.vision.models.MobileNetV3Small, paddle.vision.models.MobileNetV3Large, paddle.vision.models.mobilenet_v3_small, and paddle.vision.models.mobilenet_v3_large, to use MobileNetV3 models directly . (#38653)

    • Add paddle.vision.models.ResNeXt, paddle.vision.models.resnext50_32x4d, paddle.vision.models.resnext50_64x4d, paddle.vision.models. paddle.vision.models.resnext101_32x4d, paddle.vision.models.resnext101_64x4d, paddle.vision.models.resnext152_32x4d, and paddle.vision.models.resnext152_64x4d, to use ResNeXt models directly. (#36070)

    • Add paddle.vision.models.ShuffleNetV2, paddle.vision.models.shufflenet_v2_x0_25, paddle.vision.models.shufflenet_v2_x0_33, paddle.vision.models.shufflenet_v2_x0_5, paddle.vision.models.shufflenet_v2_x1_0, paddle.vision.models.shufflenet_v2_x1_5, paddle.vision.models.shufflenet_v2_x2_0, and paddle.vision.models.shufflenet_v2_swish, to use ShuffleNetV2 models directly (#36067)

    • Add paddle.vision.models.SqueezeNet, paddle.vision.models.squeezenet1_0, and paddle.vision.models.squeezenet1_1, to use SqueezeNet models directly. (#36066)

    • Add paddle.vision.models.wide_resnet50_2, and paddle.vision.models.wide_resnet101_2, to use WideResNet models directly. (#36952)

    • Add paddle.vision.ops.nms API, to support single-category and multi-category non-maximum suppression (NMS) algorithms for target detection and prediction task acceleration (#40962)

    • Add paddle.vision.ops.roi_pool and paddle.vision.ops.RoIPool, to support RoI region pooling operations in detection tasks. (#36154)

    • Add paddle.vision.ops.roi_align and paddle.vision.ops.RoIAlign, to support RoI Align operations in detection tasks. (#35102)

    • Add paddle.text.ViterbiDecoder, and paddle.text.viterbi_decode Viterbi decoding API, mainly for sequence tagging model prediction. (#35778)

  • Add 11 Sparse class APIs, to support basic functions, such as creating Sparse Tensor in COO and CRS formats, and add C++ inter-converting with Tensor.

    • paddle.sparse.sparse_coo_tensor,create Sparse Tensor in COO format. (#40780

    • paddle.sparse.sparse_csr_tensor,create Sparse Tensor in CSR format. (#40780

    • paddle.sparse.ReLU,support ReLU activation layer for SparseCooTensor.(#40959)

    • paddle.sparse.functional.relu,support ReLU function of SparseCooTensor.(#40959)

    • Tensor.values(),c++ method to get non-zero elements of a SparseCooTensor or SparseCsrTensor. (#40608

    • Tensor.indices(),c++ method to get the coordinate information of a SparseCooTensor. (#40608

    • Tensor.crows(),c++ method to get information about the compressed row information of the SparseCsrTensor.(#40608

    • Tensor.cols(),c++ method to get the column information of the SparseCsrTensor (#40608

    • Tensor.to_sparse_coo(),c++ method to convert a DenseTensor or SparseCsrTensor to a SparseCooTensor. (#40780

    • Tensor.to_sparse_csr(),c++ convert a DenseTensor or SparseCooTensor to a SparseCsrTensor. (#40780

    • Tensor.to_dense(),c++ convert a SparseCooTensor or SparseCsrTensor to a DenseTensor. (#40780

  • Add hardware related APIs

    • Add four GPU memory monitoring related APIs: paddle.device.cuda.max_memory_allocated, paddle.device.cuda.max_memory_reserved, paddle.device.cuda.memory_allocated, and paddle.device.cuda.memory_reserved, to view and analyze the GPU memory usage in real-time. (#38657)

    • Add paddle.device.cuda.get_device_properties, to return the properties of the GPU device. (#35661)

    • Add paddle.device.cuda.get_device_name and paddle.device.cuda.get_device_capability, to return the name and compute capability of the GPU device. (#35672)

  • Add Tensor operation API

    • Add paddle.nansum, to sum input Tensor along axis with ignoring the NaNs values. (#38137)

    • Add paddle.nanmean,to average input Tensor along axis with ignoring the NaNs values. (#40472

    • Add paddle.clone, to return a copy of the input Tensor and provide gradient calculation. (#38020)

    • Add paddle.Tensor.element_size, to return the number of bytes allocated for a single element in a Tensor. (#38020)

    • Add paddle.Tensor.to_uva_tensor, to convert the numpy objects to be accessed by CUDA objects with virtual addresses, which are stored in CPU memory physically. (#39146, #38950)

    • Add paddle.rot90, to rotate the n-dimensional Tensor by 90 degrees along the plane specified by axes. (#37634)

    • Add paddle.logit and paddle.Tensor.logit, to compute the logit function values for input Tensor. (#37844)

    • Add paddle.repeat_interleave, to copy the input along the specified axis, and return a new Tensor. (#37981)

    • Add paddle.renorm, to split the Tensor into multiple pieces at the specified axis and then perform p norm operations separately. (#38130, #38459)

    • Add paddle.mode and paddle.Tensor.mode, to search the values and indices of the input Tensor along the specified axis. (#38446)

    • Add paddle.quantile and paddle.Tensor.quantile, to compute the q-quantile of a Tensor along the specified axis. (#38567)

    • Add paddle.kthvalue and paddle.Tensor.kthvalue, to find the values and indices of the kth smallest at the specified axis. (#38386)

    • Add paddle.is_floating_point and paddle.Tensor.is_floating_point, to determine if the input Tensor is the floating point type. (#37885)

    • Add paddle.erfinv and paddle.Tensor.erfinv, to compute the inverse error function of the input Tensor. (#38295)

    • Add paddle.lerp and paddle.Tensor.lerp, to compute linear interpolation among the input Tensors based on the given weights. (#37253)

    • Add paddle.angle, to compute the phase angle of a complex Tensor. (#37689)

    • Add paddle.rad2deg and paddle.Tensor.rad2deg, to convert each of the elements of input from the angles in radians to the degrees. (#37598)

    • Add paddle.deg2rad and paddle.Tensor.deg2rad, to convert each of the elements of input from the degrees in radians to the angles. (#37598)

    • Add paddle.gcd and paddle.Tensor.gcd, to compute the greatest common divisors of the absolute values of two inputs by element. (#37819)

    • Add paddle.lcm and paddle.Tensor.lcm, to compute the least common multiple of the absolute value of two inputs by element. (#37819)

    • Add paddle.amax and paddle.Tensor.amax, to get the maximum value of Tensor elements along the specified dimension. (#38417)

    • Add paddle.amin and paddle.Tensor.amin, to get the minimum value of Tensor elements along the specified dimension. (#38417)

    • Add paddle.isclose, to determine if each element of two Tensors is close to each other. (#37135)

    • Add paddle.put_along_axis and paddle.take_along_axis, for extracting or placing elements with specified index subscripts. (#38608)

    • Add paddle.bincount and paddle.Tensor.bincount, for counting the number of occurrences of each element in a Tensor. (#36317)

    • Add paddle.fmax and paddle.fmin, to extend the max/min function to support the case of NaN values in the two Tensors. If there is one NaN value in the corresponding position, return that non-NaN value; if there are two NaN values in the corresponding position, return the NaN value. (#37826)

    • Add paddle.diff, for computing the nth forward difference along a given dimension. It currently supports n=1. (#37441)

    • Add inverse hyperbolic functions: paddle.asinh, paddle.acosh, and paddle.atanh. (#37076)

    • Add paddle.as_real and paddle.as_complex for conversion between real Tensor and complex Tensor. (#37784)

    • Add paddle.complex, for constructing a complex Tensor with the given real and imaginary parts. (#37918, #38272)

    • Add paddle.det and paddle.slogdet, to compute the determinant of a matrix and the natural logarithm of the determinant. (#34992)

    • Add paddle.nn.utils.parameters_to_vector, to flatten parameters to a 1-D Tensor. (#38020)

    • Add paddle.nn.utils.vector_to_parameters, to transform a Tensor with 1-D shape to the parameters. (#38020)

  • Add networking class APIs

    • Add paddle.nn.Fold and paddle.nn.functional.fold, to extract sliding local area blocks for the Tensors of a batch. (#38613)

    • Add paddle.nn.CELU and paddle.nn.functional.celu, to support the CELU activation layer. (#36088)

    • Add paddle.nn.HingeEmbeddingLoss. Add a way to compute hinge embedding loss. It is usually used for nonlinear embedding or semi-supervised learning. (#37540)

    • Add paddle.nn.ZeroPad2D API, for zero-padding according to the padding property. (#37151)

    • Add paddle.nn.MaxUnPool3D and paddle.nn.MaxUnPool1D, for computing 3D maximum inverse pooling and 1D maximum inverse pooling. (#38716)

    • Add paddle.incubate.graph_khop_sampler, paddle.incubate.graph_sample_neighbors, and paddle.incubate.graph_reindex APIs, to support graph multi-order neighbor sampling and graph reindexing operations. They are mainly used for graph neural network model training. (#39146, #40809)

  • Add random number class APIs

    • Add paddle.poisson, to generate a Tensor that obeys Poisson distributed with the lambda parameter. (#38117)

    • Add paddle.randint_like API, to generate a new Tensor that obeys uniform distribution in the range [low, high), with the shape of the output matching the shape of the input. (#36169)

    • Add paddle.Tensor.exponential_. It is an inplace style API that populates the input Tensor with exponentially distributed random numbers. (#38256)

  • Add parameter initialization class APIs

    • Add paddle.nn.initializer.Dirac, to initialize 3D/4D/5D parameters with Dirac delta functions. It is commonly used for initialization of Conv1D/Conv2D/Conv3D parameters in the convolution layer. (#37389)

    • Add paddle.nn.initializer.Orthogonal for orthogonal matrix initialization. The initialized parameter is the (semi-) orthogonal vector. (#37163)

    • Add paddle.nn.initializer.calculate_gain, to get the recommended gain value for the activation function. The gain value can be used to set certain initialization APIs to adjust the initialization range. (#37163)

  • Add learning rate class API

    • Add paddle.optimizer.lr.MultiplicativeDecay, to provide the lambda function to set the learning rate. (#38250)

  • Add distributed-related APIs

  • Add new optimizer-related APIs(#40710)

    • paddle.incubate.optimizer.functional.minimize_bfgs,add second-order optimizer BFGS.

    • paddle.incubate.optimizer.functional.minimize_lbfgs,add second-order optimizer L-BFGS.

  • Add paddle.incubate.multiprocessing module, to provide Tensor (CPU/GPU) data transfer between python processes. (#37302, #41339)

  • Add paddle.incubate.autotune.set_config API, to support multi-version Kernel auto-selection, mixed precision data layout auto-conversion, and num_workers auto-selection for DataLoader to automatically improve model performance. (#42301)

  • Add paddle.incubate.nn.FusedMultiTransformer and paddle.incubate.nn.functional.fused_multi_transformer API, to fuse multiple layers of transformers into a single op to improve model inference performance. It should be noted that only forward is supported. (#42311)

  • Add einsum_v2 operators for consistent interface between imperative and static mode. It is compatible with the paddle.einsum implementation at the original python side, while supporting dynamic to static export and more complete Infershape inference. (#42495, #42327, #42397, #42105)

IR(Intermediate Representation)

  • Dynamic graph to static graph

    • For the variable type StaticAnalysis module, add support for type tag similar to a, b = paddle.shape(x) . (#39245)

    • Add a computed field, supporting InputSpec.name as the Program cache hash key. (#38273)

    • Add syntax for supporting dict['key'] = x.shape. (#40611)

    • Add the support for Pure FP16 training. (#36944)

    • Add the support for i in [x,y,z] syntax. (#37259)

    • Add the support for type hint syntax of python3. (#36544)

  • Pass development

    • Add forward and backward fusion for FC + [relu|gelu] based on NVIDIA cuBlasLt Epilogue. (#39437

  • Kernel Primitive API

    • Add KP operators on GPU platform, including cast, scale, clip, bce_loss, abs_grad, reduce_sum_grad, reduce_mean_grad, clip, bce_loss, full, full_like, distribution, random , masked_select_kernel, where_index, masked_select_grad, dropout, sigmoid, where, and abs_grad. (#36203, #36423, #39390, #39734, #38500, #38959, #39197, #39563, #39666, #40517, #40617, #40766, #39898, #39609)

    • Add the support for XPU2 source code compilation mode. (#37254, #40397, #38455)

    • Add the support for KP operator reuse on XPU2 and GPU, including reduce, broadcast, elementwise_add, exp、log、relu、sigmoid、leaky_relu、softplus、hard_swish、reciprocal。(#36904, #37226, #38918, #40560, #39787, #39917, #40002, #40364)

    • Add unit tests of KP operators on the XPU2 platform, including brelu、ceil、celu、elu、floor、hard_shrink、hard_sigmoid、log1p、logsigmoid、relu6、silu、soft_relu、softsign、sqrt、square、swish、thresholded_relu、softshrink。(#40448, #40524)

    • Add the support for XPU2 KP models, including resnet50, deepfm, wide_deep, yolov3-darknet53, det_mv3_db, bert, transformer, mobilenet_v3, and GPT2.

Mixed Precision Training

  • Split the paddle.amp.GradScaler.unscale_ method from the minimize of the mixed precision training paddle.amp.GradScaler, to provide a separate interface for recovering the loss. (#35825)

  • Add the FP16 support for paddle.nn.ClipByGlobalNorm dynamic graph mode. Add FP16 Kernel for clip op to enable clip-related operations to support FP16 compute. (#36198, #36577)

  • Support the case that the optimizer parameter transferred from paddle.amp.decorate is Nan. (#37541)

  • For the merged_momentum op,add the support of input multiple learning rates , the computing for use_nesterov policy and the regularization computing . (#37527)

  • Add multi_tensor policy to paddle.optimizer.Momentum optimizer. Add set_to_zero branch to clear_grad of Optimzizer class. (#37564)

  • Add multi_tensor policy to paddle.optimizer.Adam . (#38010)

  • Add multi_precision policy to paddle.optimizer.SGD optimizer. (#38231)

  • Add the storage master weight parameter to the optimizer state_dict method. (#39121)

  • Add support for op CUDA bfloat16 mixed precision training. Support for O1 and O2 modes. Enable the above training modes via paddle.amp.auto_cast . (#39029, #39815)

  • Add bfloat16 CUDA Kernel for the following ops: matmul, concat, split, dropout, reshape, slice, squeeze, stack, transpose, unbind, elementwize_max, elementwize_add, elementwize_mul, elementwize_sub, scale, sum, layer_norm, p_norm, reduce_sum, softmax, log_softmax, sigmoid, sqrt, softplus, square, gaussian_random, fill_constant, and fill_any_like. (#39485, #39380, #39395, #39402, #39457, #39461, #39602, #39716, #39683, #39843, #39999, #40004, #40027)

  • Add bfloat16 CPU Kernel for the following ops: dropout, reshape, slice, squeeze, unsqueeze, stack, transpose, unbind, elementwize_max, elementwise_mul, elementwise_sub, and gather. (#39380, #39395, #39402, #39457, #39461, #39602, #39716, #39683)

  • Support printing of Tensor with data of bfloat16. (#39375, #39370)

  • Add support for FP16 computation for p_norm , elementwise_max , and fill_constant_batch_size_like ``scatter . (#35888, #39907, #38136, #38499)

  • Add support for int16_t for the following ops: cumsum, less_than, less_equal, greater_than, greater_equal, equal, not_equal, fill_any_like, grather_nd reduce_sum, where_index, reshape, and unsqueeze. (#39636)

  • Add support for int16_t label type for cross_entropy op. (#39409)

  • Add support for int16_t id type for embedding op. (#39381)

  • Add support for FP16 type for reduce_mean op. (#38289)

  • Add support for FP16 type for elementwise_min op. (#38123)

  • Update bfloat16 AMP oneDNN default support list. (#39304)

Paddle HIgh reusability operator library

We announce PHI as the new Paddle HIgh reusability operator library. PHI provides Primitive API, enabling kernel reuse for operator development. As a refactored functional operator library, PHI aims to solve legacy problems that harm the framework’s performance and reusability, in particular on the operator development. Such problems include inefficient ways of cross using operators, unclear operator interfaces and lacking direct calls to the operator library in C++. With PHI, new operators can be easily implemented by composing functions available in the functional library. The library provides over 200 C++ operator class APIs and nearly 500 kernels. Composing new operators through these built-in functions can greatly reduce the user’s development effort. PHI supports different types of hardware (e.g., GPU and XPU). In addition, PHI is extensible with plugins for accommodating third party accelerators (such as NPU) in a low cost and reusable fashion. In short, PHI supports low level operator composabilty, the reuse of kernels through Primitives, and accelerators through plugins.The main contents include six parts as below:

New Dynamic Graph Execution Mechanism

To improve scheduling performance and custom development capability of the dynamic graph execution mechanism of the PaddlePaddle, we have reconstructed the underlying execution mechanism of the dynamic graph. With the new execution method, the PHI operator library can be used for efficient runtime execution. For the operators supported by the PHI operator library, switching to the new dynamic graph mode will get a significant improvement in scheduling performance. However, due to the huge workload required in the upgrade of the overall framework execution mechanism and this part of the work is coupled with a lot on the PHI operator library, we still do not use this execution method by default in this version. If you want to try it, you can switch to it by setting the environment variable FLAGS_enable_eager_mode=1.The details are as follows:

  • Implementation of dynamic graph execution infrastructure, core components and mechanism: By staticizing dynamic graph-related execution codes, the original homogeneous operators constructing converted to specific calling for different PHI APIs, thus greatly optimizing the scheduling overhead. (#36059, #37323, #37556, #37555, #37478, #37458, #37479, #37599, #37659, #37654, #39200, #39309, #39319, #39414, #39504, #39526, #39878, #39963)

  • New dynamic graph execution mechanism sub-function development and adaptation: support more flexible and complete dynamic graph sub-functions such as hook, pylayer, double_grad, inplace, amp, etc. (#41396, #40400, #40695, #41043, #40915, #41104, #41350, #41209, #40830, #40891, #36814, #37377, #37193, #36965, #37810, #36837, #38488, #39282, #39449, #39531, #39638, #39674, #39893, #40170, #40693, #40937, #41016, #41051, #41121, #41198, #41287, #41380, #41306, #41387, #40623, #40945, #39282, #39449, #38488)

  • Automatic code generation mechanism for new dynamic graph execution: When we are trying to split the computation and scheduling logic of a large number of homogeneous operators into different specific scheduling logics, we find that it is a huge workload. So we introduce a new automatic code generation logic to generate code and thus simplify the runtime logic of dynamic graphs. Meanwhile, in order to adapt to the various types of runtime logic in the previous framework, we also use some complicated compilation techniques to obtain information at runtime to generate more accurate scheduling code. (#37574, #37575, #37639, #37723, #37753, #37812, #37837, #37910, #37943, #37992, #37959, #38017, #37969, #38160, #38085, #38562, #38573, #39192, #39215, #39355, #39358, #39328, #39233, #39628, #39767, #39743, #39897, #39797, #39997, #40058, #40080, #40107, #39962, #40132, #40276, #40266, #40480, #40482, #40368, #40650, #40815, #40907, #40935, #41089)

  • New dynamic graph execution mechanism accessed into the main framework and Integration test: we currently use some environment variables to distinguish between static graph mode and dynamic graph mode (including new dynamic graph and old dynamic graph mode). We have adapted most logics of dynamic graphs in these modes. However, there are still a lot of problems being fixed. (#37638, #37643, #37653, #38314, #38337, #38338, #39164, #39326, #40391, #40201, #40854, #40887)

  • Update some judgment logics under dynamic graphs, to support fast execution paths for dynamic graphs in compatible forms:(#40786

    • Non-static graph mode (current transition scheme): _non_static_mode()

    • Determined as new dynamic graph in dynamic graph mode (recommended judgment logic): _in_dygrah_mode()

    • Determined as old dynamic graph in dynamic graph mode (Not recommended. It will be deprecated in future versions): _in_legacy_dygraph()

    • Enable old dynamic graph and disable new dynamic graph in dynamic graph mode: _enable_legacy_dygraph() or exit _test_eager_guard()

    • Enable new dynamic graph and disable old dynamic graph in dynamic graph mode: _disable_legacy_dygraph() or with with _test_eager_guard()

    • Determine in new dynamic graph in static or dynamic graph mode: _in_eager_without_dygraph_check()

  • Support inplace after dynamic graph reconstruction: input and output are the same Tensor.

    • Adapt the inplace strategy for dynamic graph reconstruction intermediate states.(#40400)

    • Adapt the inplace strategy to the final state of the dynamic graph reconstruction. (#40695)

    • Add inplace strategy to PyLayer function after dynamical graph reconstruction. (#41043)

    • Add inplace strategy for Tensor’s setitem function after dynamical graph reconstruction. (#40915)

    • Add _reset_grad_inplace_version interface after dynamic graph reconstruction, to set the inplace version of the Tensor’s gradient to 0. (#41101)

    • If the value of the forward Tensor is not needed during the inverse computation (no need buffer property), the inplace version detection operation is not needed for that Tensor. For Tensor with no_need_buffer, skip the inplace version check. (#41350)

    • Unify error messages for inplace version checks after and before reconstruction of dynamic graphs. (#41209)

  • Support view strategy after dynamical graph reconstruction: input and output Tensor share underlying data.

    • Adapt the view strategy for dynamic graph reconstruction intermediate states. Include reshape , squeeze , unsqueeze , and flatten APIs. (#40830)

    • Adapt the view strategy for dynamic graph reconstruction final state. Include reshape API. (#40891)

  • Add support for weakref on the python side of the new dynamic graph eager Tensor. (#41797)

  • Enhance the new dynamic graph DoubleGrad function to support the basic DoubleGrad feature.(#41893, #41894, #41895)

  • Add core.eager.StringTensor interface, to support the construction of StringTensor on python side and the use of the StringTensor related APIs. (#41039)

  • **Add _grad_name and _grad_value*to core.eager.Tensor to return the name and value of a gradient. (#41990)

  • Add the processing of the no_need_buffer attribute for dynamic graph intermediate state. The Tensor with the no_need_buffer attribute is skipped in the inplace backward check operation. (#41720)

New Static Graph Executor

In order to solve the problem that the original static graph executor of the PaddlePaddle is not good enough for scheduling in some scenarios and it is not easy to use multiple streams, we have implemented a new static graph executor with superior performance. It is easy to take advantage of the asynchronous scheduling capabilities of multi-streams and multi-threads. The new executor is a compatible upgrade of the original executor. At present, it is used by default in single-card scenarios. Users do not need to make any changes in the training codes. It can be used automatically. Of course, we also provide an interface to switch back to the original executor. Users can switch back to the original executor by setting the environment variable: FLAGS_USE_STANDALONE_EXECUTOR=false. (#41179) The main contents are as follows.

  • Basic components: High-performance thread pool for multi-threaded scheduling in the executor (#35470, #35930, #36030, #36480, #36688, #36740, #38335, #40770) and thread co-op component (#38779, #40876, #40912) . There is the timely memory recovery after operator execution (#37642, #39617, #40859). There is the new dependency analysis algorithm for parallel executor (#37231) etc.

  • Scheduling logic: Optimize the scheduling method of operator in the executor. Support multi-stream multi-threaded asynchronous scheduling mechanism. Change transforms such as data type, device, and layout to the operator scheduling to improve performance. Support caching the selection of operator Kernel. Support the selection of new PHI operator.(#35024, #34922, #35711, #35928, #39458#36899)。

  • Interface compatibility: Compatible with the user interface and functionality of the original executor, such as alignment with python interface Executor.run(), support for managing Tensor in Scope, etc. This ensures that users can switch to the new executor without perception. (#37278, #37379, #37445, #37510, #40955, #41778, #41058, #38584, #37957, #37672, #37474, #37085, #37061, #36945)

  • Enhance debugging and error reporting in multi-threaded scenarios by capturing error reports from sub-threads and throwing them uniformly in the main thread. This can improve user experience. (#36692#36802)

  • Fix the bug with the new executor communication flow resetting stream cache information in the allocator, to reduce RecordStream overhead in cross-stream scenarios. This improves performance of DeepFM models by about 8% after optimization. (#42046)

  • Optimize the dependency analysis method between new executor operators to improve runtime performance. Establish correct dependencies for send/recv communication operators to support pipeline parallel. (#42009)

Distributed Training

  • Basic functions of multi-machine multi-card parallel training based on collective communication

  • Dynamic graph hybrid parallelism

  • Static graph hybrid parallelism

    • Add scale_gradient flag bit to gradient_scale_configs to control the position where the gradient aggregation operation averages the gradients under pipeline parallelism. (#36384)

    • Under tensor parallelism, the dropout op supports the settings of deterministic random seed generators, to ensure random consistency for non-distributed variables and randomness of distributed variables. (#36228)

    • NPU hybrid parallelism supports Offload, with saving 40% of NPU memory. (#37224)

    • Add force_cpu optional parameter to the seed op, to allow dropout to read seed values directly from CPU. (#35820)

    • Improve the Automatic Sparsity (ASP) sharding strategy and support the selection of sharding strategy according to the program. (#40028)

  • Automatic parallel

    • Add the process restart (relaunch) after automatic mapping between logical processes and physical devices. (#37523, #37326)

    • Improve the underlying mechanism and interface for automatic parallel to facilitate the unification of modules and add the optimized pass. (#36617, #38132)

    • Add unified resource representation, to support for automatic mapping between logical processes and physical devices. (#37091, #37482, #37094)

    • Improve the distributed attribute complementation for the backward and update parts of the computation graph. (#36744)

    • Add data slicing function. (#36055)

    • Add tensor resharding function to reshard the tensor according to the distributed properties of the tensor and operator. (#40865, #41106)

    • Add the automatic conversion pass of distributed parameters when the number of resources or parallel policy changes. (#40434)

    • Add GradientMerge pass to reduce the number of communications and improve training efficiency. (#38259, #40737)

    • Add Recompute pass to reduce the activation memory storage. (#38920)

    • Add Sharding optimization pass, to support p-g-os 3 stage optimization. (#38502)

    • Add AMP + FP16 optimization pass. (#38764, #40615)

    • Add fused QKV parallelization for Transformer class model. (#39080)

    • Improve the sharding propagation for while op to ensure convergence of the fix-point algorithm. (#39939, #39086, #39014)

    • Support training and inference for sub-block and while op control flow. (#39612, #39895, #40077)

  • Parameter Server

    • Add NaN/Inf value checking tool under GPUPS. (#38131)

    • Under GPUPS, add set_date interface to adapt incremental training. (#36194)

    • Under GPUPS, add asynchronous release dataset function. (#37790)

    • Under GPUPS, support the Dump parameters and intermediate layers(#36157);

    • Under GPUPS, support the optimizer parameter configuration. (#39783, #39849)

    • Under the Unified Parameter Server, refactor the base classes of each module such as communication and storage, to improve the ease of secondary development of each module. (#41207, #41022, #40702, #39341 #39377, #39191, #39064)

    • Add evaluation metrics module under the Unified Parameter Server, to support AUC/WuAUC/MaskAUC and other evaluation metrics calculation and customizable extensions. (#38789)

    • Supports XPU parameter server training on KUNLUNXIN 2. (#41917, #42266, #41916)


  • Add the performance analysis module paddle.profiler in the Python layer: Provide the ability to collect, export, and count performance data during the training push. (#40065, #40357, #40888)

    • paddle.profiler.Profiler : performance analyzer, interface for user interaction. (#41029, #41524, #41157, #40249, #40111, #39964, #40133)

    • paddle.profiler.RecordEvent: provide custom punches to record time. (#39693, #39694, #39695, #39675,#41445, #41132)

    • paddle.profiler.ProfilerTarget: specify the target device for performance analysis.

    • paddle.profiler.ProfilerState: indicate the state of the performance analyzer.

    • paddle.profiler.SortedKeys : specify the sorting method of the data within the statistics form.

    • paddle.profiler.make_scheduler: the scheduler generating the performance analyzer state and implement the periodic control of the collection scope.

    • paddle.profiler.export_chrome_tracing: save performance data to a google chrome tracing file viewable by the chrome://tracing plugin. (#39316, #39984, #41029)

    • paddle.profiler.export_protobuf: save performance data to a protobuf file represented by internal structure. (#39519, #39109, #39474)

    • paddle.profiler.load_profiler_result: load the performance data saved to a protobuf file.

    • paddle.profiler.Profiler generate statistics for data reading, step overhead and throughput for the model training by specifying the timer_only parameter.(#40386)

  • Refactor Profiler underlying infrastructure in C++ layer

  • Modify the name and type of logging for op under new dynamic graph.(#41771

  • Add Kernel running statistics into profilers’ summarization and optimize the summarization.(#41989

  • Remove side-effect to performance in forward computing forward when Profiler is off. (#42142

CINN compiler adoption

With the recent development of PaddlePaddle’s compiler, a.k.a, CINN(GitHub - PaddlePaddle/CINN: Compiler Infrastructure for Neural Networks), paddle framework has also been changed to adapt the compiler CINN features. These include the subgraph management related functions for the Paddle-CINN runtime, optimization of memory and speed performance, and bug fixing during development.

  • Functions developed:

    • Subgraph op related functions:

      • Add the function to find and generate CINN subgraphs from computational graphs.(#36345

      • Add cinn_launch op as a runtime entry point to CINN. It is responsible for scheduling CINN to compile the subgraph, to initialize the data, and to execute the generated kernels.(#36600

      • Add a helper class CinnLaunchContext to the kernel implementation of cinn_launch op to manage the intermediate data for compiling and running subgraphs, to improve scalability and code readability.(#37938

      • Add additional fetch nodes to CINN subgraphs, thus ensuring that CINN external nodes can fetch the values of variables.(#37172, #37190

      • Add the function to symbolize a CINN subgraph, which is used to topologically sort the subgraphs and return the CINN execution sequence.(#36417

      • Add CinnCompiler class for involking subgraphs in the CINN compiled graph that can be replaced by using CINN operators. (#36562, #36975

      • Add the interface to CINN symbolization class to get the names of subgraph fetched variables to prevent fetched variables from being eliminated in compilation optimizations.(#37218

    • Checking, debugging, and PI changes related:

      • Synchronize the update of NetBuilder API name changes in CINN.(#40392

      • Add necessary log information to Paddle-CINN for better debugging.(#36867

      • Add the bidirectional conversion function between Paddle desc and CINN desc.(#36100

      • The operator implemented in CINN may not use some input variables compared to Paddle. Therefore, remove the check that the input variables must be used in the cinn_launch op.(#37119

      • Added cinn_instruction_run op for invoking CINN to execute a single generation instruction, facilitating the construction of scheduling run subgraphs on the Paddle side.(#39435, #39576

      • Add control macros to Paddle for CUDA/CUBLAS/MKL/CINN pass application required to compile CINN.(#37066, #36660

      • Add two control flags FLAGS_allow_cinn_ops and FLAGS_deny_cinn_ops to control the categories of CINN operators used to replace native operators during Paddle training.(#36842

  • Performance optimization:

    • Speed optimization

      • Optimize the computational time consumed by CinnCacheKey.(#37786, #37317

      • Cache variable scope for CINN compiled subgraphs to reduce runtime parameter construction overhead.(#37983

      • Utilize CINN’s auto-tuning in case of subgraph compilation, could be enabled by flag, for further tuning of training performance.(#41795

      • Refactor the correctness check of compilation results in case of subgraph compilation to avoid repeated checks at runtime and reduce the scheduling overhead.(#41777

      • Enable TransposeFolding and GemmRewriter optimization passes by default in Paddle-CINN training.(#41084

      • Pass the cuda stream created in Paddle into CINN so that Paddle and CINN can use the same CUDA stream in cuda computing.(#37337

      • Move CINN optimization pass application logic from Paddle to CINN.(#42047, #42070

    • Device memory optimization

      • Add NoNeedBufferVars to cinn_launch op to declare a list of input variables that do not require a buffer, so that the memory can be freed in advance.(#38367

      • Pass in reference count information for external variables to the subgraph, so that subgraphs within cinn_launch can reuse memory optimization passes and reduce the memory overhead in using CINN.(#39209, #39622

      • Add the function to convert a collection of executable instructions generated by CINN compilation to a Paddle Graph, supporting reuse of the Paddle scheduler and memory optimization pass, further reducing the memory overhead in using CINN. (#39724, #39911

      • Add Kernel of cinn_instruction_run op, to support dynamic device memory requests based on data types inferred from compilation results.(#40920

  • Bug fixing:

    • Fix and optimize the generation logic of CINN subgraphs.(#36503

    • Fix the bug that Paddle-CINN does not support no-input subgraphs.(#40814

    • Fix an error reported due to CINN not being able to handle useless outputs in operators such as batch_norm.(#36996

    • Fix several bugs in CINN subgraph partitioning and symbolization, and solve problems with Paddle training accessing the CINN. (#36739, #36698 )

    • CINN does not yet support the control flow yet. Add logic to skip control flow when encountered.(#40812


  • Model quantization

    • Upgrade quantization storage format to unify quantization formats for dynamic and static graphs. (#41041)

    • Add new post training quantization (PTQ): EMD and Adaround. (#40421, #38460)

    • Support to quantize more operations in PTQ and QAT, such as crop, split, ab, unsqueeze etc. (#40083)

    • Support to quantize operators in control flow. (#37498)

    • Support quantization of matmul_v2 operator. (#36469)

    • Add support for quantized matmul_v2 inference on TensorRT. (#36594)

  • CUDA memory optimization

    • Implement multi-stream safe Allocator to support safe and efficient use of CUDA memory in asynchronous computing scenarios. (#37290)

    • Add new APIs (paddle.device.cuda.max_memory_allocated, paddle.device.cuda.max_memory_reserved, paddle.device.cuda.memory_allocated and paddle.device.cuda.memory_reserved) for GPU memory monitoring in runtime. (#38657)

    • Support allocate CUDA Managed Memory to train super large models in memory-constrained scenarios. (#39075)

    • Add GetBasePtr interface in C++ to get device address created with cudaMalloc. (#37978)

    • Reduce the number of free blocks in AutoGrowth Allocator to improve memory allocation performance. (#35732)

    • Remove redundant Float32 temporary tensor and cast operation for tensor with data type FP16 ininitializer.Normal and initializer.Constantto save 2x memory. (#38818)

  • High-order derivative testing for models in dynamic graphs.

    • Add third-order derivative testing for network in dynamic graphs. (#36814 , #37377)

  • Custom op: Support to custom op in ROCm(HIP) platform. (#36771)

  • Cost Model: Add basic Cost Model based on profiling infomation. (#35774)

  • Added a function to allow user to add their own layer and correspond pruning way to ASP support. (#40253)

  • Add string tensor data structure, allowing the framework to have the ability to represent and process string. (#39830, #40992)

  • Add or upgrade oneDNN FP32/int8/bfloat16 Kernel, including:

  • Add the 3-stage storage graph retrieval engine based on SSD - host memory - GPU device memory, to support large-scale graph neural network training. (#42472, #42321, #42027)

  • Add heterogeneous multi-cloud training communication module switch, implement the Send/Recv interface function, and support multiple heterogeneous cloud communication.(#40965 40911

(2) Function optimization


  • Add backward implementation of paddle.linalg.det . (#36013)

  • Add support for mixed precision training O2 mode for paddle.Model, i.e., support for Pure FP16 training mode of the original dynamic/static graphs. (#36441)

  • Support for self chain calls for paddle.nn.Layer. (#36609)

  • Add settings of is_distributed property for the to method of paddle.nn.Layer to ensure that the distributed properties remain consistent before and after network parameter transform. (#36221)

  • Improve the parameter conversion logic of the to method of paddle.nn.Layer, to reduce the peak memory consumption of the conversion process and improve the conversion success rate. (#36862)

  • Support settings of the shape of the output Tensor for paddle.incubate.graph_send_recv to reduce the memory usage during the actual computation. (#40509)

  • Add the support of int32 and int64 data types for paddle.incubate.segment_sum, segment_mean, segment_max, and segment_min. (#40577)

  • Add the support of the bool type for transpose op. (#35886)

  • Switch the paddle.mm underlying operator from matmul to matmul_v2. (#35770)

  • Support static graph mode and support the unknown shape for paddle.einsum. (#40360)

  • Support dataparallelism for paddle.nn.functional.margin_cross_entropy and paddle.nn.functional.class_center_sample. (#39852)

  • Support input of shape [1] for paddle.nn.functional.grid_sample . (#36183

  • Support NHWC data format for paddle.nn.PRelu . (#37019)

  • Support the fixed random state using paddle.seed for paddle.nn.functional.class_center_sample . (#38248)

  • Add ROCM backend support for all APIs under paddle.fft , and optimize CUFFT backend error messages. (#36415, #36114)

  • Support the function that the slicing dimension i 0, that is, allow slicing index results to be empty . (#37313)

  • Support int and bool type Tensor with using bool index for Tensor.setitem . (#37761)

  • Support nearest mode for paddle.nn.functional.interpolate when the input shape is 5D. (#38868)

  • Add the support of int16 for paddle.nn.Embeddingandpaddle.gather. (#40964, #40052)

  • Support dataparallelism on single machine on``CPU platform``in paddle.distributed.spawn . (#35745, #36758, #36637)

  • Add depthwise_conv2d MKLDNN operator. (#38484)

  • Add complex types check in the static graph model for APIpaddle.abs , paddle.transpose , paddle.squeeze , paddle.unsqueeze , paddle.matmul , and paddle.full . (#40113)

  • Support tuple and list type arguments for paddle.autograd.PyLayer . (#38146)

  • Add check whether tensor is inplace and leaf when calculate gradient . (#37931)

  • Support HIP library for paddle.autograd.PyLayer . (#38184)

  • Support more size inputs for paddle.take_along_axis and paddle.put_along_axis , and allow index matrix shape size to be larger than array matrix shape size. (#39072)

  • Optimize the error report message of API paddle.nn.Pad2D when replicate is 0. (#36510)

  • Support pad input in tuple format for API paddle.nn.Pad2D . (#35985)

  • Add tdm_sample API in paddle.distributed.InMemoryDataset to support sampling operations in TDM algorithms. (#37044)

  • Add Pre-saving Hooks mechanism for paddle.jit.save . (#38186

  • Add new higher-order differentiation-related APIs.

    • elementwise_add: add third-order Kernel, to support computation of third-order differentiation. (#36508, #36618)

    • matmul_v2: add third-order Kernel, to support computation of third-order differentiation. (#36459)

    • elementwise_mul: Add third-order Kernel, to support computation of third-order differentiation. (#37152)

  • Improve the logic of the paddle.amp.GradScaler to call check_finite_and_unscale op, to eliminate the cudaMemcpy introduced by the creation of the bool variable. (#37770)

  • Add check for unstack and unique op in case of input Tensor with 0 elements. (#36021)

  • Add new multi-layer, bi-directional LSTM function that supports KUNLUNXIN 2, to improve RNN forward/backward ops, and support the use of temporal model training. (#42076)

  • Add bce_loss forward/backward ops for KUNLUNXIN 2. (#41610)

  • Add backward implementation of paddle.linalg.det . (#36013)

IR(Intermediate Representation)

  • Dynamic Graphs to Static Graphs

    • Optimize the behavior of the ProgramCache.last interface for dynamic graph to static graph so that it returns the most recently used Program instead of the final generated Program. (#39541)

    • Optimize the error report message for the paddle.reshape API for dynamic graph to static graph, and add a new recommended usage hint. (#40599)

    • Optimize the type of exception catch in the is_api_in_module function when transcribing dynamic code to static code. (#40243)

    • Optimize the hint of error message for dynamic graph to static graph,hide warning information by default. (#39730)

    • Add the support of type hint syntax for dynamic graph to static graph to improve the accuracy of variable type analysis. (#39572)

    • Optimize the paddle.cond function to allow values are equal for basic types such as bool and int . (#37888)

    • Optimize the decorate function @to_static to allow the switch of the train/eval mode. (#37383)

    • Optimize the stack of error report for dynamic graph to static graph, to highlight user-related codes and reduce the framework redundant error stack. (#36741)

    • Remove no_value placeholder from the return value of paddle.cond. (#36513#36826)

    • Adapt the run_program op to the new dynamic graph mode. (#40198, #40355)

    • Add check for zip syntax. (#37846)

    • Fix the dynamic graph to static graph failure due to the error of dimension and type judgment in the paddle.signal.frame, paddle.signal.stft and paddle.signal.istft. (#40113)

    • Add registration of plural type Kernel for mean, pad3d ops. (#40113)

Mixed Precision Training

  • Add GPU Compute Capability environment check for amp. Add the usage warning for GPU environments that the fail acceleration for training. (#38086)

  • Add check of calling order when using paddle.amp.decorate and paddle.DataParallel at the same time. (#38785)

Distributed Training

  • Basic functions of the distributed training

    • Optimize Fleet API and DistributedStrategy configuration to use dynamic graph parallel function conveniently. (#40408)

    • Optimize Dynamic Graph mixed parallel HybridParallelClipGrad strategy, support 4D hybrid parallel and Pure FP16 training. (#36237, #36555)

    • Restructure dynamic graph data parallel strategy, to support new dynamic graph and communication. (#40389, #40593, #40836, #41119, #41413, #39987)

    • Support distributed tensor model parallel for fused_attention op. (#40101)

    • Support the distributed tensor model parallel for fused_feedforward op. (#40160)

  • Graph retrieval engine

    • Optimize the data format returned by the graph sampling interface of the graph engine, with a 3x improvement of the sampling speed. (#37315)

    • Reduce the amount of graph engine threads to improve performance. (#37098)

    • Optimize graph engine data transfer to improve performance. (#37341)

    • Optimize the merge logic of embedding op to improve performance by exploiting the topological relationship of embedding op in the model. (#35942)

  • Communication library: restructure the communication library to improve the scalability and development of the communication library, and support heterogeneous communication. (#41398, #39720, #40911, #40579, #40629, #40437, #40430, #40228, #40181, #40100, #40097, #39892, #39384, #39737, #40040)

  • Support the publication of MoE-related interfaces in paddle.incubate.distributed.models.moe (moe.GShardGate , moe.BaseGate , moe.SwitchGate , moe.MoELayer , and moe. ClipGradForMOEByGlobalNorm ). (#42300)

  • Fix the error report in the use of recomputing in paddle.incubate.distributed.models.moe.MoELayer . (#42128)

  • Fix the error report in the new dynamic graph pipeline parallel caused by different data types (#41937 #42053)

  • Fix the error report in the new dynamic graph tensor model parallel due to different data types(#41960

Custom operator

  • Enhance the C++ custom operator mechanism for writing second-order gradient operators, to support adding suffixes to the gradient input variables of second-order gradient operators for use as outputs. (#41781)

  • Remove the use of the deprecated enumeration type PlaceType from the Tensor API member methods, make it compatible, and add a deprecation warning. (#41882)

  • Add deprecated warning for a number of deprecated interfaces of the original Tensor API, including the incomplete constructor, reshape, mutable_data, and copy_to methods. (#41882)


  • Error report and debugging optimization

    • Optimize the error message of the label boundary check for the cross_entropy op. (#40001)

    • Add profile record for infer_shape and compute methods of op execution of dynamic graphs, show their cost in timeline. (#39023)

    • Replace pybind::index_error error hint on Windows for unknown exceptions. (#40538)

    • Add the error message in the out-of-bounds checks for user scatter op. (#37429)

  • Download tool: For the problem of slow decompression of directories with multiple files in paddle.utils.download.get_path_from_url, replace the original way (traverse directory in loop) of decompressing files in directories one by one by calling extractall on the directory, which greatly improves the decompression speed. (#37311)

  • Speed up the quantization training forfake_quantize_range_abs_maxfake_quantize_abs_maxfake_quantize_dequantize_abs_maxfake_quantize_moving_average_abs_max, etc. (#40491)

(3) Performance optimization

Distributed Training

  • Hybrid parallel optimizer sharding_optimizer supports optimize_cast optimization, which move the parameter cast during forward and backwark stage to the optimizer stage. This improves performance by 7%. (#35878)

  • GPUPS optimization: support for gradient fuse allreduce training. This improves training performance by 20%. (#35131)

  • GPUPS optimization: dump CPU optimization speed improves by 3.21x. (#40068)

  • CPU parameter server streaming training optimization: support for automatic statistics of sparse parameter statistics, incremental saving of sparse parameters, etc. The training performance improves by 20%. (#36465, #36601, #36734, #36909, #36943, #37181, #37194, #37515, #37626, #37995, #38582, #39250, #40762, #41234, #41320, #41400)


Add hardware-aware automatic performance tuning for the full training process, with performance improvements of about 3% to 50% or more on image classification, segmentation, detection, and image generation tasks compared to the model’s default configuration. The auto-tuning status is set via the paddle.incubate.autotune.set_config API. By default, it is currently disabled. Auto-tuning has three specific levels:

  • Add the auto-tuning function to paddle.io.DataLoader , to select the best num_workers based on training data and device resources. (#42004)

  • Add mixed-precision training data layout auto-tuning feature, to select the best data layout based on device type and data type, and automatically convert it at runtime. (#41964)

  • Add the automatic tuning of the required workspace size threshold for Conv, which is automatically set based on the GPU’s currently available requested device memory resources. Add the automatic selection of Conv cuDNN algorithms based on the generic AlgorithmCache design and Kernel timing component, which supports data variation length models.(#41833

Operator Optimization

  • Optimize FasterTokenizer performance, with a 10% performance improvement compared to pre-optimization. (#36701)

  • Optimize index_select inverse computation, with 3.7~25.2x performance improvement over pre-optimization. (#37055)

  • Optimize the performance of paddle.nn.ClipByGlobalNorm . Take 10*10 paddle.nn.Linear as an example. In contrast to pre-optimization, the performance improves by about 30%. (#38209)

  • Optimize the performance of pnorm with very large or very small axis dimensions, with 31-96x improvement in forward speed and 1.1-19x improvement in backward speed. (#37685, #38215, #39011)

  • Optimize softmax forward and backward performance, with a speedup ratio of about 2x for the axis!=-1 configuration. (#38602, #38609, #32387, #37927)

  • Optimize log_softmax forward and backward performance, with a speedup ratio of about 6x to 20x for axis!=-1 configurations. (#38992, #40612)

  • Optimize softmax_with_cross_entropy forward and backward performance, with a speedup ratio of about 1.3x for the hard_label configuration. (#39553, #40424, #40643)

  • Optimize top_k performance, with a speedup ratio of more than 22x for one-dimension and larger k (k=5000) configuration. (#40941)

  • Optimize elementwise_mul backward computation, with 1.85~12.16x performance improvement over pre-optimization. (#37728)

  • Optimize elementwise_min and elementwise_max backward computation, to equalize or improve performance by 1.05x to 18.75x over pre-optimization. (#38236, #37906)

  • Optimize nearest_interp forward and backward computation, with forward performance improvement by 1.5x to 2.3x over pre-optimization, and backward performance improvement by 60% to 1.8x over pre-optimization. (#38528, #39067)

  • Optimize bilinear_interp forward and backward computation, with forward performance improvement by 0.4x to 2.3x over pre-optimization, and backward performance improvement by 10%-30% over pre-optimization. (#39243, #39423)

  • Optimize dropout forward and backward computation, with performance improvement by about 20%. (#39795, #38859, #38279, #40053)

  • Optimize grid_sampler forward and backward computation, with forward performance improvement by 10% to 30% over pre-optimization, and backward performance improvement by 10% to 60% over pre-optimization. (#39751)

  • Optimize group_norm forward and backward computation, with the forward performance improvement by 1.04x to 2.35x, and backward performance improvement by 1.12x to 1.18x. (#39944, #40657, #39596)

  • Optimize conv1d forward and backward computation, with the forward performance improvement by 1.00x to 2.01x, and backward performance improvement by 1.01x to 474.56x. (#38425)

  • Optimize elementwise_div backward computation, with the backward performance improvement by 1.02x to 29.25x. (#38044)

  • Optimize gelu forward and backward computation, with the backward performance improvement by 1.13x to 1.43x, and reverse performance improvement by 1.10x to 1.55x. (#38188, #38263)

  • Optimize elementwise_sub backward computation, with the backward performance improvement by 1.04x to 15.64x. (#37754)

  • Optimize flip's forward performance on one-dimensional data input, with the performance improvement by 100%. (#37825)

  • Optimize layer_norm forward and backward computation, with the forward performance improvement by 2x to 5x over pre-optimization, and backward performance improvement by 20% to 50% over pre-optimization. (#39167, #39247)

  • Optimize embedding forward and backward computation, with a maximum improvement of 1.51x in forward performance and 1.03x to 7.79x in backward performance. (#39856, #39886)

  • Optimize gelu FP16 forward and backward calculations, with forward performance improvement by 9% to 12% over pre-optimization, and backward performance improvement by 2% to 9% over pre-optimization. (#38980)

  • Remove CPU -> GPU explicit data transfer operation in gather_nd forward and backward operators, and remove the explicit synchronous operation in index_select forward and backward operators. Change GPU -> GPU data transfer in scatter_nd from synchronous operation to asynchronous operation. (#40933)

  • Optimize Lars optimzier computation, with the training performance improvement of Resnet50 PF16 model by 5.1% over pre-optimization. (#35652, #35476)

  • Optimize AvgPool2dGrad computation, with the performance improvement by 2.6x over pre-optimization. (#35389)

  • Optimize Elementwise computation for multivariate output, improving performance by up to 15% over pre-optimization. (#38329, #38410

  • Optimize Categoricalthe probs computation, simplify the computation logic, and improve the performance by 4x to 5x. (#42178)

  • Optimize the paddle.sum performance, with performance improvement by about 20%. (#42309)

  • Remove CudaStreamSync operation from paddle.nn.ClipGradByGlobalNorm to reduce scheduling overhead during execution, with 5% performance improvement on ptb models. (#42170)

  • Optimize a series of underlying data structures and detailed implementations in the original dynamic graph execution system to improve the scheduling performance of the original dynamic graph. (#42010, #42171, #42224, #42256, #42306, #42329, #42340, #42368, #42425

  • Simplify the probs calculation logics of paddle.distribution.Categorical , to improve performance by 4x to 5x. (#42178)

(4) Bug fixing


  • Fix the output type error with paddle.sum when the input parameter type and output parameter type do not match and the number of reduce elements on the axis is 1. (#36123)

  • Fix an AttributeError in paddle.flops when the layer output type is tuple. (#38850)

  • Fix the paddle.diag failing to propagate gradients because there is no backward kernel. (#40447)

  • Fix an error in sorting paddle.sort input with NaN values. (#41070)

  • Fix the error whenpaddle.full_like’s input contains INF value. (#40232)

  • Fix the bug in paddle.strided_slice: strided_slice result does not consistent with slice when the data in the input of starts is less than -rank. (#39066)

  • Fix the bug in the max_pool family of operators where infer_shape is calculated incorrectly when index is returned. This affects the APIs: paddle.nn.functional.max_pool1d/2d/3d, paddle.nn.functional.adaptive_max_pool1d/2d/3d, paddle.nn.MaxPool1D/2D/3D, paddle.nn.AdaptiveMaxPool1D/2D/3D. (#40139)

  • Fix an issue where the dtype of pooling_mask returned by the max_pool family of operators is incorrect. Now the dtype of pooling_mask is int32. The affected APIs are paddle.nn.functional.max_pool1d/2d/3d, paddle.nn.functional.adaptive_max_pool1d/2d/3d, paddle.nn.MaxPool1D/2D/3D, paddle.nn.AdaptiveMaxPool1D/2D/3D. (#39314 )

  • Fix the bug with paddle.shape where the backward gradient by default causes a computation error. (#37340)

  • Fix the bug in paddle.nn.Layer's to method when converting both dtype and place at the same time. (#37007)

  • Fix the bug that paddle.amp.decorate fails to rewrite the parameters of non-leaf network layers to FP16. (#38402)

  • Fix the bug that the paddle.amp.decorate rewrites the non-input parameter in paddle.nn.BatchNorm1D, paddle.nn.BatchNorm2D, and paddle.nn.BatchNorm3D to FP16. (#38541)

  • Fix the bug that the paddle.amp.decorate rewrites the non-input parameter in paddle.nn.SyncBatchNorm to FP16. (#40943)

  • Fix redundant warnings in paddle.nn.Layer.to. (#36700)

  • Fix the bug in paddle.nn.RNN when being used inside control flow. (#41162)

  • Fix the bug that the paddle.to_tensor fails to specify the CUDAPlace of the Tensor. (#39662)

  • Fix the issue thatpaddle.nn.Identity is not exposed. (#39615)

  • Fix the bug where the output values of the fill_ and zero_ inplace APIs are incorrect when the input is on a CUDAPinned Place after dynamic graph reconstruction. (#41229)

  • After refactoring the dynamic graph, fix the bug of incorrect inplace version value of the output Tensor when calling assign op using the append op. Change it to call assign op using the _C_ops. (#41118)

  • Remove unreasonable codes in the elementwise_add ‘s third-order kernel, and fix an uninitialized issue in the network creation process. (#36618)

  • Fix the missing attribute bug in conv2d execution of cuDNN Kernel. (#38827)

  • Fix an issue where multiclass_nms3 output shape is incorrect. (#40059)

  • Fix an issue with yolo_box outputting incorrect shape. (#40056)

  • Fix an issue where the higher-order differentiation gradients interface does not take effect as expected when target_grad is specified. (#40940)

  • Fix an issue that the network parameter type is incorrect when the default_dtype is modified in the op_BatchNormBase base class in the dynamic graph mode. The affected APIs are paddle.nn.BatchNorm1Dpaddle.nn.BatchNorm2Dpaddle.nn.BatchNorm3D, and paddle.nn.SyncBatchNorm. Specific reason: when get_default_dtype() == 'float16', the default parameter data type is modified by set_default_dtype('float32') . The parameter type in dynamic graph mode is created by default_dtype; therefore, the change of the default parameter type causes the subsequent networking Parameter type error. (#36376)

  • Fix the bug of the undefined intermediate variable in the backward op in batchnorm op in case that the data type is FP32 and the data dimension is dims = 2 and data_layout = NHWC. (#37020)

  • Fix the bug that shape of weights is incorrect, when usingpaddle.static.nn.prelu in static graph mode, and input format isNHWC, mode==channel. (#38310)

  • Fix the bug of paddle.nn.functional.class_center_sample: CUDA seed setting issue in multi-machine case. (#38815)

  • Fix the bug of failing to report error when the input ofpaddle.nn.functional.one_hotis incorrect. (#41335)

  • Fix an issue where a callback to reclaim device memory on a DCU device is not triggered in time, resulting in an OOM of the device memory. (#40445)

  • Fix the bugs of setitem backward gradient abnormal and inplace logic handling abnormal in some dynamic graph scenarios. (#37023, #38298)

  • Fix the bug of index abnormal when Tensor array uses the Slice to index in the dynamic to static scenarios. (#39251)

  • Fix the bug of memory or device memory leaks caused by some temporary variables not being correctly destructed when paddle.Tensor.register_hook interface is used. (#40716)

  • Fix the bug that Tensor.getitem cannot get the value when the index is a bool Tensor with all False. (#41297)

  • Fix the bug that Tensor.getitem cannot get the value when the index is a bool scalar Tensor. (#40829)

  • Fix the bug in paddle.index_select when index is a 0-shape Tensor. (#41383)

  • Fix the bug when the number of GPU threads requested by paddle.index_select and paddle.index_sample exceeds the limited machine resources. (#41127, #37816, #39736, #41563)

  • Fix the bug when ReduceConfig, elemwise_grad, gather, gather_nd, and scatter ops request more GPU threads than the limited machine resources. (#40813, #41127)

  • Fix the bug that the memory access is out of boundary when NX ! = 1 in ReadData, ReadDataBc, and ReadDataReduce in Kernel Primitive API. (#36373)

  • Fix the bug of the computation result abnormal due to data overflow caused by the IndexRandom data type error. (#39867, #39891)

  • Fix the bug of the returned computing result error of reduce op when reduce_num = 1. (#38771)

  • Fix the bug of the memory access out-of-bound of reduce op in the middle dimension of reduce in HIP environments. (#41273)

  • Fix the bug of Kernel failed to properly release in the computation of two FP16 one-dimensional vectors of matmul op.

  • Fix the bug caused by CUDA integer computation overflow for some operators, including: bernoulli, gaussian_random, gumbel_softmax, multinomial, truncated_gaussian_random, uniform_ random_inplace, and uniform_random ops. (#37670)

  • Fix the bug where paddle.nn.Sequential reports a KeyError error when traversing sublayers in a for loop. (#39372)

  • Fix the bug of the check shape error in paddle.nn.functional.unfold when compiling in static graphs. (#38907, #38819)

  • Fix the bug of reporting an error if axis is specified when using dropout for static graphs. (#37223)

  • Migrate the matmul operator in the paddle.nn.MultiHeadAttention to the matmul_v2 operator. (#36222)

  • Fix the bug occurred in throwing FPE when the empty Tensor is used in paddle.nn.functional.label_smooth. (#35861

  • Fix the deformation bug of reshape op when input is an empty Tensor. Support the empty Tensor rehape to [-1]. (#36087)

  • Fix the bug of the modified values will incorrectly override other rows when the fill_diagonal ‘s input parameter offset is non-zero. (#36212)

  • Modify stop_gradient returned by the range op bing set to True in dynamic graph mode. (#37486)

  • Fix the bug where Lamb optimizer is updated incorrectly when Beta1Pow and Beta2Pow are on the GPU. (#38518)

  • Fix the bug where the conv2d operator doesn’t respect to FLAGS_cudnn_deterministic. (#37173)

  • Fix the bug caused by an earlier version of cufft that does not define CUFFT_VERSION. (#37312)

  • Fix the computing error of paddle.ifftshit and paddle.fftshift. (#36834, #36748)

  • Fix the axis computation error in paddle.fft series of APIs. (#36321)

  • Fix an output data type registration bug of batch_norm_grad op in case of FP16 data type. This bug causes the compilation failure in some scenarios. There is also the impact on FP16 computational precision. (#42461)

  • Fix the incorrect Infershape information bug in the paddle.nn.functional.pad API when the padding is Tensor in dynamic to static conversion. (#42414)

  • Fix an exception in paddle.distribution.StickBreakingTransform when the input dimension exceeds 2. (#41762)

  • Fix a nan/inf bug calculated with QK^T in fused_attention op. (#42032)

  • Fix a nan/inf bug calculated in fused_attention op with FusedResidualDropoutBias on V100. (#42398)

  • Fix a redundant data transform bug introduced by the full_like op during execution. (#41973)

  • Fix a problem with p_norm op calculating nan on GPU environments. (#41804)

  • Fix a section error of split op when the sections parameter has a size of 0. (#41755

  • Fix the bug of reporting not supporting Place (gpu:0) in multi-card training when broadcast is required in 6 elementwise ops (pow, complex, divide_double, multiply_double, fmax, and fmin). (#42332)

  • Fix the bug that the deprecated interface reports a warning in case of import paddle due to a PIL version update. (#42307)

  • Fix the bug that paddle.linalg.matrix_rank does not support tol as FP64 Tensor under static graph. (#42085)

IR(Intermediate Representation)

  • Dynamic to static graphs

    • Fix a type derivation error in reverse gradient accumulation when the tensor_array is used with the control flow. (#39585, #39689)

    • Fix an issue where the parameter gradient type is not set correctly during dynamic to static AMP training. (#40938)

    • Fix an issue of reporting an error in the dynamic to static transcription when there are misplaced annotations in the codes. (#39035, #38003)

    • Fix an issue where Tensor is not properly converted to Variable when calling a non-forward function in dynamic to static codes. (#37296, #38540)

    • Fix an issue where paddle is incorrectly passed as a variable when dynamic to static transcription. (#37999)

    • Fix an issue where model parameters are incorrectly counted when calling paddle.flops after model dynamic to static conversion. (#36852)

    • Fix an issue where GPU memory will keep growing in train mode and no_grad contexts after loading models using the paddle.jit.save/load interface. (#36434)

    • Add warning in function of convert_call when converting the generator function. (#35369)

    • Fix the run_program op dependency analysis bug. (#38470)

    • Fix the code conversion bug when returning a single value in control flow For. (#40683)

    • Fix the bug when generating a reverse op when the input to conditional_block op contains LoDTensorArray. (#39585)

    • Fix the bug that padddle.jit.save loses the forward_pre_hook and forward_post_hook of the top Layer in case of the export of a dynamic-to-static model. (#42273)

    • Fix the dynamic to static conversion error report where the shape parameter in paddle.expand contains a Tensor. (#41973)

Distributed Training

  • Distributed training basic functions

    • Fix the bug of a port reporting error in the distributed multi-machine training. (#37274)

    • Fix the brpc compilation dependency bug. (#37064)

    • Fix an occupied port issue due to tcp self-connections when Fleet starts. (#38174)

    • Fix the precision degradation bug under data parallel due to inconsistent initialization of FP16 parameters under multiple cards. (#38838, #38563, #38405)

    • Fix the precision degradation under data parallel due to FP16 gradient synchronization without dividing by the number of cards. (#38378)

  • Dynamic graph mixing parallel

    • Fix the bug where parameters are not updated in FP16 mode under mixed parallel by using the new update interface. (#36017)

  • Static graph mixing parallel

    • Fix an issue where grad merge is not compatible with ClipGradientByGlobalNorm in distributed dp mode. (#36334)

    • Fix an issue under hybrid parallelism where the non-distributed parameters of tensor model parallelism are not broadcast during the initialization phase, resulting in inconsistent non-distributed parameters across cards. (#36186)

    • Fix the issue that sharding’s save_persistables interface does not save FP16 parameters and offload persistent variables when sharding is enabled with offload. (#40477)

    • Fix the bug where ema parameters are not saved on non-0 cards when sharding is enabled for training. (#39860)

    • Fix an issue where FC incorrectly calculates gradients according to column cuts. (#38724)

    • Fix the bug reported when DistributedStrategy is set to without_graph_optimizer when used with rnn. (#36176)

  • GPUPS Parameter Server Training

    • Fix the CPU branch compilation bug triggered by the GPUPS macro definition. (#37248)

    • Fix an occasional error raised when saving delta and pullsparse concurrency during GPUPS streamline training. (#37233)

    • Fix a download error issue caused by HDFSClient querying a directory without returning the full path. (#36590)

    • Fix the bug with pulling old parameters in GPUPS streamline training. (#36512)

    • Fix a GPUPS multi-stream allocation issue. (#37476)

    • Fix the bug of the GPUPS pybind out of core. (#37287)


  • Fix the clip_extra issue when saving models for dynamic graph quantization training. (#38323)

  • Fix an issue with abs_max scale initialization for dynamic graph quantization training. (#39307)

  • Fix an issue of exceptions in saving model in dynamic graph quantization training. (#38102, #38012)

  • Fix the offline quantization flatten op output error. (#37722)

  • Fix the non-matching dimension bug in case of inverse quantization matmul op. (#36982)

  • Fix the bug of adding quantization op when quantizing matmul_v2 without weights. (#36593)

  • Fix the error of saving the quant_axis attribute in the conv op channel-wise quantization when saving the models. (#39054)

  • Fix the slow training of channel-wise quantization. (#40772)

  • Fix the bug of quantization training when dividing by tensor(initialized as 0) leads to nan. (#36762)

  • Fix incorrect settings of amp_level for mixed precision in multi-threaded scenarios. (#39198)

  • Fix an issue where PyLayer and Recompute is not set mixed precision correctly when mixed precision training is used with PyLayer and Recompute. (#39950, #40042)

  • Fix an issue where D_GLIBCXX_USE_CXX11_ABI does not take effect when compiling custom operators under Mac. (#37878)

  • Fix the bug of inconsistent dynamic and static behaviors in case of block=None the initializer-related API. (#37827)

  • Fix the bug in python 3.6 where there is no fluid module. (#35862)

  • Fix the bug where optimizer paddle.optimizer.Adamw incorrectly calls adam op. (#36028)

  • Fix a logic error when the paddle.optimizer.Momentum optimizer parameter regularizer property is None under the multi tensor policy. (#38344)

  • Fix the bug that the paddle.optimizer.Momentum and paddle.optimizer.Adam optimizers modify the multi_precision property under the multi tensor policy. (#38991)

  • Fix the code compilation error when using final-state API amp in combination with optional Tensor. (#40980)

  • Fix the bug where paddle+lite+xpu prediction library would report an error when calling lite CPU prediction, and fix the bug where paddle+lite(without NNAdapter) would report an error when compiling. (#37449)

  • Fix the bug in Debug compile mode where LoDTensorArray crashes due to inconsistent Pybind11 bindings. (#37954)

  • Fix the bug that prevents correct construction of Tensor in the extreme case where the shape parameter is a list of Tensor mix with int. (#38284)

  • Fix a compatibility issue with the paddle.optimizer.AdamW API. (#37905)

  • Fix the bug in _InstanceNormBase where the returne value of extra_repr is incorrect. (#38537)

  • Fix the bug that the Paddle Inference lacks of the symbol paddle::distributed::TensorTable when the -DWITH_DISTRIBUTED is uesd. (#41128)

  • matmul_v2 op reports error when there is a 0 value in the shape. (#35791)

  • Fix the problem of the repeated printing for no gradient input hint message of the recomputed in dynamic graphs. Change it to the printing only once with using warning. (#38293)

  • Fix the low accuracy bug on the validation set in later epoch training in visual models in the gelu op. (#38450)

  • Fix adamw op error in numerical computation. (#37746)

  • Add the parameters in the sparse_momentum _C_ops interface. (#39969)

  • Fix the bug where there is no distributed module in python 3.6. (#35848)

  • Fix the eigh unit test data initialization problem. (#39568)

  • Fix the eigvalsh unit test data initialization problem. (#39841)

  • Fix the bug of not working properly due to excessive register usage on V100 by segment op. (#38113)

  • Fix the bug with conv-related op sparsification incorrectly set dimension. (#36054)

  • Provide Automatic SParsity training for static graph-related function Alias to Paddle.static.sparsity . (#36525)

  • Fix the bug where divide op’s integer division is still an integer. (#40890)

  • Fix the crash bug ofpaddle.multiplex when input Tensor value is 0. (#34972)

  • Fix a speed exception for set reduction parameter in paddlpaddle.nn.functional.kl_div . (#37283)

  • Fix the data source unsorted bug in loading the Cifar dataset. (#37272)

  • Fix the conversion of loss from uint16 to float in the ProgressBar class. (#39231)

  • Fix the ShareBufferWith shared data type problem. (#37464, #37247)

  • Fix the performance issue when paddle.io.DataLoader uses IterableDataset and num_workers>0. (#40541)

  • Fix the bug with paddle.vision.ops.yolo_loss returns incomplete values in dynamic graph. (#40185)

  • Remove the restriction that the input parameter dataset of paddle.io.BatchSampler needs to be the paddle.io.Dataset type, to expand the support for user-defined datasets. (#40184)

  • Fix the bug of paddle.summary reporting that op_flops does not exist. (#36489)

  • Fix the formula error of lars_momentum op when lars_weight_decay=0. (#40892)

  • Fix the bug that the optimize-offload cannot save presistable var. (#36433)

  • Fix an issue where optimizer-offload does not support adamw op type. (#36432)

  • Fix an issue where enable_program_desc_tracing_data in Tracer is not safe in multi-threaded scenarios. (#39776)

  • Fix an issue where the model file size is not initialized when the model is read. (#40518)

  • Fix the logic bug of the Expand op. When the dimension of the input Tensor X is smaller than the shape to be expanded, it may result in the incorrect Out.Shape. (#38677)

  • Fix the dynamic to static transcription error when the Expand_As op takes only y.shape without Y variable entered. (#38677)

  • Fix the logic error when Expand_As op computes the output shape. (#38677)

  • Fix the bug that the variables of the core.VarDesc.VarType.STRINGS type report error when getting the lod_level property and setting its lod_level to None. (#39077)

  • Fix an issue where the framework function Pylayer does not support different dtypes. (#37974)

  • Fix the bug of division by zero of the learning rate decay API paddle.optimizer.lr.PolynomialDecay. (#38782)

  • Fix the issue where some logs remained after calling the DisableGlogInfo() interface. (#36356)

  • Fix an error in backward of multi-layer RNN (when dropout is set to 0) in the training of SimpleRNN, GRU and LSTM API CPU. (#37080)

  • Add cache for fft on the backend of cufft and hipfft. (#36646)

  • Enable the shifts parameter of paddle.roll to support transfer in Tensor. (#36727)

  • Add onemkl to fft as an optional computation backend. (#36414)

  • Fix the precision bug in the bfloat16 type under two mamtul_v2 and elementwise_div ops. (#42479)

  • Fix a possible error in the next step caused by LoDTensorArray clearing only the internal Tensor and not clearing the Array during device memory recycling. (#42398)

4. Deployment Direction (Paddle Inference)

(1) New features

New APIs

  • Add the Java API so that Java developers can implement high performance inference on the server and in the cloud through a simple and flexible interface.(#37162)

  • Add GetTrtCompileVersion and GetTrtRuntimeVersion interfaces for getting TensorRT version information. (#36429)

  • Add the ShareExternalData interface to avoid memory copy of input data during inference. (#39809)

New functions

  • Add ONNX Runtime backend support. Currently it supports only CPU in the integrated version. (#39988, #40561)

  • Add support for Ascend 310 inference based on the Paddle Lite subgraph approach. (#35226)

  • Add the native GPU FP16 inference. (#40531)

  • For the switch_ir_debug interface, add the dump model function. (#36581)

  • Add the configuration interface for TensorRT config: void UpdateConfigInterleaved(paddle_infer::Config* c, bool with_interleaved) for special data layout in int8 quantization inference. (#38884)

  • Add TensorRT inspector output information to the log. It is valid only for TensorRT 8.2 or later. (#38362#38200))

  • Add the support of the TensorRT ASP sparse inference. (#36413)

(2) Underlying optimization

CPU performance optimization

  • Optimize the caching mechanism of MKLDNN. (#38336, #36980, #36695)

  • Add matmul_scale_fuse pass. (#37962)

  • Add MKLDNN reshape_transpose_matmul_v2_mkldnn_fuse_pass. (#37847, #40948)

  • Add MKLDNN conv_hard_sigmoid_mkldnn_fuse_pass. (#36869)

  • Add MKLDNN matmul_v2_transpose_reshape_fuse_pass. (#36481)

  • Add MKLDNN softplus_activation_mkldnn_fuse_pass. (#36657)

  • Add MKLDNN elt_act_mkldnn_fuse_pass. (#36541)

  • Add MKLDNN mish operator and conv_mish_mkldnn_fuse_pass. (#38623)

GPU performance optimization

  • Change the inference default video memory allocation policy from naive_best_fit to auto_growth , to solve the problem of some models filled up with the GPU video memory. (#41491)

  • Support gelu and FC+gelu ops using TensorRT inference. (#38399)

  • Support deformable_conv inference using TensorRT under static shape. (#36612 #36850 #37345)

  • Support nearest_interp_v2 op using TensorRT inference. (#34126)

  • Add yolo_box TensorRT plugin to support input parameters iou_aware and iou_aware_factor so that the IoU computed by inference is used as a factor for confidence. (#34128)

  • Support elementwise_sub and elementwise_div calling for TensorRT inference. (#40806 #41253)

  • Support multiclass_nms3 using TensorRT inference. (#41181 #41344)

  • Support flatten_contiguous_rang op using TensorRT inference. (#38922)

  • Support for pool2d attribute padding using TensorRT inference when dimension is 4, and global_pooling and ceil_mode are True. (#39545)

  • Support batch_norm and elementwise_add using TensorRT inference when dimension is 5. (#36446)

  • Add pool3d to use TensorRT inference. (#36545, #36783)

  • Add the reduce int32 and float types to use TensorRT inference. Add reduce_mean GPU operator int32 and int64 registration. (#39088)

  • Modify MatmulV2ToMul pass. Modify the qualifier (not support of broadcast) and op_teller mapping condition. (#36652)

  • Add the support for TenorRT plugin interface AddPluginV2IOExt. (#36493)

  • Add the aligned attribute in roi_align op and support for TensorRT inference. (#38905)

  • Add the support for TensorRT inference with concat attribute axis = -1 . (#39096)

  • Add TensorRT plugin: preln_emb_eltwise_layernorm, preln_skip_la, and rnorm ops, for ERNIE-like model performance optimization. (#39570)

  • Add TensorRT fuse pass: preln_embedding_eltwise_layernorm_fuse_pass, preln_skip_layernorm_fuse_pass, for ERNIE-like model performance optimization. (#39508)

  • Split matmul fusion-related passes based on different backends (GPU, CPU, TensorRT), to support transpose function for FC weights. (#39369)

  • Add the support to TensorRT by roll, strided_slice, and slice op in case of dynamic shapes. (#41913, #41573, #41467)

  • Add div op support for TensorRT. (#41243)

  • Quantization support

    • For the PostTrainingQuantization API, add the support for paddle.io.DataLoader object or Python Generator input. (#38686)

    • ERNIE full quantization model inference supports for interleaved data layout. (#39424)

    • Support for PaddleSlim new quantile model format inference. (#41049)

    • Add matmul int8 quantization inference op converter and plugin. (#37285)

    • Add pass to determine if all ops in the model can support int8 quantization. (#36042)

    • Support quantization inference for the FC part of the multihead attention of the non-variable-length branch. (#39660)

(3) Bug fixing

Framework and API fixing

  • Fix the bug of model clipping when saving static graphs. (#37579)

  • For the C API, add wrapper PD_Cstr for strings, and provide construction and destructing methods to avoid users to use C runtime library to destruct strings directly. (#38667)

  • Fix the logic bug with memory reuse at prediction time. (#37324)

  • Fix memory reuse error reporting in multi-threading. (#37894)

  • Allow passing empty strings for inference when no weight file is available. (#38579)

  • Fix an issue of clone not being supported when TensorRT dynamic shape is enabled. (#38520)

  • Fix multi-threaded clone error after TensorRT dynamic shape is enabled. (#40067)

  • Fix a TensorRT engine destructing issue. (#35842, #35938)

  • For the lite xpu interface, fix an issue where the xpu card cannot be selected. (#36610)

  • The TensorRT dynamic shape parameter automatically generate the interface, to add the file existence check. (#36628)

  • Fix the bug that the MKLDNN does not support conv3d. (#42055)

Backend Capability Fixing

  • Fix cuDNN default algorithm selection configuration for prediction, with using non-deterministic policies. (#41491)

  • Fix the bug with deformable_conv op in TensorRT plugin resource recovery handling error. (#38374)

  • Fix a serialization error in the TensorRT plugin for deformable_conv op. (#38057)

  • Adapt the new refactor engine and serialization API of TensorRT 8.0. (#36769)

  • Fix the bug that the Flatten2MatmulFusePass, Squeeze2MatmulFusePass, and Reshape2MatmulFusePass do not take effect. (#37644)

  • Fix the bug with TensorRT input data reporting errors. (#37427)

  • Add error message when input dimension is wrong. (#38962)

  • Fix the bug with EmbEltwiseLayernorm output type error. (#40015)

  • Remove conv_affine_channel_fuse_pass and the corresponding unit test. (#39817)

  • Fix an issue where the adaptive_pool2d pass incorrectly replaces the pool attribute. (#39600)

  • Fix the bug that shuffle_channel_detect_pass incorrectly generates shuffle_channel op. (#39242)

  • Fix transpose parameter error. (#39006)

  • Fix the crash bug when nearest_interp_v2 input scale dimension is less than 1. (#38725)

  • Fix the bug that the prelu does not support one-dimensional input in dynamic shape. (#39389)

  • Fix the bug in the kernel function of slice’s special_slice_plugin. (#39875)

  • Temporarily disable int8 branch under skip_layernorm variable length to prevent accuracy degradation. (#39991)

  • Fix some bugs regarding support for preln_ernie models. (#39733)

  • Fix the bug that slice may exceed threads limit in ERNIE. Fix the bug that the spacial_slice is incorrectly triggered. (#39096)

  • Fix the bug that the elementwise does not support broadcast when the dimension is the same. (#37908)

  • Fix the problem that the underlying implementation is different in the nearest_interp op when align_corners is True and TensorRT layer results and native op have diff. (#37525)

  • Fix qkv_plugin: Kernel function computation error. (#37096)

  • Fix the bug with inference pass for dynamic quantization. (#35879)

  • Reuse directly when Tensor requests less memory than the allocated size. (#37880)

  • Fix the hang bug when ERNIE fixed-length model is enabled with TensorRT. (#37839)

  • Fix the crash bug when TensorRT int8 lacks of dynamic range information. (#36900)

  • Fix the bug with slice deserialization code. (#36588)

  • Fix yolo box calculation formula error. (#36240)

  • Fix the crash bug when the earlier version model uses a later version of roi_align. (#38788) External Developers

  • Fix the bug of a large performance difference of softmax between python and C++. (#37130)

  • Fix matmul inference failure on static shape 2-dimensional input and dynamic shape 3-dimensional input. (#36849)

  • Fix reshape_transpose_matmul_mkldnn_fuse_pass mishandling of shapes. (#36731)

  • Fix an issue where TensorRT gets 4 dimensions when the input is 2 dimensions. (#36614)

  • Fix the bug report when the interpolate_v2 MKLDNN operator is null in the scale attribute. (#36623)

  • Fix poor performance of the recurrent operator in multi-threaded scenarios. (#36052)

  • Remove restrictions of relu, sigmoid, tanh, relu6, batch_norm, clip, concat, gelu, hard_sigmoid, prelu, softmax, split, and swish on TensorRT 2-dimensional inputs. (#37097)

  • Fix reshape op to use TensorRT inference. (#41090)

  • Fix matmul related pass, which is compatible with matmul_v2. (#36424)

  • Support VALID and SAME attributes in the padding method of the conv2d operator when TensorRT is enabled. (#38999)

  • Fix MKLDNN multi-input operator quantization problem. (#39593, #39346, #40717)

  • Fix scale error of conv+activation in MKLDNN quantization scenarios. (#38331)

  • Fix the bug in MKLDNN quantization without parameters where the quantization of subsequent operators is handled differently. (#39342)

  • Fix a data type related issue in MKLDNN cpu_bfloat16_placement_pass. (#38702)

  • Fix a split operator execution issue in MKLDNN bfloat16 inference. (#39548)

  • Fix the bug with MKLDNN matmul_v2 operator not supporting 6 dimensions. (#36342, #38665)

  • Fix MKLDNN DeviceContext error in MKLDNN matmul_v2_transpose_reshape. (#38554)

  • Fix incorrectly calculated results for segmentation models in MKLDNN inference scenarios. (#37310)

  • Fix MKLDNN bfloat16 placement operator list and add the missing operator. (#36291)

  • Fix the format bug of MKLDNN operators, including: FC, conv_transpose, 6-dimensional Tensor error reporting, and wrong output format of conv to NHWC input. (#38890, #37344, #37175, #38553, #40049, #39097)

  • Fix MKLDNN multi-threaded reasoning scenario error due to cache mechanism. (#36290, #35884)

  • Fix MKLDNN quantization model accuracy anomaly caused by matmul and FC. (#38023, #37618)

  • Fix the abnormal quantization model accuracy issue in MKLDNN quantization conversion scripts caused by missing passes. (#37619, #40542,#38912)

  • Fix the crash bug in MKLDNN enabling volume op due to data type mismatch. (#38133)

  • Fix an issue where some MKLDNN ops need to change back to the original layout after modifying the layout. (#39422)

  • Fix the bug of Python API error report due to conflict with Ascend software stack, because the GIL lock is not released in the Ascend 910 inference scenario. (#38605)

5. Environment Adaptation

Compile and Install


  • PIP source installation means downloading the installation package and dependency libraries from PIP official website with using pip install paddlepaddle or pip install paddlepaddle-gpu . This supports less architecture types, and lighter installation package,and only one CUDA version of the installation package is provided(compared with BOS source).

    • Prior to version 2.3, the PIP source installer (CUDA10.2) supports the following GPU architectures: 3.5, 5.0, 5.2, 6.0, 6.1, 7.0, and 7.5.

    • Later than version 2.3, the PIP source installer (CUDA11.0) supports the following GPU architectures: 6.0, 6.1, 7.0, 7.5, 8.0

  • The BOS source is a way to download the installation package and dependency libraries from the official website of PaddlePaddle, which supports more GPU architectures. The download source is from China and it is much faster.(compared with PIP source, it supports more kinds of architectures and provides multiple CUDA versions of installation packages).

    • Prior to version 2.3, the GPU architectures supported by the bos source installer on the PaddlePaddle website:

      • CUDA10 : 3.5, 5.0, 5.2, 6.0, 6.1, 7.0, 7.5;

      • CUDA11 : 5.2,6.0,6.1,7.0,7.5,8.0。

    • Later than version 2.3, the GPU architectures supported by the bos source installer on the PaddlePaddle website:

      • CUDA10 : 3.5, 5.0, 5.2, 6.0, 6.1, 7.0, 7.5;

      • CUDA11 : 3.5, 5.0, 6.0, 6.1, 7.0, 7.5, 8.0。

  • Support Python 3.10. Fix compilation bugs caused by some PythonC API changes on Windows. (#41180)

  • The Windows platform supports the compilation through Visual Studio 2019. (#38719)

  • Eliminate various warnings when compiling on the Windows platform. (#38034, #37890, #37442, #37439, #36857)

  • Fix jetson compilation issues introduced by the underlying data structure upgrade. (#39669, #39441)

New Hardware Backend Extention

  • Custom device support: provide a plug-in way to extend PaddlePaddle hardware backend. With this function, developers do not need to modify PaddlePaddle codes for specific hardware, but simply implement the standard interface and compile it into a dynamic link library that can be called by PaddlePaddle as a plug-in.This reduces the development effort of adding a new hardware backend to PaddlePaddle. Currently it supports custom Runtime and custom Kernel.

  • Support Huawei NPU chip (Ascend910) training/inference. Support ResNet50, YoloV3, BERT, Transformer and many other models. Support static + dynamic graph and auto-mixed precision training. Support single card, and distribute training across multiple cards, multiple machines.

  • Support Graphcore IPU chip (including IPU Mk2 GC200 and Bow IPU) training/inference. Support ResNet50, BERT and other models. Support static graph training. Support single card, and distribute training across multiple cards, multiple machines.

  • Support cambricon MLU chip (MLU370x4) training/inference. Support models such as ResNet50. Support static graph + dynamic graph training. Support auto-mixed precision training. Support single card, and distribute training across multiple cards, multiple machines.

  • Support KUNLUNXIN 2 chips (KUNLUNXIN AI acceleration cards R200, R300) training/inference. Support ResNet50, YoloV3, OCR-DB, SSD, MobilnetV3, UNet, BERT, Transformer, GPT-2, Wide&Deep, and DeepFM. Support static graph + dynamic graph training. Support auto-mixed precision training. Support single card, and distribute training across multiple cards, multiple machines.

Thanks to our Contributors

This release contains contributions from the project core team as well as :

Adam Osewski, Allen Guo, arlesniak, chenenquan, chenyanlann, fengkuangxiaxia, fuqianya, fwenguang, guguguzi, helen88, houj04, Jacek Czaja, jakpiase, jianghaicheng, joanna.wozna.intel, joeqiao12, Leo Chen, Leo Guo, Li-fAngyU, lidanqing, Liyulingyue, Matsumoto GAO, maxhuiy, Ming-Xu Huang, Nyakku Shigure, piotrekobi, piotrekobiIntel, QingshuChen, qipengh, Skr Bang, Sylwester Fraczek, Sławomir Siwek, taixiurong, tanzhipeng, Tomasz Socha, TTerror, Webbley, yaozhixin, ykkk2333, yujun, Zhangjingyu06, zhangxiaoci, zhangyikun02, zhangyk0314, zlsh80826, zn, Zuza