@@ -685,6 +685,72 @@ TEST_F(
685
685
lzt::free_memory (buff_out);
686
686
}
687
687
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
+
688
754
void RunGivenDeviceImageWhenAppendingImageCopyTest (
689
755
zeCommandListAppendImageCopyTests &test, bool is_immediate) {
690
756
auto cmd_bundle = lzt::create_command_bundle (is_immediate);
@@ -1138,18 +1204,19 @@ class zeCommandListAppendImageCopyToMemoryTests
1138
1204
: public zeCommandListAppendImageCopyFromMemoryTests {};
1139
1205
1140
1206
void RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (
1141
- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1207
+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1208
+ bool is_shared_system) {
1142
1209
auto cmd_bundle = lzt::create_command_bundle (is_immediate);
1143
1210
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 );
1146
1213
1147
1214
lzt::append_image_copy_to_mem (cmd_bundle.list , device_memory,
1148
1215
test.img_ptr ->dflt_device_image_ , nullptr );
1149
1216
if (is_immediate) {
1150
1217
lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
1151
1218
}
1152
- free_memory (device_memory);
1219
+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
1153
1220
delete test.img_ptr ;
1154
1221
lzt::destroy_command_bundle (cmd_bundle);
1155
1222
}
@@ -1159,7 +1226,7 @@ TEST_F(zeCommandListAppendImageCopyToMemoryTests,
1159
1226
if (!(lzt::image_support ())) {
1160
1227
GTEST_SKIP ();
1161
1228
}
1162
- RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , false );
1229
+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryTest (*this , false , false );
1163
1230
}
1164
1231
1165
1232
TEST_F (
@@ -1168,15 +1235,36 @@ TEST_F(
1168
1235
if (!(lzt::image_support ())) {
1169
1236
GTEST_SKIP ();
1170
1237
}
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 );
1172
1259
}
1173
1260
1174
1261
void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (
1175
- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1262
+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1263
+ bool is_shared_system) {
1176
1264
auto cmd_bundle = lzt::create_command_bundle (is_immediate);
1177
1265
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 );
1180
1268
ze_event_handle_t hEvent = nullptr ;
1181
1269
1182
1270
test.ep .create_event (hEvent);
@@ -1186,7 +1274,7 @@ void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest(
1186
1274
lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
1187
1275
}
1188
1276
test.ep .destroy_event (hEvent);
1189
- free_memory (device_memory);
1277
+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
1190
1278
delete test.img_ptr ;
1191
1279
lzt::destroy_command_bundle (cmd_bundle);
1192
1280
}
@@ -1197,7 +1285,8 @@ TEST_F(
1197
1285
if (!(lzt::image_support ())) {
1198
1286
GTEST_SKIP ();
1199
1287
}
1200
- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , false );
1288
+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithHEventTest (*this , false ,
1289
+ false );
1201
1290
}
1202
1291
1203
1292
TEST_F (
@@ -1206,15 +1295,39 @@ TEST_F(
1206
1295
if (!(lzt::image_support ())) {
1207
1296
GTEST_SKIP ();
1208
1297
}
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 );
1210
1322
}
1211
1323
1212
1324
void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1213
- zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate) {
1325
+ zeCommandListAppendImageCopyToMemoryTests &test, bool is_immediate,
1326
+ bool is_shared_system) {
1214
1327
auto cmd_bundle = lzt::create_command_bundle (is_immediate);
1215
1328
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 );
1218
1331
ze_event_handle_t hEvent = nullptr ;
1219
1332
1220
1333
test.ep .create_event (hEvent);
@@ -1228,7 +1341,7 @@ void RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest(
1228
1341
lzt::synchronize_command_list_host (cmd_bundle.list , UINT64_MAX);
1229
1342
}
1230
1343
test.ep .destroy_event (hEvent);
1231
- free_memory (device_memory);
1344
+ lzt::free_memory_with_allocator_selector (device_memory, is_shared_system );
1232
1345
delete test.img_ptr ;
1233
1346
lzt::destroy_command_bundle (cmd_bundle);
1234
1347
}
@@ -1239,8 +1352,8 @@ TEST_F(
1239
1352
if (!(lzt::image_support ())) {
1240
1353
GTEST_SKIP ();
1241
1354
}
1242
- RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (* this ,
1243
- false );
1355
+ RunGivenDeviceImageWhenAppendingImageCopyToMemoryWithWaitEventTest (
1356
+ * this , false , false );
1244
1357
}
1245
1358
1246
1359
TEST_F (
@@ -1249,8 +1362,30 @@ TEST_F(
1249
1362
if (!(lzt::image_support ())) {
1250
1363
GTEST_SKIP ();
1251
1364
}
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 );
1254
1389
}
1255
1390
1256
1391
} // namespace
0 commit comments