// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
include "memoryManagement.fbs";

namespace MVCNN;

struct DMADescriptorReference {
  /// Information of actual DMA descriptor that generate from compiler
  // Total Number of Bytes to transfer per plane
  len : uint;

  // Width in bytes of data required from line of source.
  src_width : uint;

  // Distance expressed in bytes from start of one line of source data
  // to start of next line of source data. 
  src_stride : uint;

  // Displacement in bytes from the start address of one source plane
  // to the start of the next source plane. 
  src_plane_stride : uint;

  // Width in bytes of data written to destination
  dst_width : uint;

  // Distance expressed in bytes from start of one line of destination
  // data to start of next line of destination data. 
  dst_stride : uint;

  // Displacement in bytes from the start address of one destination
  // plane to the start of the next destination plane. 
  dst_plane_stride : uint;

  // In 3D mode several planes of data may be moved. This field holds the number of planes. 
  num_planes : uint;
}

table NNDMATask {
  /// The NNDMA has a few additional features.
  /// multiple destination tensors represents copy to several locations
  /// on device it can be DMA bradcast
  src : TensorReference;
  dst : TensorReference;

  /// The NNDMA also has support for compression while transferring.
  /// This is a simple on/off switch for the feature.
  compression: bool;

  /// DMA port which the DMA task will execute on
  port: ubyte;

  // If true, the DMA should have the ORD bit set, forcing in-order execution
  set_ord: bool = false;

  // If true, the DMA should have the CRT bit set, indicating that the DMA is
  // of critical importance.
  set_crit: bool = false;

  // NNDMATask transaction type details 
  descriptor : DMADescriptorReference;

  // Represents the offset from the dma_hwp_base (see fileHeader.fbs) in multiples of DMA perf payload packet size
  dma_hwp_id: int32 = 0;

  // Optional field, used for the Activation Spill Compression/Decompression Flow.
  act_compression_size_entry: TensorReference;
}
