Skip to content

Commit

Permalink
vulkan: accept device selection (#2113)
Browse files Browse the repository at this point in the history
- read CL_DEVICE_TYPE_ when specified like other conformance tests
- reject non-GPU device types

Co-authored-by: dcrawley <dcrawley@qti.qualcomm.com>
  • Loading branch information
joshqti and dcrawley authored Oct 22, 2024
1 parent 5b3bfee commit 899cbf5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test_conformance/vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ static void printUsage(const char *execName)
log_info("\t--non_dedicated - Choose dedicated Vs. non_dedicated \n");
}

bool isDeviceSelection(const char *arg)
{

return strcmp(arg, "gpu") == 0 || strcmp(arg, "CL_DEVICE_TYPE_GPU") == 0
|| strcmp(arg, "cpu") == 0 || strcmp(arg, "CL_DEVICE_TYPE_CPU") == 0
|| strcmp(arg, "accelerator") == 0
|| strcmp(arg, "CL_DEVICE_TYPE_ACCELERATOR") == 0
|| strcmp(arg, "custom") == 0
|| strcmp(arg, "CL_DEVICE_TYPE_CUSTOM") == 0
|| strcmp(arg, "CL_DEVICE_TYPE_DEFAULT") == 0;
}

size_t parseParams(int argc, const char *argv[], const char **argList)
{
size_t argCount = 1;
Expand Down Expand Up @@ -236,6 +248,16 @@ size_t parseParams(int argc, const char *argv[], const char **argList)
break;
}
}
else if (isDeviceSelection(argv[i]))
{
if (strcmp(argv[i], "gpu") != 0
&& strcmp(argv[i], "CL_DEVICE_TYPE_GPU") != 0
&& strcmp(argv[i], "CL_DEVICE_TYPE_DEFAULT") != 0)
{
log_info("Vulkan tests can only run on a GPU device.\n");
return 0;
}
}
else
{
argList[argCount] = argv[i];
Expand Down

0 comments on commit 899cbf5

Please sign in to comment.