2.2.0
c_info.json code-generation output report


ST Edge AI Core

c_info.json code-generation output report


ST Edge AI Core Technology 2.2.0



r1.0

This article shows a brief example on how to use the generated c_info.json output files before presenting their structure (i.e. the associated json schema).

Usage of the output file

A very simple example of such file is provided here:
(the example uses a file created when generating code for Neural-Art target, but the same process for searching information applies on other targets)

This example has been generated by doing a “generate” on a small model to be tested on stm32n6 with Neural-Art enabled. This command generates a file st_ai_output/network_c_info.json:

stedgeai generate -m MYMODEL.tflite --target stm32n6 --st-neural-art my_profile@user_neural_art.json

It has then been completed by a “validate” step done by the user after loading the proper validation project on board.

stedgeai validate –m MYMODEL.tflite --target stm32n6 --mode target --desc serial:921600 --val-json st_ai_output/network_c_info.json

Below are shown a few information that can be found digging into this json file.

Generation information

Information about generation steps can be found in the environment key.
In the example above, it is possible to see that the generation corresponding to this file was done with a model model__2025_04_16-16_09_48.tflite, that the generation requested a “generate” for stm32n6 with use of the Neural-Art. It is noted that the user requested to use the --no-inputs-allocation, so the tool should not allocate space for the inputs, it is the duty of the user to do so.
The options used for the Neural-Art compiler were (among others): --mvei --cache-maintenance --enable-virtual-mem-pools --native-float --Ocache-opt --all-buffers-info --encrypt-weights

Memory usage

Looking at the memory_pools part of the json provided, one can see that the user provided two memory pools:

  • cpuRAM2 @ [0x34100000 - 0x34200000]
    • contains buffers 1,2,3,4,5
    • all buffers use up to 10.048kB (=10289 bytes)
  • octoFlash @ [0x71000000 - 0x78000000].
    • contains buffers 6,7,8,9
    • all buffers take 193 bytes
    • all buffers from offset 0 to offset 193 bytes are encrypted. (see "attributes":"encryption")
  • An additional pool is found in the json file (added in the file by the tools because the user requested to use --no-inputs-allocation )
    • This pool is not allocated by the tools (see "user_allocated": true)
    • This pool has no address allocated by the tool
    • This pool has a total size of 6144 (which is the size of the input buffer, as we will see below)

Finding characteristics of the I/O buffers of a model

An easy and efficient way to find where are the input/output buffers located is to:

  • Read the graphs entry of the json
  • At the current time, the first item always represent the main graph of execution.
  • In the first graph, look at the inputs and outputs entries: those are the links to buffer IDs (to be found in the buffers part of the JSON file)

In the example above, it is easy to see that the only input buffer is buffer with ID=10, the only output buffer is the buffer with ID=1.
Following the tracks… to the buffer part of the json, looking for buffers where "id"=1 and "id"=10, we find that:

  • Output buffer (id=1)
    • has a shape of [1,32,64,5]
    • is 10240 bytes (10kB)
    • is stored in memory pool with id=1: cpuRAM2, at offset 0 from the base of cpuRAM2.
  • Input buffer (id=10) – this one is a bit special because it is not allocated by the tools
    • has a shape of [1, 32, 64, 3]
    • is 6144 bytes long
    • is stored in memory pool with id=3 (the one presented above, containing user-allocated buffers)

Checking validation on target scores

As a validation has been done on this code, it is possible to find “scores” for the validation by looking at the validation entry.

For this model, we can see that the model seems to be well supported by the tools: for the only output it has, it is observed that when fed with the same inputs, and comparing the outputs of the original “tflite” model vs the outputs of the c-model-generated-by-stedgeai, the error is low. In particular, the cos metric (cosine similarity) is very close to 1, and l2r (L2 relative error) is very close to 0.

Fields description of the file

Overview

This section provides a detailed description of the JSON schema for the unified networks output format. The schema is designed to standardize the output format for tools information, ensuring consistency and ease of use.

Properties

Main properties are detailed here, a lot of them use references to objects defined in the Definitions part below.
All the “Description” lines can be unfolded to show greater details about the contents of each part of the JSON file.

json_schema_version

