@@ -388,6 +388,42 @@ MT_TEST(acl_usm, alloc_and_free_device_usm) {
388
388
ACL_LOCKED (acl_print_debug_msg (" end alloc_and_free_device_usm\n " ));
389
389
}
390
390
391
+ MT_TEST (acl_usm, buffer_location_usm) {
392
+ ACL_LOCKED (acl_print_debug_msg (" begin buffer_location_usm\n " ));
393
+ const int alignment = ACL_MEM_ALIGN;
394
+ cl_int status;
395
+ this ->yeah = true ;
396
+
397
+ acl_usm_allocation_t *test_device_alloc;
398
+
399
+ cl_mem_properties_intel good_property[3 ] = {
400
+ CL_MEM_ALLOC_BUFFER_LOCATION_INTEL, 0 , 0 };
401
+
402
+ ACL_LOCKED (CHECK (acl_context_is_valid (m_context)));
403
+
404
+ // Correct USM buffer allocation
405
+ void *test_ptr = clDeviceMemAllocINTEL (
406
+ m_context, m_device[0 ], &(good_property[0 ]), 8 , alignment, &status);
407
+ CHECK_EQUAL (status, CL_SUCCESS);
408
+ CHECK (ACL_DEVICE_ALLOCATION (test_ptr));
409
+ CHECK (test_ptr != NULL );
410
+ CHECK (!m_context->usm_allocation .empty ());
411
+ ACL_LOCKED (CHECK_EQUAL (acl_usm_ptr_belongs_to_context (m_context, test_ptr),
412
+ CL_TRUE));
413
+ ACL_LOCKED (test_device_alloc =
414
+ acl_get_usm_alloc_from_ptr (m_context, test_ptr));
415
+ assert (test_device_alloc);
416
+ CHECK_EQUAL (test_device_alloc->range .begin , test_ptr);
417
+
418
+ status = clMemFreeINTEL (m_context, test_ptr);
419
+ CHECK_EQUAL (status, CL_SUCCESS);
420
+ ACL_LOCKED (CHECK_EQUAL (acl_usm_ptr_belongs_to_context (m_context, test_ptr),
421
+ CL_FALSE));
422
+ CHECK (m_context->usm_allocation .empty ());
423
+
424
+ ACL_LOCKED (acl_print_debug_msg (" end buffer_location_usm\n " ));
425
+ }
426
+
391
427
MT_TEST (acl_usm, alloc_and_free_shared_usm) {
392
428
ACL_LOCKED (acl_print_debug_msg (" begin alloc_and_free_shared_usm\n " ));
393
429
const int alignment = 16 ;
0 commit comments