Skip to content

Commit

Permalink
Merge pull request #28 from NVIDIA/issue_27
Browse files Browse the repository at this point in the history
fixes #27
  • Loading branch information
drossetti authored Feb 21, 2018
2 parents 0ce51fc + 94a149e commit 158ae88
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gdrapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,17 @@ extern int memcpy_cached_store_avx(void *dest, const void *src, size_t n_bytes);
extern int memcpy_uncached_store_sse(void *dest, const void *src, size_t n_bytes);
extern int memcpy_cached_store_sse(void *dest, const void *src, size_t n_bytes);
extern int memcpy_uncached_load_sse41(void *dest, const void *src, size_t n_bytes);
#else // GDRAPI_X86
static inline void wc_store_fence(void) { _mm_sfence(); }
#endif // GDRAPI_X86

#if defined(GDRAPI_POWER)
static int memcpy_uncached_store_avx(void *dest, const void *src, size_t n_bytes) { return 1; }
static int memcpy_cached_store_avx(void *dest, const void *src, size_t n_bytes) { return 1; }
static int memcpy_uncached_store_sse(void *dest, const void *src, size_t n_bytes) { return 1; }
static int memcpy_cached_store_sse(void *dest, const void *src, size_t n_bytes) { return 1; }
static int memcpy_uncached_load_sse41(void *dest, const void *src, size_t n_bytes) { return 1; }
#endif // GDRAPI_X86
static inline void wc_store_fence(void) { asm volatile("sync") ; }
#endif // GDRAPI_POWER

static int first_time = 1;
static int has_sse = 0;
Expand Down Expand Up @@ -357,7 +361,7 @@ int gdr_copy_to_bar(void *bar_ptr, const void *h_ptr, size_t size)

// fencing is needed even for plain memcpy(), due to performance
// being hit by delayed flushing of WC buffers
_mm_sfence();
wc_store_fence();

} while (0);

Expand Down Expand Up @@ -393,7 +397,7 @@ int gdr_copy_from_bar(void *h_ptr, const void *bar_ptr, size_t size)
memcpy(h_ptr, bar_ptr, size);

// note: fencing is not needed because plain stores are used
//_mm_sfence();
//wc_store_fence();

} while (0);

Expand Down

0 comments on commit 158ae88

Please sign in to comment.