This Draft PR introduces two new passes: RecordPropertiesPass and InsertPropertiesPass. These passes enable the recording of runtime properties of matrix result objects and the reinsertion of these properties into the IR (Intermediate Representation) during subsequent runs. This process aims to improve optimization and analysis.
Changes:
Property Recording Pass:
Records runtime properties (until now only sparsity) of matrix results during IR transformations.
Leverages a new PropertyLogger to capture and save properties in a JSON file.
Property Insertion Pass:
Reads properties from the JSON file and reinserts them into IR operations, allowing reuse of runtime data.
Supports modifying matrix types in the IR based on the previously recorded properties.
Features:
New Configuration Options:
enable_property_recording: Enables the recording of matrix properties.
enable_property_insert: Enables reinserting properties from a previous run.
properties_file_path: Specifies the path to the JSON file for storing or retrieving matrix properties.
Documentation:
Updated RunningDaphneLocally.md to reflect the new configuration options and command-line flags.
Testing:
Added tests for recording matrix properties inside loops and conditional blocks (scf.for, scf.if, scf.while).
Verified property recording for both dense and sparse matrix types.
Problems:
Issue with property insertion testing: The test for inserting properties in code generation does not work correctly at the moment. The original intention was to invoke the property insertion pass as follows:
This approach did not work as expected, and further work is required to fix the issue.
Loop Argument Sparsity Issue:
I encountered a specific issue where the property insertion pass fails under certain conditions. Here’s an example Daphne script that triggers the error:
Daphne Script:
X = rand(10, 10, 0, 10, 0.29, 42);
Y = rand(10, 10, 0, 10, 0.29, 42);
Z = X + Y + 1e-6;
P = (X + Y)*2 + 1e-6;
k = 10;
for (i in 1:10) {
Z = Z + log(Z, k);
P = P + log(P, k);
}
print(sum(Z));
print(sum(P));
Attention: This is a Draft PR and is still WIP
This Draft PR introduces two new passes:
RecordPropertiesPass
andInsertPropertiesPass
. These passes enable the recording of runtime properties of matrix result objects and the reinsertion of these properties into the IR (Intermediate Representation) during subsequent runs. This process aims to improve optimization and analysis.Changes:
Property Recording Pass:
PropertyLogger
to capture and save properties in a JSON file.Property Insertion Pass:
Features:
enable_property_recording
: Enables the recording of matrix properties.enable_property_insert
: Enables reinserting properties from a previous run.properties_file_path
: Specifies the path to the JSON file for storing or retrieving matrix properties.Documentation:
RunningDaphneLocally.md
to reflect the new configuration options and command-line flags.Testing:
scf.for
,scf.if
,scf.while
).Problems:
This approach did not work as expected, and further work is required to fix the issue.
Loop Argument Sparsity Issue: I encountered a specific issue where the property insertion pass fails under certain conditions. Here’s an example Daphne script that triggers the error:
Daphne Script:
Error Output:
The issue is still under investigation, and further debugging is required to find a proper solution.