Repository navigation
Conversation
rjodinchr
force-pushed
the
replay
branch
3 times, most recently
from
September 29, 2026 16:23
f969fe1 to
2073ced
Compare
Relocate opencl-kernel-profiler.cpp into a dedicated layer/ directory to separate the OpenCL ICD layer from the trace extractor and replay runner tools, and update CMakeLists.txt and Android.bp.example accordingly.
rjodinchr
force-pushed
the
replay
branch
2 times, most recently
from
September 30, 2026 13:25
cc52483 to
5099266
Compare
Add shared Perfetto TrackEvent schema and protozero decoding helpers in include/clkp_common.hpp, and expand the OpenCL ICD layer to record all state required for standalone multi-dispatch replay: - Assign monotonic call_id and dispatch_id values and synthetic handle IDs for contexts, queues, programs, kernels, memory objects, samplers, events, command buffers, and mutable commands. - Capture context, command queue, program (source, IL, binary chunks, build/compile/link options, specialization constants), kernel creation, and clSetKernelArg bindings (classified as LOCAL, MEM, SAMPLER, or VALUE). - Capture buffer, sub-buffer, image, and sampler creation, as well as queue transfer, map/unmap, barrier, and synchronization calls. - Intercept cl_khr_command_buffer and cl_khr_command_buffer_mutable_dispatch extension functions via clGetExtensionFunctionAddressForPlatform and clGetExtensionFunctionAddress, including GPU execution profiling for clEnqueueCommandBufferKHR.
Implement clkp-extractor using Perfetto's protozero decoders and encoders without depending on sqlite or libtrace_processor: - Support --list-dispatches to summarize all captured queue dispatches and command buffer executions along with their GPU execution times. - Support full and windowed trace extraction (--start-dispatch/--end-dispatch, --start-call/--end-call) with transitive dependency closure over upstream OpenCL objects and command buffer recordings. - Emit self-contained, de-interned .perfetto-trace files ready for replay or inspection in the Perfetto UI.
Implement clkp-runner to parse extracted or raw Perfetto traces via protozero and replay multi-dispatch and cl_khr_command_buffer workloads on OpenCL: - Separate one-time setup (context, queues, program compilation/linking, kernels, buffers/images/samplers, and command buffer recording) from the hot-loop execution phase (-m <warmup>, -n <iterations>). - Support native cl_khr_command_buffer and cl_khr_command_buffer_mutable_dispatch replay, command buffer promotion (--use-command-buffer), and command buffer emulation (--emulate-command-buffer). - Collect hardware GPU profiling timestamps via clGetEventProfilingInfo and report min/avg/median/max execution times in console and JSON (--json) formats.
Update tests and GitHub Actions CI workflow: - Add --cmdbuf CLI option to opencl-kernel-profiler-test to exercise cl_khr_command_buffer capture. - Extend tests/test.sh to test clkp-extractor (--list-dispatches, full and windowed extraction) and clkp-runner (multi-dispatch replay, native command buffer replay, and --emulate-command-buffer). - Update .github/workflows/presubmit.yml to build OpenCL-ICD-Loader on Android and pass OPENCL_LIBRARY_PATH on Linux and Android.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add multi-dispatch Perfetto trace replay using Perfetto's
protozeroSDK:layer/): Move layer source fromsrc/tolayer/and expand it to capture all OpenCL state required for replay (contexts, queues, programs, kernels, kernel args, buffers, images, samplers, andcl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatchcalls) with monotoniccall_idanddispatch_idtracking.extractor/clkp-extractor): Inspect captured dispatches (--list-dispatches) and filter/window Perfetto traces (--start-dispatch/--end-dispatch,--start-call/--end-call) into self-contained.perfetto-tracefiles with full upstream dependency closure.runner/clkp-runner): Replay multi-dispatch andcl_khr_command_bufferworkloads from.perfetto-tracefiles (-m <warmup>,-n <iterations>,--use-command-buffer,--emulate-command-buffer,--json) and report GPU profiling timings.tests/and.github/workflows/presubmit.ymlto build and testclkp-extractor,clkp-runner, andcl_khr_command_bufferreplay.