問題タブ [sse]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
5 に答える
2832 参照

c++ - SSE2:倍精度ログ機能

ログ機能のオープンソース(ライセンスの制限なし)の実装が必要です。

Intel Short Vector Math Library(ICCの一部)で利用できますが、ICCは無料でもオープンソースでもありません。組み込み関数のみを使用した実装を探しています。

特別な有理関数近似を使用する必要があります。cmathログとほぼ同じくらい正確なもの、たとえば10進数の9〜10桁が必要ですが、より高速です。

0 投票する
4 に答える
770 参照

c - 次のコードを高速化する方法

上記のコードは私のプログラムで何度も呼び出されます (プロファイラーは 98% を示します)。

編集: 内側のループでは、同じ (i + k) 値に対して res1[i + k] 値が何度も読み込まれます。while ループ内でこれを試してみました。すべての res1 値を simd レジスタ (配列) にロードし、最も内側の for ループ内で配列要素を使用して配列要素を更新しました。両方の for ループが完了したら、配列の値を res1、re2 に保存しました。しかし、これにより計算時間が増加します。私がどこで間違ったのか分かりますか?その考えは正しかったようです

より速くするための提案は大歓迎です。

0 投票する
4 に答える
3855 参照

c++ - SSE でのメモリ アラインメントによるセグメンテーション エラー

私は顔検出に取り組んでおり、入力を .bmp ファイルとして受け取り、顔を検出し、顔に長方形を描画しています。

しかし、「cvDetect」という関数を追加して顔を検出すると、次のコード行でセグメンテーション違反が発生します-

デバッグ中に、これらの関数が原因でメモリ アラインメントの問題があることがわかりました。誰でもこの問題の解決を手伝ってもらえますか? コードは C++ で書かれており、私は Linux を使用しています。

0 投票する
1 に答える
2590 参照

c - SSE を使用した配列へのインデックス付け

配列があるとします:

そして要素

16 バイトを含む、

__m128i新しい要素を効率よく埋めたい

の値にarr応じて の値を使用しますx。次のようになります。

これを達成するためのコマンドは、基本的に、連続していないメモリ位置のセットからレジスタをロードすることです。そのようなコマンドのドキュメントを見たという痛ましいほど漠然とした記憶がありますが、今は見つかりません。それは存在しますか?よろしくお願いします。

0 投票する
2 に答える
386 参照

c++ - mm1レジスタパーツへのアクセス

配列のように、mmxレジスタの1バイトにアクセスすることは可能ですか?私はこのコードを持っています:

mm1 [1]、mm1 [2]、mm1 [3]....をc++変数に入れたいのですが、次のようになります。

ありがとう。

0 投票する
3 に答える
3832 参照

c - SSEとの128ビットハッシュ比較


現在のプロジェクトでは、128ビット値(実際にはmd5ハッシュ)を比較する必要があり、SSE命令を使用して比較を高速化できると思いました。私の問題は、SSE命令に関する適切なドキュメントを見つけることができないことです。あるハッシュが別のハッシュよりも大きいか、小さいか、等しいかを知らせる128ビット整数比較命令を探しています。そのような命令は存在しますか?

PS:対象となるマシンはSSE2命令を備えたx86_64サーバーです。同じ仕事のNEON指導にも興味があります。

0 投票する
2 に答える
1200 参照

c - _mm_ 型関数の同等の C コード

_mm_store_ps、 などの__ 関数を克服するための単純な同等の C コードは何ですか_mm_add_ps。同等の C コードを使用して、例を使用して関数を指定してください。

なぜこれらの関数が使用されるのですか?

0 投票する
3 に答える
3959 参照

optimization - SSE (SSSE3) YUV から RGB コードへの改善

YUV を RGB に変換するために書いた SSE コードを最適化しようとしています (平面とパックされた YUV 関数の両方)。

今はSSSE3を使っていますが、SSEの後のバージョンで便利な機能があればOKです。

私は主に、プロセッサのストールなどをどのように解決するかに興味があります。

SSE コードの静的解析を行うツールを知っている人はいますか?

0 投票する
1 に答える
4200 参照

gcc - gcc での SSE (SIMD 拡張) のサポート

次のようなコードが表示されます。

このコードは正常にビルドされ、gcc を使用して期待どおりに動作します (これは組み込みの SSE / MMX 拡張機能とベクトル データ型です。このコードは、4 つの単一浮動小数点数を使用して SIMD ベクトル加算を行っています。

このtypedef行の各キーワード/関数呼び出しが何を意味し、何をするのかを詳細に理解したい:

vector_size() 関数の戻り値は何ですか。

何の__attribute__ためのキーワードか

vfsf 型に型定義されている float データ型は次のとおりです。

残りの部分は理解しています。

ありがとう、

-広告

0 投票する
3 に答える
1167 参照

optimization - approximating log10[x^k0 + k1]

Greetings. I'm trying to approximate the function

Log10[x^k0 + k1], where .21 < k0 < 21, 0 < k1 < ~2000, and x is integer < 2^14.

k0 & k1 are constant. For practical purposes, you can assume k0 = 2.12, k1 = 2660. The desired accuracy is 5*10^-4 relative error.

This function is virtually identical to Log[x], except near 0, where it differs a lot.

I already have came up with a SIMD implementation that is ~1.15x faster than a simple lookup table, but would like to improve it if possible, which I think is very hard due to lack of efficient instructions.

My SIMD implementation uses 16bit fixed point arithmetic to evaluate a 3rd degree polynomial (I use least squares fit). The polynomial uses different coefficients for different input ranges. There are 8 ranges, and range i spans (64)2^i to (64)2^(i + 1). The rational behind this is the derivatives of Log[x] drop rapidly with x, meaning a polynomial will fit it more accurately since polynomials are an exact fit for functions that have a derivative of 0 beyond a certain order.

SIMD table lookups are done very efficiently with a single _mm_shuffle_epi8(). I use SSE's float to int conversion to get the exponent and significand used for the fixed point approximation. I also software pipelined the loop to get ~1.25x speedup, so further code optimizations are probably unlikely.

What I'm asking is if there's a more efficient approximation at a higher level? For example:

  1. Can this function be decomposed into functions with a limited domain like log2((2^x) * significand) = x + log2(significand)

hence eliminating the need to deal with different ranges (table lookups). The main problem I think is adding the k1 term kills all those nice log properties that we know and love, making it not possible. Or is it?

  1. Iterative method? don't think so because the Newton method for log[x] is already a complicated expression

  2. Exploiting locality of neighboring pixels? - if the range of the 8 inputs fall in the same approximation range, then I can look up a single coefficient, instead of looking up separate coefficients for each element. Thus, I can use this as a fast common case, and use a slower, general code path when it isn't. But for my data, the range needs to be ~2000 before this property hold 70% of the time, which doesn't seem to make this method competitive.

Please, give me some opinion, especially if you're an applied mathematician, even if you say it can't be done. Thanks.