小编Des*_*o17的帖子

ARM 霓虹灯优化 - 摆脱多余的负载

我正在尝试使用 arm neon 构建优化的右手矩阵乘法。这个

void transform ( glm::mat4 const & matrix, glm::vec4 const & input, glm::vec4 & output )
{
   float32x4_t &       result_local = reinterpret_cast < float32x4_t & > (*(&output[0]));
   float32x4_t const & input_local  = reinterpret_cast < float32x4_t const & > (*(&input[0] ));

   result_local = vmulq_f32 (               reinterpret_cast < float32x4_t const & > ( matrix[ 0 ] ), input_local );
   result_local = vmlaq_f32 ( result_local, reinterpret_cast < float32x4_t const & > ( matrix[ 1 ] ), input_local );
   result_local = …
Run Code Online (Sandbox Code Playgroud)

c++ gcc neon arm64

4
推荐指数
1
解决办法
390
查看次数

检查浮点除法是否以 +-inf 结尾的可移植方法

我有一个形式1.0f / x 为xa的浮点除法float。我如何事先检查是否x非常接近0.0f结果将是 +-inf / undefined?我不确定标准限制中的 epsilon 是否足够。

问候。

c++ floating-point c++11

3
推荐指数
2
解决办法
374
查看次数

用于调用图生成和分析的最小 callgrind 命令

我想使用 callgrind 来分析我的程序,但它的速度太慢了。我想要做的是使用 kcachegrind 生成一个调用图,其中每个节点显示程序在哪个函数中花费的百分比。你能告诉我我可以安全地禁用哪些功能以获得更好的性能以便仍然生成这些信息吗?

非常感谢!

valgrind callgrind

2
推荐指数
1
解决办法
761
查看次数

是否可以将 AddressSanitizer 和 ThreadSanitizer 合并到一个版本中?

或者我必须使用单独的版本吗?-fsanitize 标志仅允许地址或线程,但是否允许多个?

问候

c++ gcc

2
推荐指数
1
解决办法
1538
查看次数

线程安全的复制构造函数

我试图使类的复制构造函数线程安全,如下所示:

class Base
{
   public:
      Base ( Base const & other )
      {
         std::lock_guard<std::mutex> lock ( other.m_Mutex );
         ...
      }
   protected:
      
      std::mutex m_Mutex;
}

class Derived : public Base
{
   public:
      Derived ( Derived const & other ) : Base ( other )
      {
         std::lock_guard<std::mutex> lock ( other.m_Mutex );
         ...
      }

}
Run Code Online (Sandbox Code Playgroud)

我的问题是,在派生类中,我需要在初始化列表中的基类构造函数调用之前锁定互斥体,以保证一致性。知道我如何才能实现这一目标吗?

问候。

c++

1
推荐指数
1
解决办法
130
查看次数

强制gcc不要内联函数

我尝试通过以下方式阻止gcc内联函数:

template <typename T, precision P> __attribute__ ((noinline))
void func () {}
Run Code Online (Sandbox Code Playgroud)

但它仍然强调功能.

有没有办法强迫它?

问候

c++ gcc

0
推荐指数
1
解决办法
114
查看次数

标签 统计

c++ ×5

gcc ×3

arm64 ×1

c++11 ×1

callgrind ×1

floating-point ×1

neon ×1

valgrind ×1