Description: Specifies the version of the JSON schema.
  • Type: string
  • Pattern: ^[0-9]+\.[0-9]+
  • Examples: ["1.2", "1.2.3"]

environment

Description: Information related to the used environment.

buffers

Description: Description of all allocated buffers.

graphs

Description: List of all graphs of the network as an array.

memory_pools

Description: Description of all memory pools and their contents.

memory_accesses

Description: Description of memory accesses per epoch per memory pool.

power_estimates

Description: Description of power consumption per epoch.

validation

Description: Description of model validation.
  • Type: object
  • Properties:
    • device: Where was the validation performed?
      • Type: string
      • Enum: ["VALIDATION_HOST", "VALIDATION_SIMULATOR", "VALIDATION_TARGET"]
    • val_error: Validation error.
      • Type: number
    • val_error_desc: Validation error description.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • val_metrics: Validation metrics.
  • Required: ["device", "val_metrics"]

memory_footprint

Description: Description of memory footprint.
  • Type: object
  • Properties:
    • activations: Activation size in bytes.
      • Type: integer
    • weights: Weights size in bytes.
      • Type: integer
    • io: Array of size 2 containing respectively input size and output size, in bytes.
      • Type: array
      • Items: integer
    • kernel_flash: Kernel flash in bytes.
      • Type: integer
      • Minimum: 0
    • kernel_ram: Kernel RAM in bytes.
      • Type: integer
      • Minimum: 0
    • series: Series name.
      • Type: string
    • toolchain: Toolchain used.
      • Type: string
    • toolchain_flash: Toolchain flash used in bytes.
      • Type: integer
    • toolchain_ram: Toolchain RAM used in bytes.
      • Type: integer

aton_execution_time

Description: When doing validation with Neural-Art, time spent on each step during inference.

Definitions ($defs)

original_details

Description: Details of original inputs/outputs data type & shape.
  • Type: object
  • Properties:
    • name: Original layer name.
      • Type: string
    • data_format: Details of IO data formats.
      • Type: object
      • Properties:
        • quantizer: Original IO quantizer type.
          • Type: string
          • Enum: ["NONE", "DOREFA", "UNIFORM"]
        • scale: Original IO scale.
          • Type: array
          • Items: number
        • zero: Original IO zero.
          • Type: array
          • Items: integer
        • type: Original IO type.
          • Type: string
          • Enum: ["FLOAT", "LUT_FLOAT", "SIGNED", "UNSIGNED", "BOOL", "STRING"]
        • size: Original IO type size.
          • Type: integer
    • shape: Original IO shapes.
      • Type: array
      • Items: integer
    • shape_map: Original IO shapes map.
      • Type: array
      • Items: string
    • c_shape_map: C-model IO shapes map.
      • Type: array
      • Items: string

exec_time

Description: Details of execution per node or per graph.
  • Type: object
  • Properties:
    • counters: Counters per node.
      • Type: array
      • Items: integer
    • cycles: Cycles per node.
      • Type: integer
    • cycles_by_macc: Cycles by MACC per node.
      • Type: number
    • duration_ms: Inference time per node (ms).
      • Type: number
    • percentage: Percentage of execution time per node.
      • Type: number

environment_desc

Description: Info related to the used environment.
  • Type: object
  • Properties:
    • tools: List of used tools.
    • generated_model:
    • network_signature: Unique Identifier of generated network model.
      • Type: string
    • target: Description of the target device used for generation.
      • Type: string
    • test_name: Name of the test performed.
      • Type: string
  • Required: ["tools", "generated_model", "network_signature"]

file_desc

Description: Descriptors for the files generated.
  • Type: object
  • Properties:
    • name: Model Filename.
      • Type: string
    • signature: Unique Identifier of the file.
      • Type: string

model_desc

Description: Descriptors for the initial model.
  • Type: object
  • Properties:
    • name: Model name (Optional).
      • Type: string
    • type: Model type.
      • Type: string
    • size: Original IO type size.Model size.
      • Type: integer
    • n_params: Model number of parameters.
      • Type: integer
    • model_files:
    • generated_time: Time of launch of the tool.
      • Type: string
      • Format: date-time
      • Examples: ["2025-03-20T16:19:49+0100", "%Y-%m-%dT%H:%M:%S%z"]
  • Required: ["model_files"]

