Selaa lähdekoodia

Add MLIR support (#1044)

Lutz Roeder 1 kuukausi sitten
vanhempi
sitoutus
2e46987933
3 muutettua tiedostoa jossa 666 lisäystä ja 390 poistoa
  1. 121 180
      source/mlir-metadata.json
  2. 535 195
      source/mlir.js
  3. 10 15
      tools/mlir-script.js

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 121 - 180
source/mlir-metadata.json


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 535 - 195
source/mlir.js


+ 10 - 15
tools/mlir-script.js

@@ -782,19 +782,13 @@ const schema = async () => {
                         traits.push({ type: 'IsolatedFromAbove' });
                     }
                     // Extract InferTypeOpInterface trait (for type inference)
-                    if (traitName === 'InferTypeOpInterface' && traits.every((trait) => trait.type !== 'InferTypeOpInterface')) {
+                    // Also check for InferTypeOpAdaptor which is a TraitList containing InferTypeOpInterface
+                    // Note: DeclareOpInterfaceMethods<InferTypeOpInterface> is NOT included here because
+                    // it just means the op declares custom implementations, not that we can infer types
+                    if ((traitName === 'InferTypeOpInterface' || traitName === 'InferTypeOpAdaptor') &&
+                        traits.every((trait) => trait.type !== 'InferTypeOpInterface')) {
                         traits.push({ type: 'InferTypeOpInterface' });
                     }
-                    // Check for DeclareOpInterfaceMethods<InferTypeOpInterface>
-                    if (traitDag === 'DeclareOpInterfaceMethods' && trait.value && trait.value.operands) {
-                        const interfaceOperand = trait.value.operands[0];
-                        if (interfaceOperand && interfaceOperand.value && interfaceOperand.value.type === 'def') {
-                            const interfaceName = interfaceOperand.value.value;
-                            if (interfaceName === 'InferTypeOpInterface' && traits.every((t) => t.type !== 'InferTypeOpInterface')) {
-                                traits.push({ type: 'InferTypeOpInterface' });
-                            }
-                        }
-                    }
                     // Extract defaultDialect from OpAsmOpInterface
                     if (traitName === 'OpAsmOpInterface' || traitDag === 'DeclareOpInterfaceMethods') {
                         if (traitDag === 'DeclareOpInterfaceMethods' && trait.value && trait.value.operands) {
@@ -823,10 +817,11 @@ const schema = async () => {
                     continue;
                 }
                 visited.add(parent.name);
-                // Extract traits from parent args
-                const possibleTraitArgs = parent.args && parent.args.length >= 2 ? [parent.args[1], parent.args[2]] : [];
-                for (const traitsArg of possibleTraitArgs) {
-                    extractTraitsFromList(traitsArg);
+                // Extract traits from parent args (check all args as traits can be at different positions)
+                if (parent.args) {
+                    for (const traitsArg of parent.args) {
+                        extractTraitsFromList(traitsArg);
+                    }
                 }
                 // Recursively look at parent class definition
                 const parentClass = parser.getClass(parent.name);

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä