Skip to content

Commit

Permalink
Update src/shim/bo.h
Browse files Browse the repository at this point in the history
Co-authored-by: Min Ma <[email protected]>
  • Loading branch information
hlaccabu and mamin506 committed Feb 4, 2025
1 parent 22c5b4d commit f500476
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/shim/bo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
#endif

namespace shim_xdna {

const int LINESIZE = 64;

inline void flush_cache_line(const char *cur) {
inline void flush_cache_line(const char *cur)
{
#if defined(__x86_64__) || defined(_M_X64)
_mm_clflush(cur);
#elif defined(__aarch64__)
Expand All @@ -37,7 +36,7 @@ namespace shim_xdna {
: "memory"
);
#endif
}
}

class bo : public xrt_core::buffer_handle
{
Expand Down
8 changes: 5 additions & 3 deletions src/shim/umq/hwq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

namespace {

void clflush_data(const void *data, size_t len) {
void clflush_data(const void *data, size_t len)
{
const int LINESIZE = 64;
const char *cur = (const char *)data;
uintptr_t lastline = (uintptr_t)(cur + len - 1) | (shim_xdna::LINESIZE - 1);
uintptr_t lastline = (uintptr_t)(cur + len - 1) | (LINESIZE - 1);
do {
shim_xdna::flush_cache_line(cur);
cur += shim_xdna::LINESIZE;
cur += LINESIZE;
} while (cur <= (const char *)lastline);
}

Expand Down

0 comments on commit f500476

Please sign in to comment.