//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
// (C) COPYRIGHT 2023-2024 ARM Limited
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorised
// copies and copies may only be made to the extent permitted
// by a licensing agreement from ARM Limited.

=== Variable Operators

TOSA implements three variable operators for expressing persistent mutable values across multiple TOSA graph invocations.

==== VARIABLE

Defines a new TOSA variable.
This is a persistent mutable value across multiple TOSA graph invocations.
Modifications are expressed using read/write semantics.

include::{generated}/operators/VARIABLE.adoc[]

[source,c++]
----
include::{pseudocode}/operators/VARIABLE.tosac[lines=10..-1]
----

==== VARIABLE_WRITE

Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.

include::{generated}/operators/VARIABLE_WRITE.adoc[]

[source,c++]
----
include::{pseudocode}/operators/VARIABLE_WRITE.tosac[lines=10..-1]
----

==== VARIABLE_READ

Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.

include::{generated}/operators/VARIABLE_READ.adoc[]

[source,c++]
----
include::{pseudocode}/operators/VARIABLE_READ.tosac[lines=10..-1]
----