tool_desc

Description: Used tools descriptors.
  • Type: object
  • Properties:
    • name: Tool name.
      • Type: string
    • version: Version number starts with 3-dot-separated-numbers.
      • Type: string
      • Pattern: ^[0-9]+\.[0-9]+\.[0-9]
      • Examples: ["1.2.3", "2.3.5-985"]
    • arguments: Arguments/parameters given to the tool.
      • Type: string
    • environment: Environment used to call the tool.
      • Type: array
      • Items: string
    • input_model:
  • Required: ["name", "version", "arguments", "input_model"]

val_metrics

Description: Validation metrics.
  • Type: object
  • Properties:
    • acc: Validation accuracy.
      • Type: string
      • Pattern: ^(\\d+(\\.\\d+)?%)
    • cos: Cosine Similarity, bigger is better, best=1, range=(0, 1].
      • Type: number
    • desc: Validation description.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • l2r: L2 relative error.
      • Type: number
    • mae: Mean Absolute Error.
      • Type: number
    • mean: Mean value.
      • Type: number
    • nse: Nash-Sutcliffe efficiency criteria, bigger is better, best=1, range=(-inf, 1].
      • Type: number
    • rmse: Root Mean Squared Error.
      • Type: number
    • std: Standard deviation.
      • Type: number

mempool

