From 490561d249b1d827e04fb73448a1cb4d9d4f8f29 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Wed, 2 Dec 2015 17:31:17 -0500 Subject: [PATCH] Add test for -cl-fp32-correctly-rounded-divide-sqrt to spir subtest. --- test_conformance/spir/main.cpp | 18 ++++++++++++++++++ test_conformance/spir/run_build_test.cpp | 24 +++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/test_conformance/spir/main.cpp b/test_conformance/spir/main.cpp index 95fcd8bf..d5859b6f 100644 --- a/test_conformance/spir/main.cpp +++ b/test_conformance/spir/main.cpp @@ -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", diff --git a/test_conformance/spir/run_build_test.cpp b/test_conformance/spir/run_build_test.cpp index c00fcf82..684226a7 100644 --- a/test_conformance/spir/run_build_test.cpp +++ b/test_conformance/spir/run_build_test.cpp @@ -38,7 +38,7 @@ #include "datagen.h" #include "run_services.h" #include "run_build_test.h" - +#include // // 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;