Skip to content

Commit b048ba2

Browse files
narenbagriaspalicki
authored andcommitted
test: update system memory test(s)
Signed-off-by: Narendra Bagria <[email protected]>
1 parent 7d62f50 commit b048ba2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/gtests/ocl/api/test_memory_usm.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <cstdint>
2626
#include <vector>
27+
#include <CL/cl_ext.h>
2728

2829
using namespace dnnl::impl::xpu::ocl;
2930

@@ -204,8 +205,26 @@ TEST(ocl_memory_usm_test, ErrorMakeMemoryUsingSystemMemory) {
204205
memory::desc mem_d({n}, memory::data_type::f32, memory::format_tag::x);
205206

206207
std::vector<float> system_buf(n);
207-
208-
if (eng.get()->mayiuse_system_memory_allocators()) {
208+
bool system_memory_supported = false;
209+
210+
#ifdef cl_intel_unified_shared_memory
211+
cl_device_id device = ocl_interop::get_device(eng);
212+
cl_device_unified_shared_memory_capabilities_intel
213+
system_memory_capabilities_intel
214+
= 0;
215+
216+
ASSERT_EQ(
217+
clGetDeviceInfo(device,
218+
CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL,
219+
sizeof(cl_device_unified_shared_memory_capabilities_intel),
220+
&system_memory_capabilities_intel, nullptr),
221+
CL_SUCCESS);
222+
223+
system_memory_supported = system_memory_capabilities_intel
224+
& CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL;
225+
#endif
226+
227+
if (system_memory_supported) {
209228
EXPECT_NO_THROW(
210229
memory mem = ocl_interop::make_memory(mem_d, eng,
211230
ocl_interop::memory_kind::usm, system_buf.data()));

0 commit comments

Comments
 (0)