@@ -388,6 +388,62 @@ 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
+ // Check alloc information
419
+ cl_uint read_mem_id = 4 ;
420
+ size_t ret_size = 9 ;
421
+ status = clGetMemAllocInfoINTEL (m_context, test_ptr,
422
+ CL_MEM_ALLOC_BUFFER_LOCATION_INTEL,
423
+ sizeof (cl_uint), &read_mem_id, &ret_size);
424
+
425
+ CHECK_EQUAL (CL_SUCCESS, status);
426
+ CHECK_EQUAL (0 , read_mem_id);
427
+ CHECK_EQUAL (sizeof (cl_uint), ret_size);
428
+
429
+ status = clMemFreeINTEL (m_context, test_ptr);
430
+ ACL_LOCKED (CHECK_EQUAL (acl_usm_ptr_belongs_to_context (m_context, test_ptr),
431
+ CL_FALSE));
432
+ CHECK (m_context->usm_allocation .empty ());
433
+
434
+ // Check when given pointer is already freed
435
+ status = clGetMemAllocInfoINTEL (m_context, test_ptr,
436
+ CL_MEM_ALLOC_BUFFER_LOCATION_INTEL,
437
+ sizeof (cl_uint), &read_mem_id, &ret_size);
438
+
439
+ CHECK_EQUAL (CL_SUCCESS, status);
440
+ CHECK_EQUAL (0 , read_mem_id);
441
+ CHECK_EQUAL (sizeof (cl_uint), ret_size);
442
+ CHECK_EQUAL (status, CL_SUCCESS);
443
+
444
+ ACL_LOCKED (acl_print_debug_msg (" end buffer_location_usm\n " ));
445
+ }
446
+
391
447
MT_TEST (acl_usm, alloc_and_free_shared_usm) {
392
448
ACL_LOCKED (acl_print_debug_msg (" begin alloc_and_free_shared_usm\n " ));
393
449
const int alignment = 16 ;
0 commit comments