@@ -685,6 +685,72 @@ TEST_F(
685685 lzt::free_memory (buff_out);
686686}
687687
688+ TEST_F (
689+ zeCommandListAppendImageCopyTests,
690+ GivenDeviceImageAndHostImageWhenAppendingImageCopyFromMemoryUsingSharedSystemMemoryWithNonNullRegionsThenImageIsCorrectAndSuccessIsReturnedWithSharedSystemAllocator) {
691+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
692+ if (!(lzt::image_support ())) {
693+ GTEST_SKIP ();
694+ }
695+ void *buff_in_top = lzt::aligned_malloc (image_size, 1 );
696+ void *buff_out_bot = lzt::aligned_malloc (image_size, 1 );
697+ void *buff_in_bot = lzt::aligned_malloc (image_size, 1 );
698+ void *buff_out_top = lzt::aligned_malloc (image_size, 1 );
699+ test_image_mem_copy_use_regions (buff_in_bot, buff_in_top, buff_out_bot,
700+ buff_out_top, false );
701+ lzt::aligned_free (buff_in_bot);
702+ lzt::aligned_free (buff_in_top);
703+ lzt::aligned_free (buff_out_bot);
704+ lzt::aligned_free (buff_out_top);
705+ }
706+
707+ TEST_F (
708+ zeCommandListAppendImageCopyTests,
709+ GivenDeviceImageAndHostImageWhenAppendingImageCopyFromMemoryToImmediateCmdListUsingSharedSystemMemoryWithNonNullRegionsThenImageIsCorrectAndSuccessIsReturnedWithSharedSystemAllocator) {
710+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
711+ if (!(lzt::image_support ())) {
712+ GTEST_SKIP ();
713+ }
714+ void *buff_in_top = lzt::aligned_malloc (image_size, 1 );
715+ void *buff_out_bot = lzt::aligned_malloc (image_size, 1 );
716+ void *buff_in_bot = lzt::aligned_malloc (image_size, 1 );
717+ void *buff_out_top = lzt::aligned_malloc (image_size, 1 );
718+ test_image_mem_copy_use_regions (buff_in_bot, buff_in_top, buff_out_bot,
719+ buff_out_top, true );
720+ lzt::aligned_free (buff_in_bot);
721+ lzt::aligned_free (buff_in_top);
722+ lzt::aligned_free (buff_out_bot);
723+ lzt::aligned_free (buff_out_top);
724+ }
725+
726+ TEST_F (
727+ zeCommandListAppendImageCopyTests,
728+ GivenDeviceImageAndHostImageWhenAppendingImageCopyFromMemoryUsingSharedSystemMemoryWithNullRegionsThenImageIsCorrectAndSuccessIsReturnedWithSharedSystemAllocator) {
729+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
730+ if (!(lzt::image_support ())) {
731+ GTEST_SKIP ();
732+ }
733+ void *buff_in = lzt::aligned_malloc (image_size, 1 );
734+ void *buff_out = lzt::aligned_malloc (image_size, 1 );
735+ test_image_mem_copy_no_regions (buff_in, buff_out, false );
736+ lzt::aligned_free (buff_in);
737+ lzt::aligned_free (buff_out);
738+ }
739+
740+ TEST_F (
741+ zeCommandListAppendImageCopyTests,
742+ GivenDeviceImageAndHostImageWhenAppendingImageCopyToImmediateCmdListFromMemoryUsingSharedSystemMemoryWithNullRegionsThenImageIsCorrectAndSuccessIsReturnedWithSharedSystemAllocator) {
743+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
744+ if (!(lzt::image_support ())) {
745+ GTEST_SKIP ();
746+ }
747+ void *buff_in = lzt::aligned_malloc (image_size, 1 );
748+ void *buff_out = lzt::aligned_malloc (image_size, 1 );
749+ test_image_mem_copy_no_regions (buff_in, buff_out, true );
750+ lzt::aligned_free (buff_in);
751+ lzt::aligned_free (buff_out);
752+ }
753+
688754void RunGivenDeviceImageWhenAppendingImageCopyTest (
689755 zeCommandListAppendImageCopyTests &test, bool is_immediate) {
690756 auto cmd_bundle = lzt::create_command_bundle (is_immediate);
@@ -1138,18 +1204,19 @@ class zeCommandListAppendImageCopyToMemoryTests
11381204 : public zeCommandListAppendImageCopyFromMemoryTests {};
11391205
11401206void RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (
1141- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1207+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1208+ bool is_shared_system) {
11421209 auto cmd_bundle = lzt::create_command_bundle (is_immediate);
11431210 test.img_ptr = new zeImageCreateCommon;
1144- void *device_memory =
1145- allocate_device_memory ( size_in_bytes (test.img_ptr ->dflt_host_image_ ));
1211+ void *device_memory = lzt::allocate_device_memory_with_allocator_selector (
1212+ size_in_bytes (test.img_ptr ->dflt_host_image_ ), is_shared_system );
11461213
11471214 lzt::append_image_copy_to_mem (cmd_bundle.list , device_memory,
11481215 test.img_ptr ->dflt_device_image_ , nullptr );
11491216 if (is_immediate) {
11501217 lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
11511218 }
1152- free_memory (device_memory);
1219+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
11531220 delete test.img_ptr ;
11541221 lzt::destroy_command_bundle (cmd_bundle);
11551222}
@@ -1159,7 +1226,7 @@ TEST_F(zeCommandListAppendImageCopyToMemoryTests,
11591226 if (!(lzt::image_support ())) {
11601227 GTEST_SKIP ();
11611228 }
1162- RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , false );
1229+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , false , false );
11631230}
11641231
11651232TEST_F (
@@ -1168,15 +1235,36 @@ TEST_F(
11681235 if (!(lzt::image_support ())) {
11691236 GTEST_SKIP ();
11701237 }
1171- RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , true );
1238+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , true , false );
1239+ }
1240+
1241+ TEST_F (
1242+ zeCommandListAppendImageCopyToMemoryTests,
1243+ GivenDeviceImageWhenAppendingImageCopyToMemoryThenSuccessIsReturnedWithSharedSystemAllocator) {
1244+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1245+ if (!(lzt::image_support ())) {
1246+ GTEST_SKIP ();
1247+ }
1248+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , false , true );
1249+ }
1250+
1251+ TEST_F (
1252+ zeCommandListAppendImageCopyToMemoryTests,
1253+ GivenDeviceImageWhenAppendingImageCopyToMemoryOnImmediateCmdListThenSuccessIsReturnedWithAllocatorWithSharedSystemAllocator) {
1254+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1255+ if (!(lzt::image_support ())) {
1256+ GTEST_SKIP ();
1257+ }
1258+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , true , true );
11721259}
11731260
11741261void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (
1175- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1262+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1263+ bool is_shared_system) {
11761264 auto cmd_bundle = lzt::create_command_bundle (is_immediate);
11771265 test.img_ptr = new zeImageCreateCommon;
1178- void *device_memory =
1179- allocate_device_memory ( size_in_bytes (test.img_ptr ->dflt_host_image_ ));
1266+ void *device_memory = lzt::allocate_device_memory_with_allocator_selector (
1267+ size_in_bytes (test.img_ptr ->dflt_host_image_ ), is_shared_system );
11801268 ze_event_handle_t hEvent = nullptr ;
11811269
11821270 test.ep .create_event (hEvent);
@@ -1186,7 +1274,7 @@ void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest(
11861274 lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
11871275 }
11881276 test.ep .destroy_event (hEvent);
1189- free_memory (device_memory);
1277+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
11901278 delete test.img_ptr ;
11911279 lzt::destroy_command_bundle (cmd_bundle);
11921280}
@@ -1197,7 +1285,8 @@ TEST_F(
11971285 if (!(lzt::image_support ())) {
11981286 GTEST_SKIP ();
11991287 }
1200- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , false );
1288+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , false ,
1289+ false );
12011290}
12021291
12031292TEST_F (
@@ -1206,15 +1295,39 @@ TEST_F(
12061295 if (!(lzt::image_support ())) {
12071296 GTEST_SKIP ();
12081297 }
1209- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , true );
1298+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , true ,
1299+ false );
1300+ }
1301+
1302+ TEST_F (
1303+ zeCommandListAppendImageCopyToMemoryTests,
1304+ GivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventThenSuccessIsReturnedWithSharedSystemAllocator) {
1305+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1306+ if (!(lzt::image_support ())) {
1307+ GTEST_SKIP ();
1308+ }
1309+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , false ,
1310+ true );
1311+ }
1312+
1313+ TEST_F (
1314+ zeCommandListAppendImageCopyToMemoryTests,
1315+ GivenDeviceImageWhenAppendingImageCopyToMemoryOnImmediateCmdListWithHEventThenSuccessIsReturnedWithSharedSystemAllocator) {
1316+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1317+ if (!(lzt::image_support ())) {
1318+ GTEST_SKIP ();
1319+ }
1320+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , true ,
1321+ true );
12101322}
12111323
12121324void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1213- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1325+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1326+ bool is_shared_system) {
12141327 auto cmd_bundle = lzt::create_command_bundle (is_immediate);
12151328 test.img_ptr = new zeImageCreateCommon;
1216- void *device_memory =
1217- allocate_device_memory ( size_in_bytes (test.img_ptr ->dflt_host_image_ ));
1329+ void *device_memory = lzt::allocate_device_memory_with_allocator_selector (
1330+ size_in_bytes (test.img_ptr ->dflt_host_image_ ), is_shared_system );
12181331 ze_event_handle_t hEvent = nullptr ;
12191332
12201333 test.ep .create_event (hEvent);
@@ -1228,7 +1341,7 @@ void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest(
12281341 lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
12291342 }
12301343 test.ep .destroy_event (hEvent);
1231- free_memory (device_memory);
1344+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
12321345 delete test.img_ptr ;
12331346 lzt::destroy_command_bundle (cmd_bundle);
12341347}
@@ -1239,8 +1352,8 @@ TEST_F(
12391352 if (!(lzt::image_support ())) {
12401353 GTEST_SKIP ();
12411354 }
1242- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (* this ,
1243- false );
1355+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1356+ * this , false , false );
12441357}
12451358
12461359TEST_F (
@@ -1249,8 +1362,30 @@ TEST_F(
12491362 if (!(lzt::image_support ())) {
12501363 GTEST_SKIP ();
12511364 }
1252- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (*this ,
1253- true );
1365+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1366+ *this , true , false );
1367+ }
1368+
1369+ TEST_F (
1370+ zeCommandListAppendImageCopyToMemoryTests,
1371+ GivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventThenSuccessIsReturnedWithSharedSystemAllocator) {
1372+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1373+ if (!(lzt::image_support ())) {
1374+ GTEST_SKIP ();
1375+ }
1376+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1377+ *this , false , true );
1378+ }
1379+
1380+ TEST_F (
1381+ zeCommandListAppendImageCopyToMemoryTests,
1382+ GivenDeviceImageWhenAppendingImageCopyToMemoryOnImmediateCmdListWithWaitEventThenSuccessIsReturnedWithSharedSystemAllocator) {
1383+ SKIP_IF_SHARED_SYSTEM_ALLOC_UNSUPPORTED ();
1384+ if (!(lzt::image_support ())) {
1385+ GTEST_SKIP ();
1386+ }
1387+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1388+ *this , true , true );
12541389}
12551390
12561391} // namespace
0 commit comments