Skip to content

Commit

Permalink
fix vhlo DictionaryAttr's printer with separated comma (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyunqu authored Oct 25, 2023
1 parent 43e51a7 commit 89ea02e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions stablehlo/dialect/VhloOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ Attribute IntegerV1Attr::parse(AsmParser& parser, mlir::Type) {
static void printAttributeDictionary(
AsmPrinter& os, ArrayRef<std::pair<Attribute, Attribute>> values) {
os << '{';
for (auto nvp : values) {
os << nvp.first << " = " << nvp.second;
}
llvm::interleaveComma(
values, os, [&](auto nvp) { os << nvp.first << " = " << nvp.second; });
os << '}';
}

Expand Down
6 changes: 6 additions & 0 deletions stablehlo/tests/stablehlo_legalize_to_vhlo.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ func.func @attr_custom_call_api_version_status_returning_unified(%arg0: tensor<f
}
// CHECK-LABEL: "attr_custom_call_api_version_status_returning_unified"

// CHECK: #vhlo.dict_v1<{#vhlo.string_v1<"attr1"> = #vhlo.integer_v1<1 : i32>, #vhlo.string_v1<"attr2"> = #vhlo.integer_v1<2 : i32>}
func.func @attr_dict() attributes {stablehlo.attr = {attr1 = 1 : i32, attr2 = 2 : i32}} {
return
}
// CHECK-LABEL: "attr_dict"

// DotDimensionNumbers aka #stablehlo.dot is covered below.

func.func @attr_fft_type_fft(%arg0: tensor<16xcomplex<f32>>) -> tensor<16xcomplex<f32>> {
Expand Down

0 comments on commit 89ea02e

Please sign in to comment.