|
|
Chromium Code Reviews
DescriptionSet ecx to 0 when calling cpuid.
This should fix AVX2 detection on Linux and Mac.
In order to read the extended feature flags that we want in cpu_info7, we must
set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx
unspecified. This means we only detect AVX2 support if we get very lucky!
I noticed this when looking at UMA: Window shows a reasonable rate of AVX2,
Linux a miniscule one, and Mac zero. That made no sense to me, typing this
CL on a Mac that supports AVX2. :)
This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for
a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...),
which boils down to the same thing: eax=7, ecx=0.
And... clang format at the presubmit's insistence.
BUG=630077
Committed: https://crrev.com/c0fe8911a5076819ae903e184078245355d0f1b8
Cr-Commit-Position: refs/heads/master@{#441167}
Patch Set 1 #
Messages
Total messages: 16 (8 generated)
mtklein@chromium.org changed reviewers: + fbarchard@chromium.org, mark@chromium.org
Here's the UMA chart that made me suspicious: https://uma.googleplex.com/p/chrome/histograms?endDate=20170101&dayCount=1&hi...
Description was changed from ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. ========== to ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=667457,630077 ==========
Description was changed from ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=667457,630077 ========== to ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=630077 ==========
LGTM. The cpuidex approach discussed on bug 630077 would also be appropriate.
On 2017/01/03 at 17:29:49, mark wrote: > LGTM. The cpuidex approach discussed on bug 630077 would also be appropriate. Yeah, as written this basically is MSVC's __cpuid(), which is documented to clear ecx before the cpuid instruction. I don't see any need yet for other values of ecx than 0, but if we did we'd be calling __cpuidex() on Windows.
The CQ bit was checked by mtklein@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 1, "attempt_start_ts": 1483464785757540, "parent_rev":
"0ca2cac0c886112079dc019f444b197dbb985cb1", "commit_rev":
"f8588e00f08a152adaa0335281b9aac6bb039a82"}
Message was sent while issue was closed.
Description was changed from ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=630077 ========== to ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=630077 Review-Url: https://codereview.chromium.org/2611683002 ==========
Message was sent while issue was closed.
Committed patchset #1 (id:1)
Message was sent while issue was closed.
Description was changed from ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=630077 Review-Url: https://codereview.chromium.org/2611683002 ========== to ========== Set ecx to 0 when calling cpuid. This should fix AVX2 detection on Linux and Mac. In order to read the extended feature flags that we want in cpu_info7, we must set eax to 7 and ecx to 0. At head we're setting eax to 7 but leaving ecx unspecified. This means we only detect AVX2 support if we get very lucky! I noticed this when looking at UMA: Window shows a reasonable rate of AVX2, Linux a miniscule one, and Mac zero. That made no sense to me, typing this CL on a Mac that supports AVX2. :) This makes base/cpu agree with SkCpu, which we've been using to detect AVX2 for a good while now, in Chromium and elsewhere. We use __cpuid_count(7,0,...), which boils down to the same thing: eax=7, ecx=0. And... clang format at the presubmit's insistence. BUG=630077 Committed: https://crrev.com/c0fe8911a5076819ae903e184078245355d0f1b8 Cr-Commit-Position: refs/heads/master@{#441167} ==========
Message was sent while issue was closed.
Patchset 1 (id:??) landed as https://crrev.com/c0fe8911a5076819ae903e184078245355d0f1b8 Cr-Commit-Position: refs/heads/master@{#441167}
Message was sent while issue was closed.
fbarchard@google.com changed reviewers: + fbarchard@google.com
Message was sent while issue was closed.
lgtm FYI I'm using __cpuidex in libyuv, but always with 0. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
