Tencent / Tencent/ncnn

Binaryop_x86_avx2文件pow函数bug报告

Open
#2,139 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
23.8k
Forks
4.5k
Avg merge
2d 20h
Merged PRs (30d)
37

Description

pow函数存在bug,具体:

struct binary_op_pow_pack8
{
    __m256 operator()(const __m256& x, const __m256& y) const
    {
        return exp256_ps(_mm256_mul_ps(y, log256_ps(x)));
    }
};

pow(x,y)的实现基于等价形式exp(y*ln(x)),此种情况仅对x>0成立;如果x<0则会出现Nan。
另外,arm实现也存在同样问题;vulkan不了解,暂时未发现。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the binary_op_pow_pack8 operator shown in the issue and trace the corresponding ARM implementation; compare how pow handles negative x across the SIMD backends. Determine the intended behavior for negative bases, then add coverage for the affected cases and verify that the implementations no longer produce NaN solely because they use exp(y*log(x)).

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.