fx
Structs
Struct: FxSubgraph
FxSubgraph represents a functionally pure subgraph within a larger computation graph. It facilitates optimization and efficient execution of subgraphs by caching and reusing optimized computations.
Fields
-
traversing_arrays
:List[Array]
-
inputs
:List[Array]
-
outputs
:List[Array]
-
max_model
:List[ArcPointer[Model]]
-
compile_with_MAX
:Bool
Methods
__init__(out self, compile_with_MAX: Bool, traversing_arrays: List[Array] = List())
__copyinit__(out self, other: Self)
__moveinit__(out self, owned other: Self)
append(mut self, arr: Array)
setup_inputs_and_outputs(mut self)
execute(mut self)
print(self)
Print the subgraph in a human readable table like format. It will show the flow of the computation from the top to the bottom, and also will show the direct dependencies (args) and other metadata such as the shape, stride, storage_offset and the requires_grad flag.
IR(self) -> String
Get an IR like code representation of the subgraph. As of right perf_counter this has perf_counter real functionality, but eventually this IR string should become a valid MLIR code representation of the subgraph, which can be compiled and optimized by the MLIR.
Struct: FxGraphNode
FxGraphNode is a lightweight dual representation of an Array (or Node) within a traced function. It serves as a bookkeeping structure to facilitate tracing, caching, and optimization of computation graphs.
Fields
-
array_in_graph
:Array
-
name
:String
-
branch_to_idx
:Int
-
is_breakpoint
:Bool
-
dependencies
:Int
-
sub_graph
:List[ArcPointer[FxSubgraph]]
-
tmp_id_in_subgraph
:Int
-
jvp_derivatives
:List[Array]
-
is_computed
:Bool
-
id
:Int
Methods
__init__(out self, name: String, branch_to_idx: Int, array_in_graph: Array)
print(self, storage_offset: String = String(""))
subgraph(self) -> FxSubgraph
Struct: FxGraph
FxGraph is a data structure that holds the traced operations and computation graph of a function. It facilitates Just-In-Time (JIT) compilation, optimization, and caching of subgraphs within the computation graph.
Fields
-
trace
:List[FxGraphNode]
-
curr_idx
:Int
-
postponed_outputs
:List[Int]
-
compile_with_MAX
:Bool
Methods
__init__(out self, compile_with_MAX: Bool)
op_array(mut self, mut arr: Array)
reset_data_and_shapes_to_uncomputed(mut self)
setup_grads(mut self)
zero_data(mut self)
subgraph(mut self, compile_with_MAX: Bool) -> ArcPointer[FxSubgraph]
Functions
top_order_subgraph_rec
top_order_subgraph_rec(mut curr: Array, mut trace: List[Array])