Tegra 4 Surface 2 上的 C++ amp

标签 c++ windows-runtime tablet c++-amp

这本身不是一个编程问题,而是与我在其他地方找不到的信息相关的问题。希望能被采纳。

我正在尝试移植 C++ AMP 应用程序以在 Surface 2 平板电脑上运行。由于 C++ AMP 可在平板电脑上的 WinRT 上运行,并且它使用 DirectX 进行 GPU 加速,而且 Tegra 处理器也可与 DirectX 配合使用,因此我预计在平板电脑上使用 C++ AMP 与使用“cpu”相比会带来性能提升。我发现与使用单个 CPU 核心相比,在 GPU 上使用相同的代码在桌面上的加速大约是 80 倍,而且它是高度并行的。

事实证明,平板电脑上的 AMP 解决方案仅给我带来了 Tegras 四核的优势,仅此而已。

我有三个 C++ AMP 设备,它们是:WARP、ref、CPU

默认值是 WARP。Ref 速度慢得多,CPU 现在似乎崩溃了。

SIMD 内核是否不适用于 Tegra4 上的 C++ AMP,还是我必须做一些特殊的事情?

最佳答案

除了任何 GPU 加速器之外,如果您使用以下方式枚举可用加速器,您还将看到以下加速器:

std::vector<accelerator> accls = accelerator::get_all()

取自 C++ AMP Book :

- accelerator::direct3d_ref The REF accelerator, also called the Reference Rasterizer or “Software Adapter” accelerator. It emulates a generic graphics card in software on the CPU to provide Direct3D functionality. It is used for debugging and will also be the default accelerator if no other accelerators are available. As the name suggests, the REF accelerator should be considered the de facto standard if you suspect a bug with your hardware vendor’s driver. Typically, your application will not want to use the REF accelerator because it is much slower than hardware-based accelerators and will be slower than just running a C++ implementation of your algorithm on the CPU.

- accelerator::cpu_accelerator The CPU accelerator can be used only for creating arrays that are accessible to the CPU and used for data staging. Your application can’t use this for executing C++ AMP code in the first release of C++ AMP. Further details on using the CPU accelerator to create staging arrays and host arrays are covered in Chapter 7, “Optimization.”

- accelerator::direct3d_warp The WARP accelerator, or Microsoft Basic Render Driver, allows the C++ AMP run time to run on the CPU. The WARP accelerator uses the WARP software rasterizer, which is part of the Direct3D 11 run time. The WARP accelerator uses multicore and data-parallel Single Instruction Multiple Data (SIMD) instructions to execute data-parallel code very efficiently on the CPU. Your application can use WARP as a fallback when no physical GPU is present. The WARP accelerator supports only single-precision math, so it can’t be used for fallback for kernels that require double precision or limited double-precision kernels. An overview of WARP can be found in “Windows Advanced Rasterization Platform (WARP) Guide” on MSDN: http://msdn.microsoft.com/en-us/library/gg615082.aspx.

所以您看到的行为几乎符合预期。

但是,我想您真正想知道的是 Tegra 4 GPU 在哪里?如果 Surface 2 有 DirectX 11 驱动程序,您会期望将其视为加速器选项。 C++ AMP 需要 DX11。

Surface 2 基于 Tegra 4 (T40a2) SOC,似乎仅支持 DX9.1。

On the DirectX side, Tegra 4’s GPU supports the Direct3D 9_1 feature level.

取自 Nvidia's Tegra 4 GPU: Doubling Down On Efficiency 。我无法在 NVidia 网站上找到对此的任何确认。看来您需要 Tegra K1 才能获得 DX11 支持。很抱歉带来坏消息。

从好的方面来说,如果您将代码定位在默认加速器上,那么其他具有 DX11 功能的 GPU 的硬件将自动利用它。

关于Tegra 4 Surface 2 上的 C++ amp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22129248/

相关文章:

清除二叉搜索树时的 C++ 段错误

c# - XAML 分组 ListView : Changing a row background color

windows - Winsxs文件夹(Windows运行时程序集目录)中的文件夹名称的含义是什么

touchscreen - 与表达失语症患者进行交流的技术?

css - 在平板电脑上显示时,页眉和页脚不是整个页面宽度

c# - 将 float* 编码到 C#

c++ - 从 C++ 中的整数数组中获取最大数

c++ - 包含 .h 文件和 c/cpp 文件有什么区别?

gridview - 如何按字母顺序对 GridView 项目进行分组 : Windows Store App

.net - 运行 Windows 的平板电脑上的振动是否可以在 .net 上实现?