Intel® C++ Compiler 16.0 User and Reference Guide

avoid_false_share

Provides the ability to pad and/or align the defined variable such that it will not be subject to false cache line sharing with any other variable.

Syntax

Windows* OS:

__declspec(avoid_false_share(identifier))variable definition

Linux* OS:

__attribute__((avoid_false_share(identifier)))variable definition

Arguments

identifier

Specifies the string that will be used to identify one or more variables. Variables with the same identifier do not need protection from false sharing.

variable definition

Specifies the variable to be padded or aligned.

Description

This keyword indicates to the compiler that it should allocate the variable through padding and/or alignment such that it will not share the cache line with other variables unless they share the same identifier. This keyword must occur on a variable definition in function, global, or namespace scope. It is not permitted on a non-static class member or on a function argument.

If you specify an identifier, the variable definition does not need to be protected from false sharing with other variables that are similarly declared with the same identifier. If the variable definition is in function scope, the scope of the identifier is the current function. If the variable definition is in namespace or global scope, the scope of the identifier is the current compilation unit.

This keyword is supported for scalar and arrays and is not supported for structure fields, function arguments, functions, and references.