diff --git a/content/blog/mlir-with-rust.md b/content/blog/mlir-with-rust.md index 6665a56..a9730d2 100644 --- a/content/blog/mlir-with-rust.md +++ b/content/blog/mlir-with-rust.md @@ -92,7 +92,8 @@ let context = Context::new(); context.append_dialect_registry(®istry); context.load_all_available_dialects(); -// A location is a debug location like in LLVM, in MLIR all operations need a location, even if its "unknown". +// A location is a debug location like in LLVM, in MLIR all +// operations need a location, even if its "unknown". let location = Location::unknown(&context); // A MLIR module is akin to a LLVM module. @@ -102,16 +103,25 @@ let module = Module::new(location); let index_type = Type::index(&context); // Append a `func::func` operation to the body (a block) of the module. -// This operation accepts a string attribute, which is the name. A type attribute, which contains a function type in this case. -// Then it accepts a single region, which is where the body of the function will be, this region can have -// multiple blocks, which is how you may implement control flow within the function. These blocks each can have more operations. +// This operation accepts a string attribute, which is the name. +// A type attribute, which contains a function type in this case. +// Then it accepts a single region, which is where the body +// of the function will be, this region can have +// multiple blocks, which is how you may implement +// control flow within the function. +// These blocks each can have more operations. module.body().append_operation(func::func( &context, StringAttribute::new(&context, "add"), - TypeAttribute::new(FunctionType::new(&context, &[index_type, index_type], &[index_type]).into()), + TypeAttribute::new( + FunctionType::new(&context, &[index_type, index_type], &[index_type]).into() + ), { // The first block within the region, blocks accept arguments - // In regions with control flow, MLIR leverages this structure to implicitly represent the passage of control-flow dependent values without the complex nuances of PHI nodes in traditional SSA representations. + // In regions with control flow, MLIR leverages + // this structure to implicitly represent + // the passage of control-flow dependent values without the complex nuances + // of PHI nodes in traditional SSA representations. let block = Block::new(&[(index_type, location), (index_type, location)]); // Use the arith dialect to add the 2 arguments. @@ -122,7 +132,9 @@ module.body().append_operation(func::func( )); // Return the result using the "func" dialect return operation. - block.append_operation(func::r#return( &[sum.result(0).unwrap().into()], location)); + block.append_operation( + func::r#return( &[sum.result(0).unwrap().into()], location) + ); let region = Region::new(); region.append_block(block);