[#absl-PrefetchToLocalCacheForWrite]
= xref:absl.adoc[absl]::PrefetchToLocalCacheForWrite
:relfileprefix: ../
:mrdocs:

Moves data into the L1 cache with the intent to modify it&period;

== Synopsis

Declared in `&lt;absl&sol;base&sol;prefetch&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
PrefetchToLocalCacheForWrite(void const* addr);
----

== Description

This function is similar to `PrefetchToLocalCache()` except that it prefetches cachelines with an &apos;intent to modify&apos; This typically includes invalidating cache entries for this address in all other cache tiers, and an exclusive access intent&period;

Incorrect or gratuitous use of this function can degrade performance&period; As this function can invalidate cached cachelines on other caches and computer cores, incorrect usage of this function can have an even greater negative impact than incorrect regular prefetches&period; Use this function only when representative benchmarks show an improvement&period;

Example&colon;

void&ast; Arena&colon;&colon;Allocate(size&lowbar;t size) &lcub; void&ast; ptr &equals; AllocateBlock(size)&semi; absl&colon;&colon;PrefetchToLocalCacheForWrite(ptr)&semi; return ptr&semi; &rcub;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *addr*
| The address of the memory to prefetch&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
