Skip to content

Commit

Permalink
cl-binary: move kernel binary to text as built-in
Browse files Browse the repository at this point in the history
 * How to load binary-text file:
   1. generate binary file, related script:
          libxcam/tests/test-binary-kernel
      Usage:
      $ test-binary-kernel -i kernel_demo.cl -o kernel_demo.cl.bin \
        -k kernel_demo
   2. generate binary-text file, related script:
          libxcam/tools/convert-binary-to-text.sh
      Usage:
      $ convert-binary-to-text.sh kernel_demo.cl.bin \
        kernel_demo.clx.bin
   3. include binary-text file in create-handler function, please refer
      to demo handler:
      SmartPtr<CLImageHandler>
      create_cl_binary_demo_image_handler (SmartPtr<CLContext> &context)

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
  • Loading branch information
liuyinhangx authored and Wind Yuan committed Mar 23, 2017
1 parent 52d45b3 commit 5aad612
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 19 deletions.
4 changes: 1 addition & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
if HAVE_LIBCL
CLX_KERNEL_DIR = clx_kernel
CLX_BIN_DIR = clx_bin
else
CLX_KERNEL_DIR =
CLX_BIN_DIR =
endif

if HAVE_LIBCL
Expand All @@ -21,5 +19,5 @@ CAPI_DIR = capi
else
CAPI_DIR =
endif
SUBDIRS = xcore $(CLX_KERNEL_DIR) $(CLX_BIN_DIR) modules plugins \
SUBDIRS = xcore $(CLX_KERNEL_DIR) modules plugins \
wrapper $(CAPI_DIR) $(TESTS_DIR) pkgconfig
Binary file removed cl_bin/kernel_demo.cl.bin
Binary file not shown.
15 changes: 0 additions & 15 deletions clx_bin/Makefile.am

This file was deleted.

117 changes: 117 additions & 0 deletions clx_bin/kernel_demo.clx.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* How to load binary-text file:
*
* 1. generate binary file, related script: libxcam/tests/test-binary-kernel
* Usage:
* $ test-binary-kernel -i kernel_demo.cl -o kernel_demo.cl.bin -k kernel_demo
*
* 2. generate binary-text file, related script: libxcam/tools/convert-binary-to-text.sh
* Usage:
* $ convert-binary-to-text.sh kernel_demo.cl.bin kernel_demo.clx.bin
*
* 3. include binary-text file when create image handler, please refer to demo handler:
* SmartPtr<CLImageHandler> create_cl_binary_demo_image_handler (SmartPtr<CLContext> &context)
*
*/

