File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 2424
2525#include < cstdint>
2626#include < vector>
27+ #include < CL/cl_ext.h>
2728
2829using 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 ()));
You can’t perform that action at this time.
0 commit comments