mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
add SPIR-V 1.4 testing for OpCopyLogical (#2136)
This PR adds targeted testing for the SPIR-V 1.4 instruction OpCopyLogical.
This commit is contained in:
@@ -511,3 +511,51 @@ TEST_SPIRV_FUNC(spirv14_select_composite)
|
||||
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
TEST_SPIRV_FUNC(spirv14_copylogical)
|
||||
{
|
||||
if (!is_spirv_version_supported(deviceID, "SPIR-V_1.4"))
|
||||
{
|
||||
log_info("SPIR-V 1.4 not supported; skipping tests.\n");
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
cl_int error = CL_SUCCESS;
|
||||
clProgramWrapper prog;
|
||||
error = get_program_with_il(prog, deviceID, context,
|
||||
"spv1.4/copylogical_struct");
|
||||
SPIRV_CHECK_ERROR(error, "Failed to compile spv program");
|
||||
|
||||
clKernelWrapper kernel = clCreateKernel(prog, "copylogical_test", &error);
|
||||
SPIRV_CHECK_ERROR(error, "Failed to create spv kernel");
|
||||
|
||||
struct TestStruct
|
||||
{
|
||||
cl_int i;
|
||||
cl_float f;
|
||||
};
|
||||
TestStruct results{ 0, 0.0f };
|
||||
clMemWrapper dst = clCreateBuffer(context, CL_MEM_READ_WRITE,
|
||||
sizeof(results), NULL, &error);
|
||||
SPIRV_CHECK_ERROR(error, "Failed to create dst buffer");
|
||||
|
||||
error |= clSetKernelArg(kernel, 0, sizeof(dst), &dst);
|
||||
SPIRV_CHECK_ERROR(error, "Failed to set kernel args");
|
||||
|
||||
size_t global = 1;
|
||||
error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, NULL, 0,
|
||||
NULL, NULL);
|
||||
SPIRV_CHECK_ERROR(error, "Failed to enqueue kernel");
|
||||
|
||||
error = clEnqueueReadBuffer(queue, dst, CL_TRUE, 0, sizeof(results),
|
||||
&results, 0, NULL, NULL);
|
||||
SPIRV_CHECK_ERROR(error, "Unable to read destination buffer");
|
||||
|
||||
if (results.i != 1024 || results.f != 3.1415f)
|
||||
{
|
||||
log_error("Results mismatch! Got: { %d, %f }\n", results.i, results.f);
|
||||
return TEST_FAIL;
|
||||
}
|
||||
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user