Skip to content

Commit 969f39f

Browse files
committed
Fix MSVC compilation in SysMemBandwidthBench.cpp by conditionally compiling AVX2 functions
1 parent ee6e299 commit 969f39f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cpp_src/benchmarks/SysMemBandwidthBench.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void SysMemBandwidthBench::Setup(IComputeContext &context,
7373
std::memset(destBuffer, 0, bufferSize); // Touch pages
7474
}
7575

76+
#ifndef _MSC_VER
7677
// AVX2 kernels
7778
__attribute__((target("avx2"))) void run_read_avx2(const void *src,
7879
size_t size) {
@@ -134,6 +135,7 @@ __attribute__((target("avx2"))) void run_copy_avx2(const void *src, void *dst,
134135
}
135136
_mm_sfence();
136137
}
138+
#endif
137139

138140
// Fallbacks
139141
void run_read_fallback(const void *src, size_t size) {
@@ -192,6 +194,7 @@ void SysMemBandwidthBench::Run(uint32_t config_idx) {
192194
std::this_thread::yield();
193195
}
194196

197+
#ifndef _MSC_VER
195198
if (useAVX2) {
196199
if (config.mode == SysMemTestMode::Read) {
197200
run_read_avx2(tSrc, chunkSize);
@@ -200,7 +203,9 @@ void SysMemBandwidthBench::Run(uint32_t config_idx) {
200203
} else {
201204
run_copy_avx2(tSrc, tDst, chunkSize);
202205
}
203-
} else {
206+
} else
207+
#endif
208+
{
204209
if (config.mode == SysMemTestMode::Read) {
205210
run_read_fallback(tSrc, chunkSize);
206211
} else if (config.mode == SysMemTestMode::Write) {

0 commit comments

Comments
 (0)