Skip to content

Commit 230a3db

Browse files
fix: fill source memory with data
Signed-off-by: Szymon Morek <[email protected]>
1 parent a6729d0 commit 230a3db

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

source/benchmarks/memory_benchmark/implementations/ocl/write_buffer_ocl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -50,10 +50,11 @@ static TestResult run(const WriteBufferArguments &arguments, Statistics &statist
5050
// Create hostptr
5151
HostptrReuseHelper::Alloc hostptrAlloc{};
5252
ASSERT_CL_SUCCESS(HostptrReuseHelper::allocateBufferHostptr(opencl, arguments.reuse, arguments.size, hostptrAlloc));
53+
auto placement = arguments.reuse == HostptrReuseMode::Usm ? UsmMemoryPlacement::Host : UsmMemoryPlacement::NonUsm;
54+
ASSERT_CL_SUCCESS(BufferContentsHelperOcl::fillUsmBufferOrHostPtr(opencl.commandQueue, hostptrAlloc.ptr, arguments.size, placement, arguments.contents));
5355

5456
// Warmup
5557
ASSERT_CL_SUCCESS(clEnqueueWriteBuffer(opencl.commandQueue, buffer, CL_BLOCKING, 0, arguments.size, hostptrAlloc.ptr, 0, nullptr, nullptr));
56-
ASSERT_CL_SUCCESS(BufferContentsHelperOcl::fillBuffer(opencl.commandQueue, buffer, arguments.size, arguments.contents));
5758

5859
// Benchmark
5960
for (auto i = 0u; i < arguments.iterations; i++) {

source/benchmarks/memory_benchmark/implementations/ocl/write_image_ocl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Copyright (C) 2024 Intel Corporation
2+
* Copyright (C) 2024-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "framework/ocl/opencl.h"
9+
#include "framework/ocl/utility/buffer_contents_helper_ocl.h"
910
#include "framework/ocl/utility/hostptr_reuse_helper.h"
1011
#include "framework/ocl/utility/image_helper_ocl.h"
1112
#include "framework/ocl/utility/profiling_helper.h"
@@ -60,6 +61,8 @@ static TestResult run(const WriteImageArguments &arguments, Statistics &statisti
6061
// Create hostptr
6162
HostptrReuseHelper::Alloc hostptrAlloc{};
6263
ASSERT_CL_SUCCESS(HostptrReuseHelper::allocateBufferHostptr(opencl, arguments.hostPtrPlacement, imageSizeInBytes, hostptrAlloc));
64+
auto placement = arguments.hostPtrPlacement == HostptrReuseMode::Usm ? UsmMemoryPlacement::Host : UsmMemoryPlacement::NonUsm;
65+
ASSERT_CL_SUCCESS(BufferContentsHelperOcl::fillUsmBufferOrHostPtr(opencl.commandQueue, hostptrAlloc.ptr, imageSizeInBytes, placement, BufferContents::Random));
6366

6467
// Warmup
6568
const size_t origin[] = {0, 0, 0};

0 commit comments

Comments
 (0)