This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data Cache Zero by Virtual Address (DC ZVA) instruction

HI Everyone,

i have been trying to test whether or not DC ZVA instruction causes an L1 or L2 cache allocation on Cortex-A73.

The ARMv8-A architecture reference manual makes no statements about whether or not the DC ZVA instruction causes allocation to any particular level of the cache and the Cortex-A73 architecture reference manual too.

So i meaaured the latency of cache access and memory access first, then i measured the latency using the DC ZVA instruction. Here my code and the result:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define ROUND 5000
const size_t chunk_size = 1<<30;
struct timespec timer_start(){
struct timespec start_time;
clock_gettime(CLOCK_MONOTONIC, &start_time);
return start_time;
}
// call this function to end a timer, returning nanoseconds elapsed as a long
long timer_end(struct timespec start_time){
struct timespec end_time;
clock_gettime(CLOCK_MONOTONIC, &end_time);
long diffInNanos = (end_time.tv_sec - start_time.tv_sec) * (long)1e9 + (end_time.tv_nsec - start_time.tv_nsec);
return diffInNanos;
}
void print_affinity() {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I got the following output:

Fullscreen
1
2
3
cache access time: 4 ns
memory access time: 210 ns
DC ZVA: 21 ns
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

So, what do you think about it?

I am not sure if the the latency of the DC ZVA instruction is greater than cache access because the DC ZVA instruction takes more time than LDR instruction or it is performing memory access.

Thank you.

0