Bug 408009 - Expose rdrand and f16c even on avx if host cpu supports them
Summary: Expose rdrand and f16c even on avx if host cpu supports them
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-27 23:04 UTC by Mark Wielaard
Modified: 2019-05-28 20:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Expose rdrand and f16c through cpuid also if the host only has avx. (4.13 KB, text/plain)
2019-05-27 23:06 UTC, Mark Wielaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2019-05-27 23:04:28 UTC
Currently the following code in coregrind/m_machine.c (machine_get_hwcaps) prevents using rdrand and f16c on avx only (none-avx2) machines:

     /* Sanity check for RDRAND and F16C.  These don't actually *need* AVX2, bu
        it's convenient to restrict them to the AVX2 case since the simulated
        CPUID we'll offer them on has AVX2 as a base. */
     if (!have_avx2) {
         have_f16c   = False;
         have_rdrand = False;
      }

So even if the host CPU supports it, valgrind disables it.

Both can be supported on avx machines too.
Comment 1 Mark Wielaard 2019-05-27 23:06:36 UTC
Created attachment 120350 [details]
Expose rdrand and f16c through cpuid also if the host only has avx.

Proposed fix.
Comment 2 Mark Wielaard 2019-05-28 20:11:17 UTC
commit 791fe5ecf909d573bcbf353b677b9404f9da0ed4
Author: Mark Wielaard <mark@klomp.org>
Date:   Mon May 27 22:19:27 2019 +0200

    Expose rdrand and f16c through cpuid also if the host only has avx.
    
    The amd64 CPUID dirtyhelpers are mostly static since they emulate some
    existing CPU "family". The avx2 ("i7-4910MQ") CPUID variant however
    can "dynamicly" enable rdrand and/or f16c if the host supports them.
    Do the same for the avx_and_cx16 ("i5-2300") CPUID variant.
    
    https://bugs.kde.org/show_bug.cgi?id=408009