mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
[v1.01] Run multiple independent instructions in the pipeline for AVX freq too. Fixes incorrect frequency measures under certain CPUs
This commit is contained in:
@@ -15,13 +15,25 @@ void* compute_avx() {
|
||||
|
||||
struct timeval begin, now;
|
||||
|
||||
__m256 a = _mm256_set1_ps(1.5);
|
||||
__m256 b = _mm256_set1_ps(1.2);
|
||||
__m256 a[8];
|
||||
__m256 b[8];
|
||||
|
||||
for(int i=0; i < 8; i++) {
|
||||
a[i] = _mm256_set1_ps(1.5);
|
||||
b[i] = _mm256_set1_ps(1.2);
|
||||
}
|
||||
|
||||
gettimeofday(&begin, NULL);
|
||||
while(!end) {
|
||||
for(uint64_t i=0; i < LOOP_ITERS; i++) {
|
||||
a = _mm256_add_ps(a, b);
|
||||
a[0] = _mm256_add_ps(a[0], b[0]);
|
||||
a[1] = _mm256_add_ps(a[1], b[1]);
|
||||
a[2] = _mm256_add_ps(a[2], b[2]);
|
||||
a[3] = _mm256_add_ps(a[3], b[3]);
|
||||
a[4] = _mm256_add_ps(a[4], b[4]);
|
||||
a[5] = _mm256_add_ps(a[5], b[5]);
|
||||
a[6] = _mm256_add_ps(a[6], b[6]);
|
||||
a[7] = _mm256_add_ps(a[7], b[7]);
|
||||
}
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
@@ -34,7 +46,8 @@ void* compute_avx() {
|
||||
printf("fopen: %s", strerror(errno));
|
||||
}
|
||||
else {
|
||||
fprintf(fp, "%f", a[0]);
|
||||
for(int i=0; i < 8; i++)
|
||||
fprintf(fp, "%f", a[i][0]);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user