{
0x01, 0x47, 0x45, 0x4e, 0x43, 0x43, 0x48, 0x56, 0x47, 0x4f, 0x52, 0x50, 0x01, 0x00, 0x00, 0x00,
0x54, 0x53, 0x4e, 0x43, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2f, 0x0a, 0x00, 0x00, 0x83, 0x09, 0x00, 0x00, 0xe4, 0x06, 0x00, 0x00, 0x44, 0x0e, 0x00, 0x00,
0x52, 0x01, 0x00, 0x00, 0xfc, 0x09, 0x00, 0x00, 0x75, 0x02, 0x00, 0x00, 0xd1, 0x07, 0x00, 0x00,
0x53, 0x0f, 0x00, 0x00, 0xdd, 0x04, 0x00, 0x00, 0x0d, 0x0c, 0x00, 0x00, 0x62, 0x0b, 0x00, 0x00,
0x59, 0x09, 0x00, 0x00, 0x3c, 0x09, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00,
0xe5, 0x0f, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, 0x38, 0x63, 0xed, 0x3e, 0xda, 0x0f, 0x49, 0x3f,
0x5e, 0x98, 0x7b, 0x3f, 0xda, 0x0f, 0xc9, 0x3f, 0x69, 0x37, 0xac, 0x31, 0x68, 0x21, 0x22, 0x33,
0xb4, 0x0f, 0x14, 0x33, 0x68, 0x21, 0xa2, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xcf, 0xd1, 0x35, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0x15, 0x3f, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x74, 0x77, 0x6f, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x69, 0x50, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61,
0x74, 0x61, 0x6e, 0x68, 0x69, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00,
0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61, 0x74, 0x61, 0x6e, 0x6c, 0x6f, 0x10,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x18,
0x00, 0x00, 0x00, 0x5f, 0x5f, 0x6f, 0x63, 0x6c, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x66, 0x61,
0x73, 0x74, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x04, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x5f,
0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x63, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x5f, 0x70, 0x6f, 0x77, 0x6e, 0x2e, 0x62, 0x70, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x74, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x5f, 0x5f, 0x67,
0x65, 0x6e, 0x5f, 0x6f, 0x63, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f,
0x70, 0x6f, 0x77, 0x6e, 0x2e, 0x64, 0x70, 0x5f, 0x6c, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x5f, 0x5f, 0x67,
0x65, 0x6e, 0x5f, 0x6f, 0x63, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f,
0x70, 0x6f, 0x77, 0x6e, 0x2e, 0x64, 0x70, 0x5f, 0x68, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x84, 0x00, 0x00, 0x00, 0x43, 0x4e, 0x53, 0x54, 0xa9, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x43, 0x4c, 0x45, 0x52, 0x00, 0x00, 0x00, 0x00, 0x52, 0x45, 0x4c, 0x43, 0x0c, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x4e, 0x52, 0x45, 0x4b, 0x0b, 0x00, 0x00, 0x00, 0x6b, 0x65, 0x72,
0x6e, 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x6d, 0x6f, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x09, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x32, 0x64, 0x5f, 0x74, 0x09, 0x00,
0x00, 0x00, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x05,
0x00, 0x00, 0x00, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x61,
0x67, 0x65, 0x32, 0x64, 0x5f, 0x74, 0x0a, 0x00, 0x00, 0x00, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f,
0x6f, 0x6e, 0x6c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x70,
0x75, 0x74, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x15, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x4d, 0x41, 0x53, 0x01,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x41, 0x4d, 0x50, 0x14,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x41, 0x4d, 0x49, 0x02, 0x00, 0x00, 0x00, 0x29,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x49, 0x4d, 0x41, 0x47, 0xa0, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x01,
0x00, 0x80, 0x00, 0x4c, 0x16, 0x40, 0x20, 0x00, 0x00, 0x00, 0x10, 0xff, 0xff, 0x00, 0x00, 0x01,
0x00, 0x80, 0x00, 0x48, 0x16, 0x40, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10,
0x80, 0x80, 0x06, 0x45, 0x12, 0x00, 0x20, 0x40, 0x00, 0x8d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x22,
0x00, 0x81, 0x00, 0x01, 0x06, 0x00, 0x20, 0x90, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x41,
0x00, 0x00, 0x00, 0x2c, 0x0a, 0x20, 0x20, 0x04, 0x00, 0x00, 0x02, 0x28, 0x00, 0x00, 0x00, 0x01,
0x00, 0x80, 0x00, 0x0c, 0x06, 0x40, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x60, 0x00, 0x08, 0x06, 0xc0, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
0x96, 0x01, 0x20, 0xe0, 0x02, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x5c, 0x23, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x40, 0x96, 0x65, 0x20, 0x07, 0x08, 0x02, 0x01, 0x41,
0x00, 0x00, 0x00, 0x2c, 0x0a, 0x24, 0x20, 0x18, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00, 0x01,
0x96, 0x00, 0x20, 0x07, 0x0e, 0x08, 0x00, 0x40, 0x96, 0x15, 0x20, 0xe0, 0x0a, 0x01, 0x06, 0x01,
0x4b, 0x00, 0x20, 0x07, 0x1b, 0x08, 0x00, 0x40, 0x96, 0x71, 0x20, 0x07, 0x0c, 0x0a, 0x01, 0x01,
0x96, 0x00, 0x20, 0x07, 0x10, 0x0c, 0x00, 0x01, 0x4b, 0x00, 0x20, 0x07, 0x1c, 0x0c, 0x00, 0x31,
0x00, 0x80, 0x02, 0x08, 0x3a, 0x40, 0x22, 0xc0, 0x01, 0x8d, 0x06, 0x02, 0x00, 0x84, 0x08, 0x01,
0x00, 0x60, 0x00, 0x08, 0x06, 0xa0, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x60, 0x00, 0x28, 0x0a, 0xe0, 0x23, 0x40, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x60, 0x00, 0x28, 0x0a, 0x00, 0x24, 0x80, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x60, 0x00, 0x28, 0x0a, 0x40, 0x24, 0x00, 0x03, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x60, 0x00, 0x28, 0x0a, 0x20, 0x24, 0xc0, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31,
0x00, 0x60, 0x0c, 0x00, 0x02, 0x00, 0x20, 0x40, 0x03, 0x8d, 0x06, 0x03, 0x50, 0x0b, 0x12, 0x01,
0x54, 0x00, 0x20, 0x07, 0x1b, 0x09, 0x00, 0x01, 0x54, 0x00, 0x20, 0x07, 0x1c, 0x0d, 0x00, 0x01,
0x10, 0x60, 0x00, 0x08, 0x06, 0xc0, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x10, 0x60, 0x00, 0x28, 0x0a, 0x00, 0x24, 0xa0, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x10, 0x60, 0x00, 0x28, 0x0a, 0x40, 0x24, 0x20, 0x03, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x10, 0x60, 0x00, 0x08, 0x06, 0xa0, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x10, 0x60, 0x00, 0x28, 0x0a, 0xe0, 0x23, 0x60, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x10, 0x60, 0x00, 0x28, 0x0a, 0x20, 0x24, 0xe0, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31,
0x10, 0x60, 0x0c, 0x00, 0x02, 0x00, 0x20, 0x40, 0x03, 0x8d, 0x06, 0x03, 0x50, 0x0b, 0x12, 0x25,
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x8d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x80, 0x00, 0x0d, 0x02, 0x00, 0x2e, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31,
0x00, 0x60, 0x07, 0x00, 0x02, 0x00, 0x20, 0x00, 0x0e, 0x8d, 0x06, 0x10, 0x00, 0x00, 0x82, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x7e,
0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x20, 0x00, 0x00, 0x69, 0x06, 0x00, 0x00, 0x00, 0x00, 0x4b,
0x45, 0x52, 0x4e, 0x4e, 0x04, 0x00, 0x00, 0x50, 0x52, 0x4f, 0x47, 0x23, 0x06, 0x00, 0x00,
};
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ AM_CONDITIONAL([USE_LOCAL_AIQ], [test "$USE_LOCAL_AIQ" -eq 1])

AC_CONFIG_FILES([Makefile
clx_kernel/Makefile
clx_bin/Makefile
xcore/Makefile
modules/Makefile
modules/isp/Makefile
Expand Down
1 change: 1 addition & 0 deletions modules/ocl/cl_image_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ CLImageProcessor::create_handlers ()
{
SmartPtr<CLImageHandler> demo_handler;
demo_handler = create_cl_demo_image_handler (_context);
// demo_handler = create_cl_binary_demo_image_handler (_context);
XCAM_FAIL_RETURN (
WARNING,
demo_handler.ptr (),
Expand Down
1 change: 1 addition & 0 deletions tests/test-cl-image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ int main (int argc, char *argv[])
switch (handler_type) {
case TestHandlerDemo:
image_handler = create_cl_demo_image_handler (context);
// image_handler = create_cl_binary_demo_image_handler (context);
break;
case TestHandlerColorConversion: {
SmartPtr<CLCscImageHandler> csc_handler;
Expand Down

0 comments on commit 5aad612

Please sign in to comment.