Hongqing-work

Results comments of Hongqing-work

> It might be that we need to define our own `dataclass` decorator to store the init-args. So what kind of new features we want to have in our `dataclass`...

I've add some examples and guide in `/examples`.

You can refer to cudnnFindConvolutionForwardAlgorithm() in cuDNN-API document. cuDNN implement different algorithm for convolution. Different algorithms require different need for memory and have different performance. This function attempts all algorithms...

In backward propagation, cudnnConvolutionBackwardFilter is used to get the differential of filter, and cudnnConvolutionBackwardData is used to get the differential of input. These two operation is different, so they need...

The total number of resulting algorithms can be queried through the API cudnnGetConvolutionForwardAlgorithmMaxCount(). Also, you can find it in cudnn.h

cuDNN doesn’t provide api for getting differential from loss, so you should write your own code. After that, you can refer to backpropagation algorithm and use cuDNN api to compute...

> What does this ”cudnnConvolutionBackwardData is used to get the differential of input“ mean? like Is the derivative of p in y(p(x))? Yes. After that, you can use the derivative...

> [paddle/cinn/optim/pass.h](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/cinn/optim/pass.h) 没有 Expr 这个 level 的 Pass 对应的基类,是需要自己添加吗? 目前开放的这批改造不需要到这个level,这部分改动需求较小,且基本是接口替换就能适配;我们近期也会提出新的Pass Manager来进行管理。

> 请问改完的 pass 如何跑 unit test? 本任务不要求自己构造单测,本地验证需要多跑几个Paddle/test/ir/pir/cinn/sub_graphs中的测试,然后提交跑ci的监控(可以直接在编译后进入./build/test文件夹下运行ctest) 比如: ```bash ctest -R test_sub_graph_5 -VV ``` 请确保自己的pass在合适位置进行了调用,我们review代码也会严格检查。

如果之前本身就是用排序算法实现这里就不需要再乱序了,可以注意一下后续新硬件的文档描述,这里设置sorted参数是在做加强保证,相当于一种"make sure"。 这里存在差别的核心原因就是不同硬件对topk的实现方式不同。cpu上是调用的`std::nth_element`,该算法不保证排序,加上sorted参数能在该算法之后再进行一个保证;而gpu上是调用的`phi::funcs::SortTopk`,底层直接使用了`cub::DeviceSegmentedRadixSort`,所以不管有没有sorted参数,结果都是一定保证排序的。这里贴的代码段是对大规模情况下的优化,实验后其实大规模下GPU也不保证排序,后续文档需要修正。你面对的背景和未优化过的GPU场景类似,不需要考虑false的场景了,可以加以注释说明。