mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
Check device address width when deciding which SPIR-V binary to read (#172)
This commit is contained in:
@@ -30,7 +30,7 @@ const std::string slash = "/";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string spvExt = ".spv";
|
const std::string spvExt = ".spv";
|
||||||
const std::string addrWidth = (sizeof(void *) == 4) ? "32" : "64";
|
std::string gAddrWidth = "";
|
||||||
|
|
||||||
std::vector<unsigned char> readBinary(const char *file_name)
|
std::vector<unsigned char> readBinary(const char *file_name)
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ std::vector<unsigned char> readBinary(const char *file_name)
|
|||||||
|
|
||||||
std::vector<unsigned char> readSPIRV(const char *file_name)
|
std::vector<unsigned char> readSPIRV(const char *file_name)
|
||||||
{
|
{
|
||||||
std::string full_name_str = gSpirVPath + slash + file_name + spvExt + addrWidth;
|
std::string full_name_str = gSpirVPath + slash + file_name + spvExt + gAddrWidth;
|
||||||
return readBinary(full_name_str.c_str());
|
return readBinary(full_name_str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
|
|||||||
std::string scriptArgs =
|
std::string scriptArgs =
|
||||||
gOfflineCompilerInput + " " +
|
gOfflineCompilerInput + " " +
|
||||||
gOfflineCompilerOutput + " " +
|
gOfflineCompilerOutput + " " +
|
||||||
addrWidth + " " +
|
gAddrWidth + " " +
|
||||||
outputTypeStr + " " +
|
outputTypeStr + " " +
|
||||||
"-cl-std=CL2.0";
|
"-cl-std=CL2.0";
|
||||||
|
|
||||||
@@ -160,11 +160,24 @@ int get_program_with_il(clProgramWrapper &prog,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_status checkAddressWidth(cl_device_id id)
|
||||||
|
{
|
||||||
|
cl_uint address_bits;
|
||||||
|
cl_uint err = clGetDeviceInfo(id, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), &address_bits, NULL);
|
||||||
|
if(err != CL_SUCCESS){
|
||||||
|
log_error("clGetDeviceInfo failed to get address bits!");
|
||||||
|
return TEST_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gAddrWidth = address_bits == 32 ? "32" : "64";
|
||||||
|
return TEST_PASS;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
gReSeed = 1;
|
gReSeed = 1;
|
||||||
return runTestHarness(argc, argv,
|
return runTestHarnessWithCheck(argc, argv,
|
||||||
spirvTestsRegistry::getInstance().getNumTests(),
|
spirvTestsRegistry::getInstance().getNumTests(),
|
||||||
spirvTestsRegistry::getInstance().getTestDefinitions(),
|
spirvTestsRegistry::getInstance().getTestDefinitions(),
|
||||||
false, false, 0);
|
false, false, 0, checkAddressWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user