Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Issue 2611683002: Set ecx to 0 when calling cpuid. (Closed)

Created:
3 years, 11 months ago by mtklein_C
Modified:
3 years, 11 months ago
CC:
chromium-reviews, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -12 lines) Patch
M base/cpu.cc View 1 chunk +11 lines, -12 lines 0 comments Download

Messages

Total messages: 16 (8 generated)
mtklein_C
3 years, 11 months ago (2017-01-03 15:05:07 UTC) #2
mtklein_C
Here's the UMA chart that made me suspicious: https://uma.googleplex.com/p/chrome/histograms?endDate=20170101&dayCount=1&histograms=Platform.IntelMaxMicroArchitecture&fixupData=true&showMax=true&filters=channel%2Ceq%2C4%2Cplatform%2Cone_of%2CL%7CM%2Cisofficial%2Ceq%2CTrue&implicitFilters=isofficial
3 years, 11 months ago (2017-01-03 15:08:02 UTC) #3
Mark Mentovai
LGTM. The cpuidex approach discussed on bug 630077 would also be appropriate.
3 years, 11 months ago (2017-01-03 17:29:49 UTC) #6
mtklein_C
On 2017/01/03 at 17:29:49, mark wrote: > LGTM. The cpuidex approach discussed on bug 630077 ...
3 years, 11 months ago (2017-01-03 17:32:51 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2611683002/1
3 years, 11 months ago (2017-01-03 17:33:15 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:1)
3 years, 11 months ago (2017-01-03 18:34:34 UTC) #12
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/c0fe8911a5076819ae903e184078245355d0f1b8 Cr-Commit-Position: refs/heads/master@{#441167}
3 years, 11 months ago (2017-01-03 18:37:35 UTC) #14
fbarchard1
3 years, 11 months ago (2017-01-12 22:22:10 UTC) #16
Message was sent while issue was closed.
lgtm

FYI I'm using __cpuidex in libyuv, but always with 0.

Powered by Google App Engine
This is Rietveld 408576698