Skip to content

Commit 74bf4bf

Browse files
test: extend zello_bindless_kernel with bindless+bindful image tests
Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent ac8dcdb commit 74bf4bf

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

level_zero/core/test/black_box_tests/zello_bindless_kernel.cpp

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ bool testBindlessBindfulKernel(ze_context_handle_t context, ze_device_handle_t d
513513
}
514514

515515
bool testBindlessImages(ze_context_handle_t context, ze_device_handle_t device, const std::string &deviceId, const std::string &revisionId,
516-
int imageCount, AddressingMode mode) {
516+
int imageCount, AddressingMode mode, ExecutionMode execMode) {
517517
bool outputValidated = false;
518518

519519
ze_module_handle_t module = nullptr;
@@ -523,7 +523,7 @@ bool testBindlessImages(ze_context_handle_t context, ze_device_handle_t device,
523523
createKernel(module, copyKernel, kernelName3.c_str());
524524

525525
LevelZeroBlackBoxTests::CommandHandler commandHandler;
526-
bool isImmediateCmdList = false;
526+
bool isImmediateCmdList = execMode == ExecutionMode::immSyncCmdList ? true : false;
527527

528528
SUCCESS_OR_TERMINATE(commandHandler.create(context, device, isImmediateCmdList));
529529

@@ -631,6 +631,33 @@ bool testBindlessImages(ze_context_handle_t context, ze_device_handle_t device,
631631
return outputValidated;
632632
}
633633

634+
bool testBindlessBindfulImageKernel(ze_context_handle_t context, ze_device_handle_t device, const std::string &deviceId, const std::string &revisionId) {
635+
636+
ExecutionMode executionModes[] = {ExecutionMode::commandQueue, ExecutionMode::immSyncCmdList};
637+
638+
std::tuple<AddressingMode, AddressingMode, std::string> kernelOrder[2] = {{AddressingMode::bindless, AddressingMode::bindful, "First Bindless Then Bindful"},
639+
{AddressingMode::bindful, AddressingMode::bindless, "First Bindful Then Bindless"}};
640+
641+
for (auto kernelMode : kernelOrder) {
642+
643+
for (auto mode : executionModes) {
644+
645+
bool result1 = testBindlessImages(context, device, deviceId, revisionId, 0, std::get<0>(kernelMode), mode);
646+
bool result2 = testBindlessImages(context, device, deviceId, revisionId, 0, std::get<1>(kernelMode), mode);
647+
648+
if (!result1 || !result2) {
649+
std::cout << "testBindlessBindfulImageKernel with mode " << static_cast<uint32_t>(mode) << " " << std::get<2>(kernelMode) << " FAILED.\n"
650+
<< std::endl;
651+
return false;
652+
} else {
653+
std::cout << "testBindlessBindfulKernel with mode " << static_cast<uint32_t>(mode) << " " << std::get<2>(kernelMode) << " PASSED.\n"
654+
<< std::endl;
655+
}
656+
}
657+
}
658+
return true;
659+
}
660+
634661
bool testBindlessImageSampled(ze_context_handle_t context, ze_device_handle_t device, const std::string &deviceId,
635662
const std::string &revisionId, AddressingMode mode) {
636663
bool outputValidated = true;
@@ -1301,7 +1328,7 @@ int main(int argc, char *argv[]) {
13011328
ze_device_uuid_t uuid = deviceProperties.uuid;
13021329
std::string revisionId = std::to_string(reinterpret_cast<uint16_t *>(uuid.id)[2]);
13031330

1304-
int numTests = 7;
1331+
int numTests = 8;
13051332
int testCase = -1;
13061333
testCase = LevelZeroBlackBoxTests::getParamValue(argc, argv, "", "--test-case", -1);
13071334
if (testCase < -1 || testCase >= numTests) {
@@ -1342,7 +1369,7 @@ int main(int argc, char *argv[]) {
13421369
std::cout << "--bindless-images " << std::endl;
13431370
}
13441371

1345-
outputValidated &= testBindlessImages(context, device, ss.str(), revisionId, imageCount, mode);
1372+
outputValidated &= testBindlessImages(context, device, ss.str(), revisionId, imageCount, mode, ExecutionMode::commandQueue);
13461373
} else {
13471374
std::cout << "Skipped. testBindlessImages case not supported\n";
13481375
}
@@ -1436,6 +1463,18 @@ int main(int argc, char *argv[]) {
14361463
<< std::endl;
14371464

14381465
outputValidated &= testBindlessBindfulKernel(context, device, ss.str(), revisionId);
1466+
break;
1467+
case 7:
1468+
1469+
if (is2dImageSupported) {
1470+
std::cout << "\ntest case: testBindlessBindfulImageKernel\n"
1471+
<< std::endl;
1472+
1473+
outputValidated &= testBindlessBindfulImageKernel(context, device, ss.str(), revisionId);
1474+
} else {
1475+
std::cout << "Skipped. testBindlessBindfulImageKernel case not supported\n";
1476+
}
1477+
14391478
break;
14401479
}
14411480

0 commit comments

Comments
 (0)