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

namespace MVCNN;

table TimerTask{
  // This is a placeholder Task.
  // A task to get a timer reading. This can be used for reporting profile information.
  id: uint;
  write_location: TensorReference;
}

table BarrierConfigurationTask{
  // A task to configure the setup for a barrier.
  // An alternative method to dynamic barrier management.
  // If you are scheduling with these tasks, you do not need to
  // instanciate the barrier_table of the main graphfile object.
  // If you wish to access the barriers to this particular task, check the
  // generic task BarrierReference.
  target: Barrier;
}

table AddToNCE2CMXBacklogTask{
  // A task to refill the NN CMX with more work
  // so that the runtime can continue to process without waiting to reload.
  // Tasks' IDs to load in CMX when executing this management task
  id: uint;
  tasks: [uint];
}

table AddToSHVCMXBacklogTask{
  // A task to refill the NN CMX with more work
  // so that the runtime can continue to process without waiting to reload.
  // Tasks' IDs to load in CMX when executing this management task
  id: uint;
  tasks: [uint];
}


table AddToNNDMABacklogTask{
  // A task to refill the memory area containing NNDMA tasks
  // so that the DMA engine can continue to process without waiting to reload.
  id: uint;
  // Tasks' IDs to load in CMX when executing this management task
  tasks: [uint];
}

table EmptyTask{
  // This task is provided as all barriers need to trigger 'some'
  // mananagement task. If there is no action required, they
  // can trigger this.
  id: uint;
}

table NNStartSHVTask{
  // This task will trigger a shave to start executing its currently loaded kernel
  id: uint;
}

table NNEndSHVTask{
  // This task will trigger a shave to cease and be free to load its next work.
  id: uint;
}

union ControllerSubTask{
  TimerTask,
  BarrierConfigurationTask,
  AddToNCE2CMXBacklogTask,
  AddToNNDMABacklogTask,
  NNStartSHVTask,
  NNEndSHVTask,
  EmptyTask,
  AddToSHVCMXBacklogTask,
}

table ControllerTask {
  task: ControllerSubTask;
}