Description: Description of a memory pool & its contents.
  • Type: object
  • Properties:
    • name: Memory pool name.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • fname: Memory pool initializer filename.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_ .-]+$
    • id: Mempool unique identifier.
      • Type: integer
    • alignment: Pool address alignment in bytes.
      • Type: integer
      • Minimum: 1
    • address: When ‘NULL’ or symbol means usemod relative, decimal number >= 0 is absolute.
      • Type: string
    • offset_start: Offset in the memory where the pool starts.
      • Type: integer
    • size_bytes: Full available size of the memory pool, in bytes. -1 means the pool is created by tool.
      • Type: integer
      • Minimum: -1
    • used_size_bytes: Total allocated size used in the memory pool, in bytes.
      • Type: integer
      • Minimum: 0
    • rights: Equivalent of TargetDescription.mem_access in Target Description Protocol Documentation.
      • Type: string
      • Enum: ["ACC_UNDEF", "ACC_READ", "ACC_WRITE"]
    • cacheable: Equivalent of TargetDescription.cacheable_val in Target Description Protocol Documentation.
      • Type: string
      • Enum: ["CACHEABLE_UNDEF", "CACHEABLE_ON", "CACHEABLE_OFF"]
    • pipelined: Equivalent of TargetDescription.pipelined_val in Target Description Protocol Documentation.
      • Type: string
      • Enum: ["PIPELINED_UNDEF", "PIPELINED_ON", "PIPELINED_OFF"]
    • user_allocated: Is the memory pool corresponding to a user-allocated memory region?
      • Type: boolean
    • persistent: A persistent memory pool shall not be modified between inferences.
      • Type: boolean
    • attributes: Additional properties (extra-info that are not mandatory).
      • Type: object
      • Properties:
        • throughput: Equivalent of TargetDescription.mem_prop_level in Target Description Protocol Documentation.
          • Type: string
          • Enum: ["UNDEF", "LOW", "MID", "HIGH"]
        • latency:
          • Type: string
          • Enum: ["UNDEF", "LOW", "MID", "HIGH"]
        • byte_width: Memory bus access width.
          • Type: integer
          • Minimum: 0
        • freq_ratio: Memory frequency ratio compared to accelerators.
          • Type: number
          • Minimum: 0
        • burst_max_length: Max Burst length.
          • Type: integer
          • Minimum: 0
        • burst_penalty: Initial Burst Penalty (# of memory clock cycles).
          • Type: integer
          • Minimum: 0
        • read_power: Active read power for a single byte_width access in mW.
          • Type: number
          • Minimum: 0
        • write_power: Active write power for a single byte_width access in mW.
          • Type: number
          • Minimum: 0
        • use_for_initrs:
          • Type: boolean
        • score:
          • Type: integer
          • Minimum: 0
        • encryption: Encryption properties (one range per memory pool).
          • Type: object
          • Properties:
            • offset:
              • Type: integer
              • Minimum: 0
              • Description: Offset in the memory pool for the first encrypted data address.
            • size:
              • Type: integer
              • Minimum: 0
              • Description: Size of the encrypted data in bytes.
      • Required: ["throughput", "latency", "score"]
    • subpools: In case of merged pools, list of contained pools IDs.
      • Type: array
      • Items: integer
    • buffers: Array of buffers that are placed within the memory pool.
      • Type: array
      • Items: integer
  • Required: ["name", "id", "alignment", "address", "offset_start", "size_bytes", "used_size_bytes", "buffers", "user_allocated", "persistent"]

buffer

Description: Description of a buffer properties.
  • Type: object
  • Properties:
    • name: Buffer name.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • id: Buffer unique identifier. In C models, it is equal to the id passed by the inspection callback routine.
      • Type: integer
    • alignment: Buffer alignment in bytes.
      • Type: integer
      • Minimum: 1
    • mpool_id: ID of the pool where the buffer is allocated.
      • Type: integer
    • offset_start: Memory offset in bytes where the buffer starts. Relative address in memory.
      • Type: integer
      • Minimum: -1
    • size_bytes: Size in bytes of the buffer.
      • Type: integer
      • Minimum: 0
    • is_param: True if the buffer is used for parameters, false if used for activations.
      • Type: boolean
    • flags: A list of flags separated by | character.
      • Type: string
    • epochs: Epoch number the buffer is used in.
      • Type: object
      • Properties:
        • start: Epoch start value.
          • Type: integer
          • Minimum: 0
        • end: Epoch end value.
          • Type: integer
          • Minimum: 0
    • shape: Shape of the buffer.
      • Type: array
      • Items: integer
    • shape_map: Shape map labels of the buffer.
      • Type: array
      • Items: string
    • channel_first: Is the buffer channel first?
      • Type: boolean
    • channel_last: Is the buffer channel last?
      • Type: boolean
    • batch: Used only if channel_first/last=false.
      • Type: integer
      • Minimum: 0
    • format: Buffer element format.
      • Type: string
      • Pattern: ^STAI_FORMAT_
    • nbits: Number of bits for each entry.
      • Type: integer
      • Minimum: 0
    • qmn: Qmn format descriptor. The sum of sign, m, and n values gives the actual bit size of the format.
      • Type: object
      • Properties:
        • m: Number of bits for the integer part (excluding sign bit).
          • Type: integer
        • n: Number of fractional bits.
          • Type: integerNumber of fractional bits.
        • sign: Signed or not?
          • Type: integer
          • Minimum: 0
          • Maximum: 1
    • intq:
      • Type: object
      • Properties:
        • axis: If -1: quantization per tensor. Otherwise, axis of the channels.
          • Type: integer
          • Minimum: -1
        • scales: Scale factors for the current buffer (float values).
          • Type: array
          • Items: number
        • offsets: Offset values for the current buffer.
          • Type: array
          • Items: integer
  • Required: ["name", "id", "alignment", "offset_start", "size_bytes", "is_param", "epochs", "shape", "format", "nbits"]

graph_edge

Description: Description of an edge (object to show data flow between a buffer and a node, or between a node and a node).
  • Type: object
  • Properties:
    • name: Name of the edge.
      • Type: string
    • id: Edge unique identifier.
      • Type: integer
    • edge_kind: Kind of edge: FLOW (just dependency), MEMORY (with associated buffer allocated), and INTERNAL (internal communication between Accelerators).
      • Type: string
      • Enum: ["EDGE_UNDEF", "EDGE_FLOW", "EDGE_MEMORY", "EDGE_INTERNAL"]
    • buffer: For MEMORY edge identifies the buffer used.
      • Type: integer
    • start:
      • Type: object
      • Properties:
        • node_id: Origin Node graph reference.
          • Type: integer
        • port: Output port number.
          • Type: integer
    • end:
      • Type: object
      • Properties:
        • node_id: Target Node graph reference.
          • Type: integer
        • port: Input port number.
          • Type: integer
    • attributes: A dictionary of additional information to show as-is when showing the graph on a display.
      • Type: object
      • Properties:
        • additional_info: Add any info for specifying edge properties here.
          • Type: string
  • Required: ["id", "start", "end", "edge_kind"]

graph_node

Description: Graph description - an ordered list of steps to be drawn within a box of the graph representation.
  • Type: object
  • Properties:
    • name: Name of the node.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • id: Node unique identifier.
      • Type: integer
    • inputs: Input Buffer IDs.
      • Type: array
      • Items: integer
    • outputs: Output Buffer IDs.
      • Type: array
      • Items: integer
    • scratchs: Scratch Buffer IDs.
      • Type: array
      • Items: integer
    • subgraph_nodes: All sub-nodes belonging to the current graph.
    • mapping: Specifies if mapped on SW, on HW, on EpochController, or hybrid SW/HW.
      • Type: string
      • Enum: ["NODE_UNDEF", "NODE_SW", "NODE_HW", "NODE_SW_HW", "NODE_EC"]
    • macc: Total MACC number for the current graph node.
      • Type: integer
      • Minimum: 0
    • original_nodes: List of IDs of the original model nodes (applicable for layers, for example).
      • Type: array
      • Items: Original model id or name as a string. May be postfixed with :<node_part>.
        • Type: string
    • exec_time:
    • description: Description of the graph node (can be a layer type, for example, or epoch, or …).
      • Type: string
    • attributes: A map key-value strings where key is the name of the attribute.
      • Type: object
      • AdditionalProperties: string
    • sw_functions: List of SW functions mapping the node (Available only on NODE_SW or NODE_SW_HW types).
      • Type: array
      • Items: string
  • Required: ["name", "id", "inputs", "outputs", "scratchs", "mapping", "macc", "subgraph_nodes"]

graph

Description: Description of a network graph.
  • Type: object
  • Properties:
    • name: Name of the graph.
      • Type: string
      • Pattern: ^[a-zA-Z0-9_]+$
    • id: Graph unique identifier.
      • Type: integer
    • inputs: Graph Input Buffer IDs.
      • Type: array
      • Items: integer
    • outputs: Graph Output Buffer IDs.
      • Type: array
      • Items: integer
    • nodes: A list of graph nodes entries.
    • edges: A list of graph edges entries.
    • exec_time:
    • original_inputs: A list of original inputs.
    • original_outputs: A list of original outputs.
  • Required: ["name", "id", "inputs", "outputs", "nodes", "edges"]

memory_access

Description: Memory accesses per epoch. (only relevant for Neural-Art)
  • Type: object
  • Properties:
    • node_id: Node graph reference.
      • Type: integer
    • mpool_id: Memory Pool reference.
      • Type: integer
    • reads: Number of reads.
      • Type: integer
      • Minimum: 0
    • read_cycles: Number of cycles used for read operations.
      • Type: integer
      • Minimum: 0
    • writes: Number of writes.
      • Type: integer
      • Minimum: 0
    • write_cycles: Number of cycles used for write operations.
      • Type: integer
      • Minimum: 0

aton_exec_t

Description: Detail of the time spent on one epoch during inference on Neural-Art. (only relevant for Neural-Art)
  • Type: object
  • Properties:
    • counters: Array of size 3 containing the time spent in pre-hw, hw and post-op phases (in cycles)
      • Type: array
      • Items: integer
    • cycles: Total number of cycles spent on an epoch
      • Type: integer
    • duration_ms: Time spent on an epoch (in ms)
      • Type: float
    • percentage: Percentage of the total inference time spent in this epoch
      • Type: float
    • cycles_by_macc: (deprecated) Total number of cycles spent by macc (only applicable for sw epochs)
      • Type: integer

power_estimate

Description: Power-related data per epoch (only relevant for Neural-Art)
  • Type: object
  • Properties:
    • node_id: Node graph reference.
      • Type: integer
    • ops: Total ops number.
      • Type: integer
      • Minimum: 0
    • compute_cycles: Number of cycles used for computation.
      • Type: integer
      • Minimum: 0
    • max_cycles: Maximum cycles.
      • Type: integer
      • Minimum: 0
    • average_acc_power_mw: Average Accelerators (e.g., ATON) power used in mW.
      • Type: integer
      • Minimum: 0
    • average_memory_power_mw: Average power (in mW) used for accessing the memories.
      • Type: integer
      • Minimum: 0