Add support for multiple microarchitectures in single binary 75/1075/6
authorDamjan Marion <damarion@cisco.com>
Wed, 11 May 2016 21:07:18 +0000 (23:07 +0200)
committerDamjan Marion <damarion@cisco.com>
Thu, 19 May 2016 16:14:38 +0000 (18:14 +0200)
commit1c80e831b728ab378949714d5059a0b5b1822a0a
treee4f3ecfee143f7dee0e9905570d41ca3ee345c83
parent82e29c455833b5b12e04c89d2dec1106b499e6b0
Add support for multiple microarchitectures in single binary

 * compiler -march= parameter is changed from native to corei7
   so code is always genereted with instructions which are available
   on the Nehalem microarchitecture (up to SSE4.2)

 * compiler -mtune= parameter is added so code is optimized for
   corei7-avx which equals to Sandy Bridge microarchitecture

 * set of macros is added which allows run-time detection of available
   cpu instructions (e.g. clib_cpu_supports_avx())

 * set of macros is added which allows us to clone graph node funcitons
   where cloned function is optmized for different microarchitecture
   Those macros are using following attributes:
     __attribute__((flatten))
     __attribute__((target("arch=core-avx2)))

   I.e. If applied to foo_node_fn() macro will generate cloned
   functions foo_node_fn_avx2() and foo_node_fn_avx512() (future)
   It will also generate function void * foo_node_fn_multiarch_select()
   which detects available instruction set and returns pointer to the
   best matching function clone.

Change-Id: I2dce0ac92a5ede95fcb56f47f3d1f3c4c040bac0
Signed-off-by: Damjan Marion <damarion@cisco.com>
72 files changed:
build-data/packages/dpdk.mk
build-data/platforms/vpp.mk
build-data/platforms/vpp_lite.mk
build-root/Makefile
dpdk/Makefile
vlib/vlib/node.h
vnet/vnet/classify/ip_classify.c
vnet/vnet/cop/ip4_whitelist.c
vnet/vnet/cop/ip6_whitelist.c
vnet/vnet/cop/node1.c
vnet/vnet/devices/af_packet/device.c
vnet/vnet/devices/af_packet/node.c
vnet/vnet/devices/dpdk/cli.c
vnet/vnet/devices/dpdk/device.c
vnet/vnet/devices/dpdk/dpdk.h
vnet/vnet/devices/dpdk/init.c
vnet/vnet/devices/dpdk/node.c
vnet/vnet/devices/netmap/device.c
vnet/vnet/devices/netmap/node.c
vnet/vnet/devices/ssvm/node.c
vnet/vnet/devices/ssvm/ssvm_eth.c
vnet/vnet/devices/virtio/vhost-user.c
vnet/vnet/ethernet/node.c
vnet/vnet/gre/gre.c
vnet/vnet/gre/node.c
vnet/vnet/interface.h
vnet/vnet/interface_output.c
vnet/vnet/ip/ip4_forward.c
vnet/vnet/ip/ip4_hop_by_hop.c
vnet/vnet/ip/ip4_input.c
vnet/vnet/ip/ip4_source_check.c
vnet/vnet/ip/ip6_forward.c
vnet/vnet/ip/ip6_hop_by_hop.c
vnet/vnet/ip/ip6_input.c
vnet/vnet/ip/ip_input_acl.c
vnet/vnet/ip/udp_local.c
vnet/vnet/ipsec/esp_decrypt.c
vnet/vnet/ipsec/esp_encrypt.c
vnet/vnet/ipsec/ipsec_if_in.c
vnet/vnet/ipsec/ipsec_if_out.c
vnet/vnet/ipsec/ipsec_input.c
vnet/vnet/ipsec/ipsec_output.c
vnet/vnet/l2/l2_classify.c
vnet/vnet/l2/l2_efp_filter.c
vnet/vnet/l2/l2_flood.c
vnet/vnet/l2/l2_fwd.c
vnet/vnet/l2/l2_input.c
vnet/vnet/l2/l2_input_acl.c
vnet/vnet/l2/l2_input_vtr.c
vnet/vnet/l2/l2_learn.c
vnet/vnet/l2/l2_output.c
vnet/vnet/l2/l2_output_acl.c
vnet/vnet/l2/l2_patch.c
vnet/vnet/l2/l2_rw.c
vnet/vnet/l2/l2_xcrw.c
vnet/vnet/l2tp/decap.c
vnet/vnet/l2tp/encap.c
vnet/vnet/lawful-intercept/node.c
vnet/vnet/mpls-gre/interface.c
vnet/vnet/mpls-gre/node.c
vnet/vnet/mpls-gre/policy_encap.c
vnet/vnet/policer/node_funcs.c
vnet/vnet/sr/sr.c
vnet/vnet/sr/sr_replicate.c
vnet/vnet/vxlan/decap.c
vnet/vnet/vxlan/encap.c
vpp/app/l2t_ip6.c
vpp/app/l2t_l2.c
vpp/app/version.c
vpp/vnet/main.c
vppinfra/vppinfra/cpu.c
vppinfra/vppinfra/cpu.h