Skip to content

Commit a44954e

Browse files
committed
Add MLIR test file (#1044)
1 parent 1dbf2b7 commit a44954e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

source/mlir.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,13 @@ mlir.Parser = class {
937937
if (op.name.endsWith('.call') || op.name.endsWith('.generic_call')) {
938938
this.parseSymbolName('callee', op.attributes);
939939
}
940-
if (op.name === 'arith.cmpi') {
940+
if (op.name === 'arith.cmpi' || op.name.endsWith('.contract')) {
941941
if (this._match('id')) {
942-
op.attributes.push({ name: 'predicate', value: this._read() });
943-
this._read(',');
942+
const list = [];
943+
do {
944+
list.push(this._read());
945+
} while (this._eat(',') && this._match('id'));
946+
op.attributes.push({ name: 'predicate', value: list });
944947
}
945948
}
946949
if (op.name.endsWith('.func')) {
@@ -1038,7 +1041,7 @@ mlir.Parser = class {
10381041
// dictionary-attribute?
10391042
// condition: start with `{`, end with `}`
10401043
if (this._match('{')) {
1041-
if (op.attributes.length === 0) {
1044+
if (op.attributes.length === 0 || (op.attributes.length === 1 && op.attributes[0].name === 'predicate')) {
10421045
this.parseAttributeDict(op.attributes);
10431046
} else {
10441047
const region = {};
@@ -1248,6 +1251,9 @@ mlir.Parser = class {
12481251
const value = this._parseValue();
12491252
input.type = value.type;
12501253
input.value = value.value;
1254+
if (open && this._eat(':')) {
1255+
input.type = this._parseType();
1256+
}
12511257
}
12521258
inputs.push(input);
12531259
if (!this._eat(',')) {
@@ -1267,6 +1273,7 @@ mlir.Parser = class {
12671273
this._token.value === 'i64' ||
12681274
this._token.value === 'si64' ||
12691275
this._token.value === 'f32' ||
1276+
this._token.value === 'f64' ||
12701277
this._token.value === 'index') {
12711278
return this._read('id');
12721279
}

test/models.json

+7
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,13 @@
33093309
"format": "MLIR",
33103310
"link": "https://github.com/lutzroeder/netron/issues/1044"
33113311
},
3312+
{
3313+
"type": "mlir",
3314+
"target": "toy_gemms.mlir",
3315+
"source": "https://github.com/user-attachments/files/18049387/toy_gemms.mlir.zip[toy_gemms.mlir]",
3316+
"format": "MLIR",
3317+
"link": "https://github.com/lutzroeder/netron/issues/1044"
3318+
},
33123319
{
33133320
"type": "mlir",
33143321
"target": "versioned-op-2.0.mlirbc",

0 commit comments

Comments
 (0)