TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What is the future of vector instructions?

2 点作者 yomritoyj大约 8 年前
Writing performant numerical code for CPUs requires using vector instruction sets like AVX. With these instruction it is up to the compiler&#x2F;programmer to vectorize the sequential program and deal with things like scatter&#x2F;gather memory access or masks to deal with control divergence. On the other hand GPU&#x27;s offer a cleaner multithreaded programming model with the mapping to vectorized form being done at runtime in hardware. And as the GPU&#x27;s get more sophisticated controls, this mapping will become even more transparent performance-wise. Yet GPUs remain competitive with CPUs in terms of price and energy consumption.<p>Given this, can we expect CPU instruction sets to move away from explicit vectors and expose a GPU-like interface for parallel numerical work with the advantage that this GPU-like would be on the same chip and share the same cache with the more serial-oriented parts of the CPU?

1 comment

db48x大约 8 年前
There&#x27;s nothing special about GPU hardware that magically handles vectorization for you. A fragment shader, for instance, is a small program that runs in parallel across all the pixels in a fragment. That turns out to be a great interface for doing graphics, but the hardware doesn&#x27;t really care about it. It&#x27;s simply up to the driver to compute where the fragment boundaries are and to program set up the corresponding inputs to the shader cores.<p>This actually gives you less control over the hardware, in exchange for an easier programming model. The problem is that it&#x27;s a domain-specific solution; if you&#x27;re not rasterizing polygons then it doesn&#x27;t do you much good; you&#x27;ll have to break the problem up into parallelizable domains yourself, or find a library that does it for you. (That&#x27;s all a graphics driver is, in the end. It&#x27;s just a library that helps you access a complicated piece of hardware without having to know too many details about it.