在c++ AMP限制(direct3d)代码中使用int索引,其中double是预期的

Using int index where double is expected in C++ AMP retrict(direct3d) code

本文关键字:其中 索引 int double 限制 AMP c++ direct3d 代码      更新时间:2023-10-16

谷歌没有帮助,有人使用AMP吗?

在下面的代码片段中,从整型转换为双型(双型v = idx.x)会导致" Failed to create shader "运行时错误。我认为限制(direct3d)会提醒我GPU在编译期间无法处理的事情。是否有pow()的替代方法-或者我必须编写一个循环来完成它?

concurrency::array_view<double,1> prices = …
concurrency::parallel_for_each(
   prices.grid, [=](index<1> idx) mutable restrict(direct3d) {
      double v = idx.x;
      prices[idx] =  concurrency::pow(u, v);
…

请参阅我们对Windows上gpu双支持的解释,以及c++ AMP数学库http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/08/math-library-for-c-amp.aspxhttp://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/07/double-precision-support-in-c-amp.aspx

如果你还有问题,请随时回复。此外,请用c++amp标记您的问题,以便我们有更好的机会找到它们。