summaryrefslogtreecommitdiff
path: root/utests/compiler_program_objects.cpp
diff options
context:
space:
mode:
authorHomer Hsing <homer.xing@intel.com>2012-11-19 16:17:31 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-03-29 18:41:32 +0800
commit2c68be232791bfafd7c8df502c3094e4938765b9 (patch)
tree36bd253981b83f44222a2ebe5f46ffe2c475a086 /utests/compiler_program_objects.cpp
parent7dfbde0165d98823ae2214949c4bbd11e7d441d6 (diff)
downloadbeignet-2c68be232791bfafd7c8df502c3094e4938765b9.tar.gz
test creating program objects, build program executable, build options, query program objects
Diffstat (limited to 'utests/compiler_program_objects.cpp')
-rw-r--r--utests/compiler_program_objects.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/utests/compiler_program_objects.cpp b/utests/compiler_program_objects.cpp
new file mode 100644
index 00000000..34ae42ad
--- /dev/null
+++ b/utests/compiler_program_objects.cpp
@@ -0,0 +1,64 @@
+/* test OpenCL 1.1 Program Objects (section 5.6)
+ * test creating program objects,
+ * build program executable,
+ * build options
+ * query program objects */
+
+#include "utest_helper.hpp"
+
+void compiler_program_objects(void)
+{
+ OCL_CREATE_KERNEL("empty"); // set up global vars
+ OCL_CALL(clRetainProgram, program);
+ OCL_CALL(clReleaseProgram, program);
+ OCL_CALL(clBuildProgram,
+ program,
+ 1,
+ &device,
+ "-Dname -Dname2=def -ldir "
+ "-cl-opt-disable -cl-strict-aliasing -cl-mad-enable -cl-no-signed-zeros "
+ "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations "
+ "-cl-single-precision-constant -cl-denorms-are-zero "
+ "-w -Werror -cl-std=CL1.1",
+ NULL,
+ NULL);
+ const int pi[] = {CL_PROGRAM_REFERENCE_COUNT,
+ CL_PROGRAM_CONTEXT,
+ CL_PROGRAM_NUM_DEVICES,
+ CL_PROGRAM_DEVICES,
+ CL_PROGRAM_SOURCE,
+ CL_PROGRAM_BINARY_SIZES,
+ CL_PROGRAM_BINARIES,};
+ const int pbi[] = {CL_PROGRAM_BUILD_STATUS,
+ CL_PROGRAM_BUILD_OPTIONS,
+ CL_PROGRAM_BUILD_LOG,};
+ char param_value[1024];
+ size_t pv_size;
+ int i;
+ for(i=0; i<sizeof(pi) / sizeof(pi[0]); i++)
+ OCL_CALL(clGetProgramInfo,
+ program,
+ pi[i],
+ sizeof(param_value),
+ param_value,
+ &pv_size);
+ for(i=0; i<sizeof(pbi) / sizeof(pbi[0]); i++)
+ OCL_CALL(clGetProgramBuildInfo,
+ program,
+ device,
+ pbi[i],
+ sizeof(param_value),
+ param_value,
+ &pv_size);
+ std::cout<<platform<<' '
+ <<device<<' '
+ <<ctx<<' '
+ <<program<<' '
+ <<kernel<<' '
+ <<queue<<std::endl;
+
+ puts("Test clUnloadCompiler");
+ OCL_CALL(clUnloadCompiler);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_program_objects);