Add test for -cl-fp32-correctly-rounded-divide-sqrt to spir subtest.

This commit is contained in:
Yaxun (Sam) Liu
2015-12-02 17:31:17 -05:00
committed by Alastair Murray
parent 0654d2715d
commit 490561d249
2 changed files with 39 additions and 3 deletions

View File

@@ -4134,6 +4134,18 @@ bool test_math_brute_force (cl_device_id device, cl_uint size_t_width, const cha
"math_kernel3.cospi_float3",
"math_kernel2.cospi_float2",
"math_kernel.cospi_float",
"math_kernel4.div_float4",
"math_kernel16.div_float16",
"math_kernel8.div_float8",
"math_kernel2.div_float2",
"math_kernel3.div_float3",
"math_kernel.div_float",
"math_kernel4.div_cr_float4",
"math_kernel16.div_cr_float16",
"math_kernel8.div_cr_float8",
"math_kernel2.div_cr_float2",
"math_kernel3.div_cr_float3",
"math_kernel.div_cr_float",
"math_kernel16.exp_float16",
"math_kernel4.exp_float4",
"math_kernel3.exp_float3",
@@ -4476,6 +4488,12 @@ bool test_math_brute_force (cl_device_id device, cl_uint size_t_width, const cha
"math_kernel2.sqrt_float2",
"math_kernel3.sqrt_float3",
"math_kernel.sqrt_float",
"math_kernel4.sqrt_cr_float4",
"math_kernel16.sqrt_cr_float16",
"math_kernel8.sqrt_cr_float8",
"math_kernel2.sqrt_cr_float2",
"math_kernel3.sqrt_cr_float3",
"math_kernel.sqrt_cr_float",
"math_kernel8.tan_float8",
"math_kernel16.tan_float16",
"math_kernel4.tan_float4",

View File

@@ -38,7 +38,7 @@
#include "datagen.h"
#include "run_services.h"
#include "run_build_test.h"
#include <CL/cl.h>
//
// Task
//
@@ -366,15 +366,33 @@ bool TestRunner::runBuildTest(cl_device_id device, const char *folder,
create_context_and_queue(device, &context, &queue);
clProgramWrapper clprog = create_program_from_cl(context, cl_file_path);
clProgramWrapper bcprog = create_program_from_bc(context, bc_file);
std::string bcoptions = "-x spir -spir-std=1.2 -cl-kernel-arg-info";
std::string cloptions = "-cl-kernel-arg-info";
cl_device_fp_config gFloatCapabilities = 0;
cl_int err;
if ((err = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(gFloatCapabilities), &gFloatCapabilities, NULL)))
{
log_info("Unable to get device CL_DEVICE_SINGLE_FP_CONFIG. (%d)\n", err);
}
if (strstr(test_name, "div_cr") || strstr(test_name, "sqrt_cr")) {
if ((gFloatCapabilities & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT) == 0)
return;
else {
bcoptions += " -cl-fp32-correctly-rounded-divide-sqrt";
cloptions += " -cl-fp32-correctly-rounded-divide-sqrt";
}
}
// Building the programs.
BuildTask clBuild(clprog, device, "-cl-kernel-arg-info");
BuildTask clBuild(clprog, device, cloptions.c_str());
if (!clBuild.execute()) {
std::cerr << clBuild.getErrorLog() << std::endl;
return false;
}
SpirBuildTask bcBuild(bcprog, device, "-x spir -spir-std=1.2 -cl-kernel-arg-info");
SpirBuildTask bcBuild(bcprog, device, bcoptions.c_str());
if (!bcBuild.execute()) {
std::cerr << bcBuild.getErrorLog() << std::endl;
return false;