Skip to content
Snippets Groups Projects
Commit 89da3b8f authored by Russel Arbore's avatar Russel Arbore
Browse files

Fix partition verification

parent 6753ddb1
No related branches found
No related tags found
1 merge request!24Handle arrays properly in the runtime (part 1)
...@@ -180,13 +180,19 @@ pub fn verify_manifest(manifest: &ModuleManifest) -> Result<(), String> { ...@@ -180,13 +180,19 @@ pub fn verify_manifest(manifest: &ModuleManifest) -> Result<(), String> {
.map(|manifest| { .map(|manifest| {
// First, check that all partitiion data inputs get used, and that // First, check that all partitiion data inputs get used, and that
// all partition data outputs are produced. // all partition data outputs are produced.
let all_data_inputs = function_partition_inputs(manifest); let mut all_data_inputs = function_partition_inputs(manifest);
let all_data_outputs = function_partition_outputs(manifest); let all_data_outputs = function_partition_outputs(manifest);
// Data outputs include values returned from the overall function. // Data outputs include values returned from the overall function.
// These are obviously not used by another partition, but that's // These are obviously not used by another partition, but that's
// fine. Remove them here explicitly. // fine. We add these artificially as "inputs" to a partition so
let all_data_outputs = all_data_outputs.into_iter().filter(|idx| !manifest.returned_values.contains(idx)).collect::<Vec<NodeID>>(); // that this check still passes. We don't just remove the returned
// value from the data outputs because it might also be the
// legitimate output of another partition, and doing that would
// cause a false negative.
all_data_inputs.extend(&manifest.returned_values);
all_data_inputs.sort();
all_data_inputs.dedup();
if all_data_inputs != all_data_outputs { if all_data_inputs != all_data_outputs {
return Err(format!("PANIC: Partitions in manifest contain inconsistent data inputs and data outputs of partitions.\nHere are the data input IDs:\n{:?}\nHere are the data output IDs:\n{:?}\n", all_data_inputs, all_data_outputs)); return Err(format!("PANIC: Partitions in manifest contain inconsistent data inputs and data outputs of partitions.\nHere are the data input IDs:\n{:?}\nHere are the data output IDs:\n{:?}\n", all_data_inputs, all_data_outputs));
} }
...@@ -194,8 +200,10 @@ pub fn verify_manifest(manifest: &ModuleManifest) -> Result<(), String> { ...@@ -194,8 +200,10 @@ pub fn verify_manifest(manifest: &ModuleManifest) -> Result<(), String> {
// Next, check that partitions contain multiple successors if and // Next, check that partitions contain multiple successors if and
// only if a control indicator is present in their outputs. // only if a control indicator is present in their outputs.
// TODO: this will fail to verify a partition with a return node and // TODO: this will fail to verify a partition with a return node and
// a single successor partition, which technically is allowed. Deal // a single successor partition, which technically is allowed. In
// with this later. // this scenario, a control indicator is required (to tell if we
// should return or advance the control token), but there is only
// one successor partition. Deal with this later.
manifest.partitions.iter().map(|manifest| { manifest.partitions.iter().map(|manifest| {
let multiple_successors = manifest.successor_partitions.len() > 1; let multiple_successors = manifest.successor_partitions.len() > 1;
let control_indicator = manifest.outputs.contains(&PartitionOutput::ControlIndicator); let control_indicator = manifest.outputs.contains(&PartitionOutput::ControlIndicator);
......
...@@ -48,7 +48,7 @@ fn generate_type_string(ty: &Type, rust_types: &Vec<String>) -> String { ...@@ -48,7 +48,7 @@ fn generate_type_string(ty: &Type, rust_types: &Vec<String>) -> String {
+ ")" + ")"
} }
Type::Summation(_) => todo!(), Type::Summation(_) => todo!(),
Type::Array(elem, _) => format!("::std::boxed::Box<[{}]>", &rust_types[elem.idx()]), Type::Array(elem, _) => format!("*mut {}", &rust_types[elem.idx()]),
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment