===========================
NPU Profiler: Neuron Studio
===========================
Overview
========
`Neuron Studio` is an Integrated Development Environment (IDE) and AI toolkit designed to help the developer develop and optimize AI models on MediaTek platforms.
.. figure:: /_asset/ai-workflow-overview-step4.png
:align: center
:width: 80%
.. raw:: html
Supported Platforms and OS
--------------------------
* **Supported Platforms:** `Genio 720-EVK (MT8391)`, `Genio 520-EVK (MT8371)`.
* **Supported OS:** `Android`.
Profiling Capabilities
----------------------
The tool monitors the following performance metrics to help identify bottlenecks:
* **NPU Frequency:** Displays the operational clock speed of the hardware engines during inference.
* **NPU Loading:** Represents the utilization percentage, indicating the workload intensity on the NPU cores.
* **DRAM Utilization:** Monitors the memory occupancy required for model tensors and intermediate buffers.
* **DRAM Bandwidth:** (Not supported). To obtain memory resource information, the developer must contact a MediaTek representative to request the `MediaTek Evaluation Tool (MET)`.
.. figure:: /_asset/neruon_studio_profile.png
:alt: Profile Overview of Neuron Studio
:align: center
:width: 80%
Profile Overview
Installation
============
1. **Download the Android NDK.**
Obtain the NDK from the `official Android NDK download page `_.
2. **Obtain Neuron Studio.**
Contact the MediaTek representative to request the `Neuron Studio` installation package.
3. **Configure Neuron Studio.**
* Execute ``neuron-studio.exe``.
* Configure the Android NDK path: Navigate to ``File`` -> ``Settings`` -> ``Android NDK``, click ``+New``, select the NDK folder, and click ``OK``.
* Restart `Neuron Studio` to apply the changes.
Profiling Workflow
==================
1. **Connect the device.**
Connect the Genio platform to the host PC using a Type-C cable via the Android Debug Bridge (ADB).
2. **Enable root access.**
.. code-block:: bash
adb root
3. **Record the trace.**
* In the `Neuron Studio` interface, navigate to ``Profile`` -> ``Record`` -> ``MediaTek Devices on ADB`` and select the target device (e.g., ``mtxxxx``).
* Run the target AI workload, such as a benchmark or application.
* Stop the recording to display the trace and save the results as a ``.json`` file.
4. **Analyze the results.**
The developer can perform analysis using the `Neuron Studio` interface or external tools such as `Perfetto`.