[PATCH] D47474: Implement cpu_dispatch/cpu_specific Multiversioning

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 29 06:29:49 PDT 2018


erichkeane created this revision.
erichkeane added reviewers: mikerice, echristo, aaron.ballman, gbiv.
Herald added a reviewer: george.burgess.iv.
Herald added a subscriber: mgrang.

As documented here: https://software.intel.com/en-us/node/682969 and
https://software.intel.com/en-us/node/523346.  cpu_dispatch multiversioning
is an ICC feature that provides for function multiversioning.

This feature is implemented with two attributes: First, cpu_specific,
which specifies the individual function versions.  Second, cpu_dispatch,
which specifies the location of the resolver function and the list of
resolvable functions.

This is valuable since it provides a mechanism where the resolver's TU
can be specified in one location, and the individual implementions
each in their own translation units.

The goal of this patch is to be source-compatible with ICC, so this 
implementation diverges from the ICC implementation in a few ways:
1- Linux x86/64 only: This implementation uses ifuncs in order to 
properly dispatch functions.  This is is a valuable performance benefit
over the ICC implementation.  A future patch will be provided to enable
this feature on Windows, but it will obviously more closely fit ICC's
implementation.
2- CPU Identification functions: ICC uses a set of custom functions to identify
the feature list of the host processor.  This patch uses the cpu_supports 
functionality in order to better align with 'target' multiversioning.
1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function
marked cpu_dispatch be an empty definition.  This patch supports that as well,
however declarations are also permitted, since the linker will solve the
issue of multiple emissions.


Repository:
  rC Clang

https://reviews.llvm.org/D47474

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TargetInfo.h
  include/clang/Basic/X86Target.def
  lib/AST/Decl.cpp
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Parse/ParseDecl.cpp
  lib/Sema/AnalysisBasedWarnings.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGen/attr-cpuspecific.c
  test/Misc/pragma-attribute-supported-attributes-list.test
  test/Sema/attr-cpuspecific.c
  test/SemaCXX/attr-cpuspecific.cpp
  utils/TableGen/ClangAttrEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47474.148894.patch
Type: text/x-patch
Size: 103040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180529/7867f424/attachment-0001.bin>


More information about the cfe-commits mailing list