Skip to content

fix(kernel-time): correct total/kernel time calculation in JSON output#326

Open
Benncs wants to merge 3 commits intokokkos:developfrom
Benncs:fix/kernel-timer-json
Open

fix(kernel-time): correct total/kernel time calculation in JSON output#326
Benncs wants to merge 3 commits intokokkos:developfrom
Benncs:fix/kernel-timer-json

Conversation

@Benncs
Copy link
Copy Markdown

@Benncs Benncs commented Mar 11, 2026

Problem

kp_kernel_timer miscalculated total time, kernel count, and total kernel time in JSON output. Problem was not present in kp_reader_json'and 'kp_reader implementation.

Fix

Reused kp_reader_json's logic and unified code in kp_shared.

Impact

  • JSON outputs correct values
  • Explicitly linked kp_reader_json to kp_shared

@masterleinad
Copy link
Copy Markdown
Contributor

Can you provide the output before and after this pull request?

@Benncs
Copy link
Copy Markdown
Author

Benncs commented Mar 11, 2026

With the develop branch on my program with the following environment variable
export KOKKOS_TOOLS_TIMER_JSON="1"

Before:

{
"kokkos-kernel-data" : {
    "total-app-time"         :      1.319,
    "total-kernel-times"     :      2.217,
    "total-non-kernel-times" :     -0.898,
    "percent-in-kernels"     : 168.09,
    "unique-kernel-calls"    :                     56,
    "region-perf-info"       : [
       {
           "kernel-name"    : "ParticlesContainer::__allocate_buffer__",
           "call-count"     : 26,
           "total-time"     : 0.000058,
           "time-per-call"  :       0.00000224,
           "kernel-type"    : "PARALLEL-SCAN"
       },
....
}

After:

{
  "total-app-time" : 1.31087,
  "total-kernel-time" : 0.598734,
  "total-non-kernel-time" : 0.71214,
  "percent-in-kernels" : 45.6744,
  "unique-kernel-calls" : 36,
  "region-data" : [
    {
      "region-name": "cycleProcess",
      "call-count": 10,001,
      "total-time": 0.70493,
      "time-per-call": 7.04859e-05,
      "kernel-type": "REGION"
    }
,...
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants