Skip to content

Modify T4 results json schema - #5

Open
jhozzova wants to merge 9 commits into
AutoTuningAssociation:mainfrom
jhozzova:main
Open

jhozzova wants to merge 9 commits into
AutoTuningAssociation:mainfrom
jhozzova:main

Conversation

@jhozzova

Copy link
Copy Markdown
Contributor

Hi,
I have been working on integrating KTT as an autotuner supported in autotuning_methodology. During that process I came across several necessary changes in T4 results schema so that KTT can read full space search space files and simulate tuning with them. The changes are summarized below. I have kept it backward compatible, everything is optional, and naming is consistent with snake_case. I would suggest bumping schema version to 1.1.0 or 1.0.1 if this pull request is accepted.

I'm happy to discuss these changes and find common ground if something is not suitable for your needs.
Regards,
Janka

Summary of Changes

1. Added metadata Object (Top-Level)

  • New top-level field containing tuning environment information
  • Properties:
    • compute_api: API used (OpenCL/CUDA/Vulkan)
    • platform: Platform/SDK name
    • device: Device name
    • autotuner: Framework name (e.g., "KTT")
    • autotuner_version: Framework version
    • timestamp : Session start timestamp
    • timeunit : Time unit for all measurements (lowercase snake_case: "nanoseconds", "microseconds", "milliseconds", "seconds")
  • Rationale: Provides context for interpreting results and reproducing experiments

2. Added type Field to Measurements

  • Location: Within each item in the measurements array
  • Type: String enum
  • Values: "Int", "UnsignedInt", "Double", "Percent", "Throughput", "UtilizationLevel"
  • Optional: Not required for basic time measurements, primarily for profiling counters
  • Rationale: Enables proper type interpretation of profiling counter values

3. Enhanced times Object with New Fields

  • Added kernel_overhead: Time spent on kernel launch overhead
  • Added data: Time spent on data movement (host-device memory transfers)
  • Added profiling_runs: Time spent executing profiling runs
  • Added profiling_overhead: Overhead from profiling instrumentation
  • Rationale: Provides comprehensive breakdown of where time is spent during autotuning

4. Added compilation_data Object

  • Location: Optional top-level field within each result item (separate from times.compilation_data)
  • Contains:
    • Compilation metadata: max_work_group_size, local_memory_size, private_memory_size, constant_memory_size, registers
    • Thread dimensions: global_size (x/y/z), local_size (x/y/z)
  • All fields required if object present, if not applicable to current computational API, set to 0
  • Backend differences noted: Some fields (registers, constant_memory_size) are CUDA-specific
  • Rationale: Useful for understanding resource usage and reproducing exact kernel launches, also used as profiling information

5. Enhanced Existing Fields

  • Added detailed descriptions for all times properties
  • Clarified that configuration values are always strings
  • Specified correctness as binary (0 or 1)
  • Added examples where helpful

Add objects describing metadata and compilation data to T4 results json schema
Also fix the bug in pattern for version, dots need to be escaped
@fjwillemsen

Copy link
Copy Markdown
Collaborator

Hi Jana, thank you for your contribution! I think these are great additions. I agree this would definitely warrant a 1.1.0 version.

A couple of remarks regarding the metadata:

  • For reference, we used to have the T4-metadata but I'm not sure that was officially included, and this version captures other relevant details.
  • Do we thinkcompute_api (or programming model?) should be an enum or an open string field? E.g. Kernel Tuner has an increasingly wider range of supported APIs, so would need quite a bit more fields than the current three.
  • Do we need a separate framework_backend field to capture the framework-specific backend name (open to a more generic name) was used? E.g. KT has multiple backends that use the same programming model.
  • I think the autotuner shouldn't be an enum, to make sure the schema can be implemented by other frameworks.
  • The timestamp is a good idea, should probably specify UTC.
  • I'm not sure a general timeunit is possible, given that it's possible to have measurements with different time units. Though I agree that for most cases the current setup isn't space efficient because there's a lot of duplication.

Regarding measurements:

  • I recall that we discussed which and how many "buckets" of time breakdown to have when setting up the T4 format. Back then we settled on the original five (compilation, framework, search_algorithm, validation, runtimes) because it allows a neat breakdown without too high a specification and implementation threshold. For example, calculating the kernel launch overhead is relatively hard to standardize and, as far as I'm aware, usually negligible. However, I think the data transfer and profiling times are useful. Is it really necessary to split the latter into runs and overhead? Given that profiling run times would not be used for measurement, I'm not sure it warrants an additional bucket, but open to discussion if there's a good case for it.
  • I'm not sure if the "Data type of the profiling counter (used in KTT autotuner)" should have the key type, because that is normally reserved for JSON schema types.
  • For the correctness, can't we just make it a boolean type instead of 0,1 enum?

Regarding compilation_data:

  • I see how these can be useful fields, however, I'm not entirely convinced. There is potential overlap with tunable parameters and it's hard to standardize across programming models. Perhaps we can think of a more flexible format?

This is great work that further enhances the standard, so let's keep the discussion going.

Restructure existing metadata fields into three semantic categories:
- compute: API, platform, device (compute_api renamed to api)
- framework: autotuner, version, backend (shortened field names)
- session: timestamp, timeunit (explicit ISO 8601 format)

Group by purpose instead of keeping one flat bag of keys, so a reader
can tell at a glance which part of a run a field describes. The flat
layout was already getting hard to follow and we are about to add a
lot more metadata on top of it.

Note that metadata.timeunit moves to metadata.session.timeunit, and
that key is read in production. The readers are updated later in this
branch.

All fields remain optional. No functional changes, just cleaner
organization.
Add vendor-neutral accelerators array supporting NVIDIA, AMD, Intel,
and future GPU vendors without schema updates. Each entry contains:
- vendor: string identifier (nvidia, amd, intel, etc.)
- tool: optional query tool name (nvidia-smi, rocm-smi, etc.)
- data: raw tool output as JSON object

Model this as an array rather than vendor-named fields so a host with
two different accelerators, or a vendor we have not heard of yet,
needs no schema change. Keep data unconstrained: every query tool
prints a different shape and the shape moves between tool versions,
and we would rather keep the whole output than normalise it away.

Handles multi-GPU and heterogeneous systems. Required fields: vendor
and data.
Add remaining hardware inventory fields to metadata.hardware:
- cpu: lscpu JSON output (architecture, cores, cache)
- memory: /proc/meminfo parsed (total, free, swap)
- storage: lsblk array (devices, sizes, mounts)
- system: lshw hardware tree (motherboard, buses, peripherals)

Constrain only the container type of each field and leave the keys
inside alone. Writing a normalised schema per tool would mean chasing
every tool's output format forever, and the point of these fields is
to keep what the tool said so a result can be reproduced later.

All fields accept raw tool output as JSON. Privacy note: lshw should
use -sanitize flag to remove serial numbers.
Add metadata.environment with software environment fields:
- os_info: lsb_release output (distro, version, codename)
- hostname: system identifier for multi-node tracking
- python_requirements: dependency list from requirements.txt
- software: key-value object for compiler/library versions

Keep software as a plain name-to-version map: the common case
is exactly that, and a value can still be an object when a tool
needs to record a path or flags.

All fields optional. Software uses additionalProperties for
flexibility with tool-specific metadata.
Add DOI field for archival identifiers. Pattern validates standard
DOI format (10.{registrant}/{suffix}). Examples included for common
repositories: Zenodo, Figshare, OSF.

Validate the format so a resolver URL or a half-copied identifier
gets caught on write instead of on someone else's read.

Optional field typically added post-publication. Provides permanent
citable link to complete dataset.
Update schema description to reflect comprehensive metadata support.
Add a README describing the six metadata categories and their purpose.
Fix a silent 1000x error the metadata reorganization introduced. Both
readers of the time unit still looked for the flat metadata.timeunit
key that moved to metadata.session.timeunit, and metadata does not
forbid unknown keys, so a file written the way the new README says
validated cleanly and then fell through to the "seconds" default. Every
objective time, time budget and curve came out 1000x too large for a
file in milliseconds, 10^9x for nanoseconds, with no warning and
entirely plausible-looking plots.

Add get_T4_timeunit to the formats interface and call it from both
sites. It prefers metadata.session.timeunit and falls back to the flat
key, so files written before the reorganization -- including this
repo's own integration fixture -- keep working.
@jhozzova

Copy link
Copy Markdown
Contributor Author

Hi Floris,
I have updated the schema with a whole lot of other metadata that was in a separate file before as we discussed. It was beginning to be a pain to read, so I have added a bit of organization.
Happy to discuss here or over call.

@jhozzova

jhozzova commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

I'm just going to add one more thing to discuss here, so that I won't forget.

Currently (and actually always), T4 schema has had "compilation_time" field name. KernelTuner has "compilation" and autotuning_methodology had both "compilation" and "compilation_time" in git history. KTT puts "compilation_time" into T4 json (because that's what the schema says), but I don't mind changing it to "compilation" if we agree that it's a default choice and the first thing that comes to mind. No other time field have "_time" appended to them, so it would make it more consistent.

This branch has not been deployed

No deployments
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