New runtime API is introduced in CUDA 11 to fine-tune L2 access policy.
But I do not fully understand the meaning of policy like hitRatio and how they can be used in practice.
In particular, I saw in CUDA API Documentation that cudaAccessPolicyWindow:
Specifies an access policy for a window, a contiguous extent of memory beginning at base_ptr and ending at base_ptr + num_bytes. Partition into many segments and assign segments such that. sum of "hit segments" / window == approx. ratio. sum of "miss segments" / window == approx 1-ratio. Segments and ratio specifications are fitted to the capabilities of the architecture. Accesses in a hit segment apply the hitProp access policy. Accesses in a miss segment apply the missProp access policy.
My question:
How is the contiguous extent of memory "partitioned" into segments? Are these partitions decided statically based on the hit prop such that the hit or miss attribute of segments will remain unchanged once they are assigned or there are some running counters which dynamically adjust the assignment e.g. on each access basis?
How should these attributes be applied to optimize performance in practice? E.g. to put it in a over-simplified & naive way, suppose I have 1 MB L2 cache set aside, should I create a window of 1 MB for my most frequently used data and set hitRatio as 1 or should I create a window of 2 MB and set hitRatio as 0.5? Why?