{"action":"created","issue":{"url":"https://api.github.com/repos/pocl/pocl/issues/299","repository_url":"https://api.github.com/repos/pocl/pocl","labels_url":"https://api.github.com/repos/pocl/pocl/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/pocl/pocl/issues/299/comments","events_url":"https://api.github.com/repos/pocl/pocl/issues/299/events","html_url":"https://github.com/pocl/pocl/pull/299","id":133003823,"number":299,"title":"Pocl proper binary format : poclcc","user":{"login":"rjodin","id":13963356,"avatar_url":"https://avatars.githubusercontent.com/u/13963356?v=3","gravatar_id":"","url":"https://api.github.com/users/rjodin","html_url":"https://github.com/rjodin","followers_url":"https://api.github.com/users/rjodin/followers","following_url":"https://api.github.com/users/rjodin/following{/other_user}","gists_url":"https://api.github.com/users/rjodin/gists{/gist_id}","starred_url":"https://api.github.com/users/rjodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjodin/subscriptions","organizations_url":"https://api.github.com/users/rjodin/orgs","repos_url":"https://api.github.com/users/rjodin/repos","events_url":"https://api.github.com/users/rjodin/events{/privacy}","received_events_url":"https://api.github.com/users/rjodin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-11T15:27:01Z","updated_at":"2016-02-17T12:21:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pocl/pocl/pulls/299","html_url":"https://github.com/pocl/pocl/pull/299","diff_url":"https://github.com/pocl/pocl/pull/299.diff","patch_url":"https://github.com/pocl/pocl/pull/299.patch"},"body":"**POCL PROPER BINARY FORMAT**\r\n\r\n- poclcc binary format:\r\n\r\n[char *_pocl_id_][uint32_t _version_][uint64_t _device_id_][uint32_t _num_kernels_]\r\n[\r\n--[uint32_t _sizeofKernelName_][uint32_t _num_args_][uint32_t _num_locals_][uint32_t _sizeofBinary_]\r\n--[char *_kernel_name_][struct pocl_argument *_dyn_arguments_][struct pocl_argument_info *_arg_info_]\r\n--[unsigned char *_binary_]\r\n]+\r\n\r\n- binary informations:\r\n\r\n_pocl_id_: needed to make the difference between poclcc binary and LLVM IR binary (in _clCreateProgramWithBinary_ at least)\r\n_version_: to identify with version of poclcc has been use to generate the file\r\n_device_id_: It is a number created by hashing the _vendor_id_, _llvm_target_triplet_ and _llvm_cpu_ of the _cl_device_id_ (with the FNV-1A algorithm). It enables pocl to know for which device a kernel has been compiled\r\n_num_kernels_: number of kernels contained in the file for this device\r\n\r\n- kernel informations:\r\n\r\n_sizeofKernelName_: the size of _kernel_name_ (with does not have a '\\0' at the end)\r\n_num_args_: number of arguments of the kernel. We need it as we won't be able to find the information in the binary and _clCreateKernel_ needs it.\r\n_num_locals_: same as _num_args_ but for local variables\r\n_sizeofBinary_: the size of the binary (ELF file)\r\n_kernel_name_: the name of the kernel\r\n_dyn_arguments_: table needed by _clCreateKernel_\r\n_arg_info_: table needed by _clCreateKernel_\r\n_binary_: the binary for this kernel (and this device only) \r\n\r\n**CHANGES FOR AN OPENCL USER:**\r\n\r\n- bin _poclcc_: It takes some arguments (./poclcc --help) to produce a file which contains everything necessary to run an OpenCL program without having to make a call to a compiler. (pocl-standalone has been removed)\r\n\r\n**CHANGES FOR AN POCL DEVELOPER**\r\n\r\n- add of arguments in cl_program (_pocl_binaries_, _pocl_binary_sizes_, _is_pocl_binary_).\r\n\r\n- When running a kernel created from _clCreateProgramWithBinary_ the backend needs to set up the _local_size_ tab in the pocl_context.\r\n\r\n- Everything that deal with the new binary format are in _lib/CL/pocl_binary.{c,h}_.\r\n\r\n**TESTSUITE**\r\n\r\nThere is a new test in _tests/regression/_ named _test_enqueue_kernel_from_binary_.\r\nIt compares the run of the same kernel created with _clCreateProgramWithBinary_ and _clCreateProgramWithSource_.\r\n(It also compares with a third kernel create with _clCreateProgramWithBinary_ but with different local_size to check that the loops on local_size are efficient)."},"comment":{"url":"https://api.github.com/repos/pocl/pocl/issues/comments/185176293","html_url":"https://github.com/pocl/pocl/pull/299#issuecomment-185176293","issue_url":"https://api.github.com/repos/pocl/pocl/issues/299","id":185176293,"user":{"login":"pjaaskel","id":1652632,"avatar_url":"https://avatars.githubusercontent.com/u/1652632?v=3","gravatar_id":"","url":"https://api.github.com/users/pjaaskel","html_url":"https://github.com/pjaaskel","followers_url":"https://api.github.com/users/pjaaskel/followers","following_url":"https://api.github.com/users/pjaaskel/following{/other_user}","gists_url":"https://api.github.com/users/pjaaskel/gists{/gist_id}","starred_url":"https://api.github.com/users/pjaaskel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjaaskel/subscriptions","organizations_url":"https://api.github.com/users/pjaaskel/orgs","repos_url":"https://api.github.com/users/pjaaskel/repos","events_url":"https://api.github.com/users/pjaaskel/events{/privacy}","received_events_url":"https://api.github.com/users/pjaaskel/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T12:21:17Z","updated_at":"2016-02-17T12:21:17Z","body":"OK. In my original plan I envisioned this could happen implicitly due to just packing up the temp dir contents, but we can implement it later. It can be useful for performance purposes to have static WG functions included also, if they have been generated for interesting local sizes."}}