New spirv_new test case OpSpecConstant (#719)

* New spirv_new test case OpSpecConstant OpSpecConstantTrue OpSpecConstantfalse

* Register test case with minimal OpenCL version

* Specialization constant - add files uint/int cases

* Specialization constants - fix second build program

* Fix changes clang format.

* spirv_new - Make functions visible outside of main

* Fix clang format issues

* Fix int/uint 32 bit cases

* Fix minimal required version for test_op_spec_constant

* Remove not needed OpName. Update binaries

* Fix code format

* Remove op_spec_constant_int cases in spirv_new tests

* op_spec_constant - add simplified spirv files

* no redundant OpUConvert OpSConvert
* no redundant OpName
* instead of buffers scalar variable

* op_spec_constant - refactor to address review issues

* avoid using program that has already kernel program attached
* remove not used buffer
* Simplified test case - instead of buffers use scalar variable

* spirv_new - remove spec_const duplicated cases (singed versions)

* spirv_new - set clSetProgramSpecializationConstant before clBuildProgram

* Test spirv_new - fix spec const after rebase

* Test spirv_new - fix spec const set min version for bool type tests
This commit is contained in:
Grzegorz Wawiorko
2020-08-20 01:39:06 +02:00
committed by GitHub
parent afa2fcca96
commit 41cd9c6d98
39 changed files with 969 additions and 59 deletions

View File

@@ -74,7 +74,8 @@ size_t spirvTestsRegistry::getNumTests()
return testDefinitions.size();
}
void spirvTestsRegistry::addTestClass(baseTestClass *test, const char *testName)
void spirvTestsRegistry::addTestClass(baseTestClass *test, const char *testName,
Version version)
{
testClasses.push_back(test);
@@ -135,20 +136,21 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
return err;
}
int get_program_with_il(clProgramWrapper &prog,
const cl_device_id deviceID,
const cl_context context,
const char *prog_name)
int get_program_with_il(clProgramWrapper &prog, const cl_device_id deviceID,
const cl_context context, const char *prog_name,
spec_const spec_const_def)
{
cl_int err = 0;
if (gCompilationMode == kBinary) {
if (gCompilationMode == kBinary)
{
return offline_get_program_with_il(prog, deviceID, context, prog_name);
}
std::vector<unsigned char> buffer_vec = readSPIRV(prog_name);
int file_bytes = buffer_vec.size();
if (file_bytes == 0) {
if (file_bytes == 0)
{
log_error("File %s not found\n", prog_name);
return -1;
}
@@ -159,6 +161,15 @@ int get_program_with_il(clProgramWrapper &prog,
prog = clCreateProgramWithIL(context, buffer, file_bytes, &err);
SPIRV_CHECK_ERROR(
err, "Failed to create program with clCreateProgramWithIL");
if (spec_const_def.spec_value != NULL)
{
err = clSetProgramSpecializationConstant(
prog, spec_const_def.spec_id, spec_const_def.spec_size,
spec_const_def.spec_value);
SPIRV_CHECK_ERROR(
err, "Failed to run clSetProgramSpecializationConstant");
}
}
else
{