From cdbe767ed0139f52d696263bc52742ec1e2d7087 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Wed, 4 Sep 2024 10:59:15 +0200 Subject: [PATCH] Add tests --- jest.config.ts | 387 ++-- mocks/monaco-editor.ts | 8 + package-lock.json | 490 ++++- package.json | 4 +- src/sdfg_diff_viewr.ts | 8 +- .../gemm_expanded_pure_pre_0_16.sdfg | 1687 +++++++++++++++++ .../test_graphs/gemm_expanded_pure_tiled.sdfg | 271 +-- tests/unit/sdfg_diff_viewer.test.ts | 81 +- tests/unit/utils/sdfg/sdfg_utils.test.ts | 74 +- 9 files changed, 2542 insertions(+), 468 deletions(-) create mode 100644 mocks/monaco-editor.ts create mode 100644 tests/test_graphs/gemm_expanded_pure_pre_0_16.sdfg diff --git a/jest.config.ts b/jest.config.ts index f0554f5b..18689ca0 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,196 +1,221 @@ import type { Config } from 'jest'; const config: Config = { - // A preset that is used as a base for Jest's configuration - preset: 'ts-jest', + // A preset that is used as a base for Jest's configuration + preset: 'ts-jest', + + // All imported modules in your tests should be mocked automatically + // automock: false, + + // Stop running tests after `n` failures + // bail: 0, + + // The directory where Jest should store its cached dependency information + // cacheDirectory: '', + + // Automatically clear mock calls, instances, contexts and results before + // every test + clearMocks: true, + + // Indicates whether the coverage information should be collected while + // executing the test + collectCoverage: true, + + // An array of glob patterns indicating a set of files for which coverage + // information should be collected + collectCoverageFrom: ['src/**/*.ts'], + + // The directory where Jest should output its coverage files + coverageDirectory: 'coverage', + + // An array of regexp pattern strings used to skip coverage collection + // coveragePathIgnorePatterns: [ + // '\\\\node_modules\\\\' + // ], + + // Indicates which provider should be used to instrument code for coverage + // coverageProvider: 'babel', + + // A list of reporter names that Jest uses when writing coverage reports + coverageReporters: [ + 'json-summary', + 'text', + 'lcov', + 'clover', + ], + + // An object that configures minimum threshold enforcement for coverage + // results + // coverageThreshold: undefined, + + // A path to a custom dependency extractor + // dependencyExtractor: undefined, + + // Make calling deprecated APIs throw helpful error messages + // errorOnDeprecated: false, + + // The default configuration for fake timers + // fakeTimers: { + // 'enableGlobally': false + // }, + + // Force coverage collection from ignored files using an array of glob + // patterns + // forceCoverageMatch: [], + + // A path to a module which exports an async function that is triggered once + // before all test suites + // globalSetup: undefined, + + // A path to a module which exports an async function that is triggered once + // after all test suites + // globalTeardown: undefined, - // All imported modules in your tests should be mocked automatically - // automock: false, + // A set of global variables that need to be available in all test + // environments + // globals: {}, + + // The maximum amount of workers used to run your tests. Can be specified as + // % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 + // as the maximum worker number. maxWorkers: 2 will use a maximum of 2 + // workers. + // maxWorkers: '50%', + + // An array of directory names to be searched recursively up from the + // requiring module's location + moduleDirectories: [ + 'mocks', + 'node_modules', + ], + + // An array of file extensions your modules use + // moduleFileExtensions: [ + // 'js', + // 'mjs', + // 'cjs', + // 'jsx', + // 'ts', + // 'tsx', + // 'json', + // 'node' + // ], + + // A map from regular expressions to module names or to arrays of module + // names that allow to stub out resources with a single module + moduleNameMapper: { + '^.+\\.(css|less|scss)$': 'babel-jest', + }, + + // An array of regexp pattern strings, matched against all module paths + // before considered 'visible' to the module loader + // modulePathIgnorePatterns: [], + + // Activates notifications for test results + // notify: false, + + // An enum that specifies notification mode. Requires { notify: true } + // notifyMode: 'failure-change', + + // Run tests from one or more projects + // projects: undefined, + + // Use this configuration option to add custom reporters to Jest + // reporters: undefined, + + // Automatically reset mock state before every test + // resetMocks: false, + + // Reset the module registry before running each individual test + // resetModules: false, + + // A path to a custom resolver + // resolver: undefined, + + // Automatically restore mock state and implementation before every test + // restoreMocks: false, + + // The root directory that Jest should scan for tests and modules within + // rootDir: undefined, + + // A list of paths to directories that Jest should use to search for files + // in + // roots: [ + // '' + // ], + + // Allows you to use a custom runner instead of Jest's default test runner + // runner: 'jest-runner', + + // The paths to modules that run some code to configure or set up the + // testing environment before each test + setupFiles: ['jest-canvas-mock'], + + // A list of paths to modules that run some code to configure or set up the + // testing framework before each test + // setupFilesAfterEnv: [], + + // The number of seconds after which a test is considered as slow and + // reported as such in the results. + // slowTestThreshold: 5, + + // A list of paths to snapshot serializer modules Jest should use for + // snapshot testing + // snapshotSerializers: [], + + // The test environment that will be used for testing + testEnvironment: 'jest-environment-jsdom', + + // Options that will be passed to the testEnvironment + // testEnvironmentOptions: {}, + + // Adds a location field to test results + // testLocationInResults: false, + + // The glob patterns Jest uses to detect test files + // testMatch: [ + // '**/__tests__/**/*.[jt]s?(x)', + // '**/?(*.)+(spec|test).[tj]s?(x)' + // ], + + // An array of regexp pattern strings that are matched against all test + // paths, matched tests are skipped + // testPathIgnorePatterns: [ + // '\\\\node_modules\\\\' + // ], + + // The regexp pattern or array of patterns that Jest uses to detect test + // files + // testRegex: [], - // Stop running tests after `n` failures - // bail: 0, + // This option allows the use of a custom results processor + // testResultsProcessor: undefined, - // The directory where Jest should store its cached dependency information - // cacheDirectory: "", + // This option allows use of a custom test runner + // testRunner: 'jest-circus/runner', - // Automatically clear mock calls, instances, contexts and results before every test - clearMocks: true, + // A map from regular expressions to paths to transformers + // transform: undefined, - // Indicates whether the coverage information should be collected while executing the test - collectCoverage: true, + // An array of regexp pattern strings that are matched against all source + // file paths, matched files will skip transformation + // transformIgnorePatterns: [ + // '\\\\node_modules\\\\', + // '\\.pnp\\.[^\\\\]+$' + // ], - // An array of glob patterns indicating a set of files for which coverage information should be collected - collectCoverageFrom: [ - "src/**/*.ts" - ], + // An array of regexp pattern strings that are matched against all modules + // before the module loader will automatically return a mock for them + // unmockedModulePathPatterns: undefined, - // The directory where Jest should output its coverage files - coverageDirectory: "coverage", + // Indicates whether each individual test should be reported during the run + // verbose: undefined, - // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "\\\\node_modules\\\\" - // ], + // An array of regexp patterns that are matched against all source file + // paths before re-running tests in watch mode + // watchPathIgnorePatterns: [], - // Indicates which provider should be used to instrument code for coverage - // coverageProvider: "babel", - - // A list of reporter names that Jest uses when writing coverage reports - coverageReporters: [ - "json-summary", - "text", - "lcov", - "clover" - ], - - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: undefined, - - // A path to a custom dependency extractor - // dependencyExtractor: undefined, - - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, - - // The default configuration for fake timers - // fakeTimers: { - // "enableGlobally": false - // }, - - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], - - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: undefined, - - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: undefined, - - // A set of global variables that need to be available in all test environments - // globals: {}, - - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: "50%", - - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], - - // An array of file extensions your modules use - // moduleFileExtensions: [ - // "js", - // "mjs", - // "cjs", - // "jsx", - // "ts", - // "tsx", - // "json", - // "node" - // ], - - // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, - - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], - - // Activates notifications for test results - // notify: false, - - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", - - // Run tests from one or more projects - // projects: undefined, - - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, - - // Automatically reset mock state before every test - // resetMocks: false, - - // Reset the module registry before running each individual test - // resetModules: false, - - // A path to a custom resolver - // resolver: undefined, - - // Automatically restore mock state and implementation before every test - // restoreMocks: false, - - // The root directory that Jest should scan for tests and modules within - // rootDir: undefined, - - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], - - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", - - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], - - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], - - // The number of seconds after which a test is considered as slow and reported as such in the results. - // slowTestThreshold: 5, - - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], - - // The test environment that will be used for testing - // testEnvironment: "jest-environment-node", - - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, - - // Adds a location field to test results - // testLocationInResults: false, - - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], - - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "\\\\node_modules\\\\" - // ], - - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], - - // This option allows the use of a custom results processor - // testResultsProcessor: undefined, - - // This option allows use of a custom test runner - // testRunner: "jest-circus/runner", - - // A map from regular expressions to paths to transformers - // transform: undefined, - - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "\\\\node_modules\\\\", - // "\\.pnp\\.[^\\\\]+$" - // ], - - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, - - // Indicates whether each individual test should be reported during the run - // verbose: undefined, - - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], - - // Whether to use watchman for file crawling - // watchman: true, + // Whether to use watchman for file crawling + // watchman: true, }; export default config; diff --git a/mocks/monaco-editor.ts b/mocks/monaco-editor.ts new file mode 100644 index 00000000..9d0f599b --- /dev/null +++ b/mocks/monaco-editor.ts @@ -0,0 +1,8 @@ +module.exports = { + editor: { + tokenize: (..._args: any) => { + return []; + }, + }, + Position: {}, +}; diff --git a/package-lock.json b/package-lock.json index a621222c..3d8fa9eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,13 +44,15 @@ "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", "autoprefixer": "^10.4.13", - "babel-jest": "^29.6.1", + "babel-jest": "^29.7.0", "babel-loader": "^9.1.3", "babel-plugin-transform-class-properties": "^6.24.1", "css-loader": "^6.8.1", "eslint": "^8.31.0", "file-loader": "^6.2.0", "jest": "^29.6.1", + "jest-canvas-mock": "^2.5.2", + "jest-environment-jsdom": "^29.7.0", "monaco-editor-webpack-plugin": "^7.1.0", "node-sass": "^9.0.0", "postcss-loader": "^7.3.3", @@ -3785,6 +3787,18 @@ "@types/sizzle": "*" } }, + "node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -3909,6 +3923,13 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/ws": { "version": "8.5.12", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", @@ -4372,6 +4393,14 @@ "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==" }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "deprecated": "Use your platform's native atob() and btoa() methods instead", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -4403,6 +4432,17 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, "node_modules/acorn-import-attributes": { "version": "1.9.5", "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", @@ -4681,6 +4721,13 @@ "node": "*" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -4840,6 +4887,7 @@ "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", "dev": true, + "license": "MIT", "dependencies": { "@jest/transform": "^29.7.0", "@types/babel__core": "^7.1.14", @@ -5873,6 +5921,19 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", @@ -6253,6 +6314,40 @@ "node": ">=4" } }, + "node_modules/cssfontparser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz", + "integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true, + "license": "MIT" + }, "node_modules/dagre": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/dagre/-/dagre-0.8.5.tgz", @@ -6262,6 +6357,21 @@ "lodash": "^4.17.15" } }, + "node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/debug": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", @@ -6431,6 +6541,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -6525,6 +6645,20 @@ "node": ">=6.0.0" } }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "license": "MIT", + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/earcut": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", @@ -6622,6 +6756,19 @@ "node": ">=10.13.0" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -6712,6 +6859,28 @@ "node": ">=0.8.0" } }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, "node_modules/eslint": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", @@ -7549,6 +7718,21 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -8107,6 +8291,19 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/html-entities": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz", @@ -8278,7 +8475,6 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, - "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -8697,6 +8893,13 @@ "node": ">=0.10.0" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -9028,6 +9231,17 @@ } } }, + "node_modules/jest-canvas-mock": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz", + "integrity": "sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssfontparser": "^1.2.1", + "moo-color": "^1.0.2" + } + }, "node_modules/jest-changed-files": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", @@ -9562,6 +9776,34 @@ "node": ">=8" } }, + "node_modules/jest-environment-jsdom": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", + "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0", + "jsdom": "^20.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/jest-environment-node": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", @@ -10648,6 +10890,52 @@ "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", "dev": true }, + "node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -11343,6 +11631,23 @@ "webpack": "^4.5.0 || 5.x" } }, + "node_modules/moo-color": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz", + "integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "^1.1.4" + } + }, + "node_modules/moo-color/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -11850,6 +12155,13 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/nwsapi": { + "version": "2.2.12", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz", + "integrity": "sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==", + "dev": true, + "license": "MIT" + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -12132,6 +12444,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -12784,6 +13109,13 @@ "node": ">= 0.10" } }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true, + "license": "MIT" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -12823,6 +13155,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true, + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -13373,6 +13712,19 @@ } } }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/schema-utils": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", @@ -14128,6 +14480,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", @@ -14404,6 +14763,45 @@ "node": ">=0.6" } }, + "node_modules/tough-cookie": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/tree-dump": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", @@ -14881,6 +15279,17 @@ "node": ">= 0.4" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url/node_modules/punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -14960,6 +15369,19 @@ "node": ">= 0.8" } }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -14991,6 +15413,16 @@ "minimalistic-assert": "^1.0.0" } }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, "node_modules/webpack": { "version": "5.93.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.93.0.tgz", @@ -15299,6 +15731,43 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -15495,6 +15964,23 @@ } } }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 07fa22a9..99452f76 100644 --- a/package.json +++ b/package.json @@ -47,13 +47,15 @@ "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", "autoprefixer": "^10.4.13", - "babel-jest": "^29.6.1", + "babel-jest": "^29.7.0", "babel-loader": "^9.1.3", "babel-plugin-transform-class-properties": "^6.24.1", "css-loader": "^6.8.1", "eslint": "^8.31.0", "file-loader": "^6.2.0", "jest": "^29.6.1", + "jest-canvas-mock": "^2.5.2", + "jest-environment-jsdom": "^29.7.0", "monaco-editor-webpack-plugin": "^7.1.0", "node-sass": "^9.0.0", "postcss-loader": "^7.3.3", diff --git a/src/sdfg_diff_viewr.ts b/src/sdfg_diff_viewr.ts index 8336be3c..a1f199a3 100644 --- a/src/sdfg_diff_viewr.ts +++ b/src/sdfg_diff_viewr.ts @@ -109,9 +109,11 @@ export abstract class SDFGDiffViewer implements ISDFV { const bKeys = new Set(elementsDictB.keys()); const changedKeys: Set = new Set(); - const addedKeys = bKeys.difference(aKeys); - const removedKeys = aKeys.difference(bKeys); - const remainingKeys = aKeys.difference(removedKeys); + const addedKeys = new Set([...bKeys].filter(x => !aKeys.has(x))); + const removedKeys = new Set([...aKeys].filter(x => !bKeys.has(x))); + const remainingKeys = new Set( + [...aKeys].filter(x => !removedKeys.has(x)) + ); for (const key of remainingKeys) { const elA: JsonSDFGElement = elementsDictA.get(key); diff --git a/tests/test_graphs/gemm_expanded_pure_pre_0_16.sdfg b/tests/test_graphs/gemm_expanded_pure_pre_0_16.sdfg new file mode 100644 index 00000000..27b5f0b4 --- /dev/null +++ b/tests/test_graphs/gemm_expanded_pure_pre_0_16.sdfg @@ -0,0 +1,1687 @@ +{ + "type": "SDFG", + "attributes": { + "name": "gemm", + "arg_names": [ + "A", + "B", + "C" + ], + "_arrays": { + "A": { + "type": "Array", + "attributes": { + "strides": [ + "K", + "1" + ], + "total_size": "K*N", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "N", + "K" + ], + "debuginfo": null + } + }, + "B": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "K*M", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "K", + "M" + ], + "debuginfo": null + } + }, + "C": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "M*N", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "N", + "M" + ], + "debuginfo": null + } + } + }, + "symbols": { + "K": "int32", + "M": "int32", + "N": "int32" + }, + "global_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "init_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "exit_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "orig_sdfg": { + "type": "SDFG", + "attributes": { + "name": "gemm", + "arg_names": [ + "A", + "B", + "C" + ], + "_arrays": { + "A": { + "type": "Array", + "attributes": { + "strides": [ + "K", + "1" + ], + "total_size": "K*N", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "N", + "K" + ], + "debuginfo": null + } + }, + "B": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "K*M", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "K", + "M" + ], + "debuginfo": null + } + }, + "C": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "M*N", + "offset": [ + "0", + "0" + ], + "optional": false, + "dtype": "float64", + "shape": [ + "N", + "M" + ], + "debuginfo": null + } + } + }, + "symbols": { + "K": "int32", + "M": "int32", + "N": "int32" + }, + "global_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "init_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "exit_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 19, + "end_line": 21, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "guid": "77e9d82f-4761-49ff-b80f-7396131c5e0d" + }, + "nodes": [ + { + "type": "SDFGState", + "label": "BinOp_21", + "id": 0, + "collapsed": false, + "scope_dict": { + "-1": [ + 0, + 1, + 2, + 3 + ] + }, + "nodes": [ + { + "type": "AccessNode", + "label": "A", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "A", + "guid": "240cb237-ee0d-4324-94f8-ead206f9e78f" + }, + "id": 0, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "AccessNode", + "label": "B", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "B", + "guid": "a28b9e1e-7abd-43e6-b134-685d8daa9893" + }, + "id": 1, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "LibraryNode", + "label": "_MatMult_", + "attributes": { + "name": "_MatMult_", + "debuginfo": { + "type": "DebugInfo", + "start_line": 0, + "end_line": 0, + "start_column": 0, + "end_column": 0, + "filename": null + }, + "label": "_MatMult_", + "in_connectors": { + "_a": null, + "_b": null + }, + "out_connectors": { + "_c": null + }, + "guid": "74db0aeb-efe9-43b8-99d9-3a3f0f6ca5fb" + }, + "id": 2, + "scope_entry": null, + "scope_exit": null, + "classpath": "dace.libraries.blas.nodes.matmul.MatMul" + }, + { + "type": "AccessNode", + "label": "C", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "C", + "guid": "b444c3bb-2dd5-4527-a9b0-b69e9712d5be" + }, + "id": 3, + "scope_entry": null, + "scope_exit": null + } + ], + "edges": [ + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "A", + "debuginfo": null, + "guid": "0e1246f2-c398-4a90-91f2-8ea6a56d29b7", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*N" + } + } + }, + "src": "0", + "dst": "2", + "dst_connector": "_a", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*M", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "B", + "debuginfo": null, + "guid": "046e56af-d93a-45f3-b4b2-9a36a5adcd23", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*M" + } + } + }, + "src": "1", + "dst": "2", + "dst_connector": "_b", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "C", + "debuginfo": null, + "guid": "70d8c720-f770-4ffd-b624-f02d982559cd", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "M*N" + } + } + }, + "src": "2", + "dst": "3", + "dst_connector": null, + "src_connector": "_c" + } + ], + "attributes": { + "executions": "1", + "dynamic_executions": false, + "guid": "048ae310-9f68-4ad6-a3cd-850a9519fa60" + } + } + ], + "edges": [], + "collapsed": false, + "label": "", + "id": null, + "sdfg_list_id": 0, + "start_state": 0, + "dace_version": "0.16.1" + }, + "transformation_hist": [ + { + "type": "ExpandTransformation", + "transformation": "SpecializeMatMul", + "classpath": "dace.libraries.blas.nodes.matmul.SpecializeMatMul", + "_subgraph": { + "0": 2 + } + }, + { + "type": "ExpandTransformation", + "transformation": "ExpandGemmPure", + "classpath": "dace.libraries.blas.nodes.gemm.ExpandGemmPure", + "_subgraph": { + "0": 3 + } + } + ], + "debuginfo": { + "type": "DebugInfo", + "start_line": 19, + "end_line": 21, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "guid": "77e9d82f-4761-49ff-b80f-7396131c5e0d", + "hash": "193c5f181dd3a5273972607f9b419f3beff779eb6ece204db87dce8eff5a6673" + }, + "nodes": [ + { + "type": "SDFGState", + "label": "BinOp_21", + "id": 0, + "collapsed": false, + "scope_dict": { + "-1": [ + 0, + 1, + 2, + 3 + ] + }, + "nodes": [ + { + "type": "AccessNode", + "label": "A", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "A", + "guid": "e20114ff-5410-41c7-aa2a-58e78a336f99" + }, + "id": 0, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "AccessNode", + "label": "B", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "B", + "guid": "f8e0bb31-1c6d-4e83-be7a-cd7897b106f2" + }, + "id": 1, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "AccessNode", + "label": "C", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 21, + "end_line": 21, + "start_column": 15, + "end_column": 15, + "filename": "/home/phil/Repos/dace/scratchpad/tmp.py" + }, + "data": "C", + "guid": "120c5521-aff4-4d3e-a31e-85bc88283abd" + }, + "id": 2, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "NestedSDFG", + "label": "_MatMult_gemm", + "attributes": { + "sdfg": { + "type": "SDFG", + "attributes": { + "name": "_MatMult_gemm_sdfg", + "_arrays": { + "_a": { + "type": "Array", + "attributes": { + "strides": [ + "K", + "1" + ], + "total_size": "K*(N - 1) + K", + "offset": [ + "0", + "0" + ], + "dtype": "float64", + "shape": [ + "N", + "K" + ], + "debuginfo": null + } + }, + "_b": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "M*(K - 1) + M", + "offset": [ + "0", + "0" + ], + "dtype": "float64", + "shape": [ + "K", + "M" + ], + "debuginfo": null + } + }, + "_c": { + "type": "Array", + "attributes": { + "strides": [ + "M", + "1" + ], + "total_size": "M*(N - 1) + M", + "offset": [ + "0", + "0" + ], + "dtype": "float64", + "shape": [ + "N", + "M" + ], + "debuginfo": null + } + } + }, + "symbols": { + "K": "int32", + "M": "int32", + "N": "int32" + }, + "global_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "init_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "exit_code": { + "frame": { + "string_data": "", + "language": "CPP" + } + }, + "guid": "9ccdcf75-5ca9-4f4c-8d42-354058481af7" + }, + "nodes": [ + { + "type": "SDFGState", + "label": "_MatMult_gemm_initstate", + "id": 0, + "collapsed": false, + "scope_dict": { + "-1": [ + 0, + 3 + ], + "0": [ + 1, + 2 + ] + }, + "nodes": [ + { + "type": "MapEntry", + "label": "gemm_init_map[_o0=0:N, _o1=0:M]", + "attributes": { + "label": "gemm_init_map", + "params": [ + "_o0", + "_o1" + ], + "range": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 103, + "end_line": 103, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" + }, + "guid": "1a93a12e-eb21-4037-9238-a3317aed8594" + }, + "id": 0, + "scope_entry": null, + "scope_exit": "2" + }, + { + "type": "Tasklet", + "label": "gemm_init", + "attributes": { + "code": { + "string_data": "out = 0", + "language": "Python" + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 103, + "end_line": 103, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" + }, + "label": "gemm_init", + "out_connectors": { + "out": null + }, + "guid": "f53b1f56-9e4b-46d0-9b66-6bbd6b87012c" + }, + "id": 1, + "scope_entry": "0", + "scope_exit": "2" + }, + { + "type": "MapExit", + "label": "gemm_init_map[_o0=0:N, _o1=0:M]", + "attributes": { + "in_connectors": { + "IN__c": null + }, + "out_connectors": { + "OUT__c": null + }, + "guid": "5144b1f0-dd46-4756-86a1-8753e4eadc5c" + }, + "id": 2, + "scope_entry": "0", + "scope_exit": "2" + }, + { + "type": "AccessNode", + "label": "_c", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 1811, + "end_line": 1811, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/sdfg/state.py" + }, + "data": "_c", + "guid": "6217fb9b-cf97-4ebc-8cc8-4c4ce8bf3956" + }, + "id": 3, + "scope_entry": null, + "scope_exit": null + } + ], + "edges": [ + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "1", + "debuginfo": null, + "guid": "b5b0794e-281c-4750-a560-1ecba58a41b8", + "src_subset": null, + "dst_subset": null, + "is_data_src": false, + "num_accesses": "1" + } + } + }, + "src": "0", + "dst": "1", + "dst_connector": null, + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_c", + "debuginfo": null, + "guid": "446e66c4-2285-41ec-95a1-08532e89c3e5", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "M*N" + } + } + }, + "src": "2", + "dst": "3", + "dst_connector": null, + "src_connector": "OUT__c" + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "1", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "_o0", + "end": "_o0", + "step": "1", + "tile": "1" + }, + { + "start": "_o1", + "end": "_o1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_c", + "debuginfo": null, + "guid": "446e66c4-2285-41ec-95a1-08532e89c3e5", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "_o0", + "end": "_o0", + "step": "1", + "tile": "1" + }, + { + "start": "_o1", + "end": "_o1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "1" + } + } + }, + "src": "1", + "dst": "2", + "dst_connector": "IN__c", + "src_connector": "out" + } + ], + "attributes": { + "guid": "df493a73-5bbb-451e-94e6-fc43b4c2f3c6" + } + }, + { + "type": "SDFGState", + "label": "_MatMult_gemm_state", + "id": 1, + "collapsed": false, + "scope_dict": { + "-1": [ + 0, + 3, + 4, + 5 + ], + "0": [ + 1, + 2 + ] + }, + "nodes": [ + { + "type": "MapEntry", + "label": "gemm_map[__i0=0:N, __i1=0:M, __i2=0:K]", + "attributes": { + "label": "gemm_map", + "params": [ + "__i0", + "__i1", + "__i2" + ], + "range": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 135, + "end_line": 135, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" + }, + "in_connectors": { + "IN__a": null, + "IN__b": null + }, + "out_connectors": { + "OUT__a": null, + "OUT__b": null + }, + "guid": "38ef19e5-7e2b-4611-ab17-22a0345766de" + }, + "id": 0, + "scope_entry": null, + "scope_exit": "2" + }, + { + "type": "Tasklet", + "label": "gemm", + "attributes": { + "code": { + "string_data": "__out = (__a * __b)", + "language": "Python" + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 135, + "end_line": 135, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" + }, + "label": "gemm", + "in_connectors": { + "__a": null, + "__b": null + }, + "out_connectors": { + "__out": null + }, + "guid": "402d8c17-d1f0-4258-82b0-ee658aa5159a" + }, + "id": 1, + "scope_entry": "0", + "scope_exit": "2" + }, + { + "type": "MapExit", + "label": "gemm_map[__i0=0:N, __i1=0:M, __i2=0:K]", + "attributes": { + "in_connectors": { + "IN__c": null + }, + "out_connectors": { + "OUT__c": null + }, + "guid": "f98ddcbb-fad8-4295-90b6-ee7cb75331c7" + }, + "id": 2, + "scope_entry": "0", + "scope_exit": "2" + }, + { + "type": "AccessNode", + "label": "_a", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 1806, + "end_line": 1806, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/sdfg/state.py" + }, + "data": "_a", + "guid": "d288e2cc-1373-4dc3-a36e-5b05244647fd" + }, + "id": 3, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "AccessNode", + "label": "_b", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 1806, + "end_line": 1806, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/sdfg/state.py" + }, + "data": "_b", + "guid": "4ccac366-0ad7-4abc-9e5d-94d1512c7fcc" + }, + "id": 4, + "scope_entry": null, + "scope_exit": null + }, + { + "type": "AccessNode", + "label": "_c", + "attributes": { + "debuginfo": { + "type": "DebugInfo", + "start_line": 1811, + "end_line": 1811, + "start_column": 0, + "end_column": 0, + "filename": "/home/phil/Repos/dace/dace/sdfg/state.py" + }, + "data": "_c", + "guid": "b5ef0c9f-cbe4-43b4-8536-82ddfabfeb8c" + }, + "id": 5, + "scope_entry": null, + "scope_exit": null + } + ], + "edges": [ + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_a", + "debuginfo": null, + "guid": "7e3cddbc-32a8-4679-9250-1c8c003c89aa", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*M*N" + } + } + }, + "src": "3", + "dst": "0", + "dst_connector": "IN__a", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_b", + "debuginfo": null, + "guid": "9ef1ff7d-1964-4f51-a6d8-211c423da18f", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*M*N" + } + } + }, + "src": "4", + "dst": "0", + "dst_connector": "IN__b", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "1", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "__i0", + "end": "__i0", + "step": "1", + "tile": "1" + }, + { + "start": "__i2", + "end": "__i2", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_a", + "debuginfo": null, + "guid": "7e3cddbc-32a8-4679-9250-1c8c003c89aa", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "__i0", + "end": "__i0", + "step": "1", + "tile": "1" + }, + { + "start": "__i2", + "end": "__i2", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "1" + } + } + }, + "src": "0", + "dst": "1", + "dst_connector": "__a", + "src_connector": "OUT__a" + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "1", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "__i2", + "end": "__i2", + "step": "1", + "tile": "1" + }, + { + "start": "__i1", + "end": "__i1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_b", + "debuginfo": null, + "guid": "9ef1ff7d-1964-4f51-a6d8-211c423da18f", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "__i2", + "end": "__i2", + "step": "1", + "tile": "1" + }, + { + "start": "__i1", + "end": "__i1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "1" + } + } + }, + "src": "0", + "dst": "1", + "dst_connector": "__b", + "src_connector": "OUT__b" + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_c", + "wcr": "(lambda x, y: (x + y))", + "debuginfo": null, + "guid": "7b6a3892-472f-429c-b457-0681fa26d8c9", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "K*M*N" + } + } + }, + "src": "2", + "dst": "5", + "dst_connector": null, + "src_connector": "OUT__c" + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "1", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "__i0", + "end": "__i0", + "step": "1", + "tile": "1" + }, + { + "start": "__i1", + "end": "__i1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "_c", + "wcr": "(lambda x, y: (x + y))", + "debuginfo": null, + "guid": "7b6a3892-472f-429c-b457-0681fa26d8c9", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "__i0", + "end": "__i0", + "step": "1", + "tile": "1" + }, + { + "start": "__i1", + "end": "__i1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "1" + } + } + }, + "src": "1", + "dst": "2", + "dst_connector": "IN__c", + "src_connector": "__out" + } + ], + "attributes": { + "guid": "6f68cb23-8499-4cb2-bd53-f20eb7265606" + } + } + ], + "edges": [ + { + "type": "Edge", + "attributes": { + "data": { + "type": "InterstateEdge", + "attributes": { + "guid": "7310d962-192e-42b9-b6ba-b56b877d5236" + }, + "label": "" + } + }, + "src": "0", + "dst": "1" + } + ], + "collapsed": false, + "label": "", + "id": null, + "sdfg_list_id": 1, + "start_state": null + }, + "symbol_mapping": { + "K": "K", + "M": "M", + "N": "N" + }, + "debuginfo": { + "type": "DebugInfo", + "start_line": 0, + "end_line": 0, + "start_column": 0, + "end_column": 0, + "filename": null + }, + "label": "_MatMult_gemm", + "in_connectors": { + "_a": null, + "_b": null + }, + "out_connectors": { + "_c": null + }, + "guid": "af3fab52-4def-4725-8f94-3f6dadf06891" + }, + "id": 3, + "scope_entry": null, + "scope_exit": null + } + ], + "edges": [ + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "A", + "debuginfo": null, + "guid": "e2848980-5688-4147-ba24-46c52e29972d", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*N" + } + } + }, + "src": "0", + "dst": "3", + "dst_connector": "_a", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "K*M", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "B", + "debuginfo": null, + "guid": "1f211d85-4683-4c5b-9369-c840cf928783", + "src_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "K - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "dst_subset": null, + "is_data_src": true, + "num_accesses": "K*M" + } + } + }, + "src": "1", + "dst": "3", + "dst_connector": "_b", + "src_connector": null + }, + { + "type": "MultiConnectorEdge", + "attributes": { + "data": { + "type": "Memlet", + "attributes": { + "volume": "M*N", + "subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "data": "C", + "debuginfo": null, + "guid": "f96a1253-096b-4647-98ec-d0477dcfd9bd", + "src_subset": null, + "dst_subset": { + "type": "Range", + "ranges": [ + { + "start": "0", + "end": "N - 1", + "step": "1", + "tile": "1" + }, + { + "start": "0", + "end": "M - 1", + "step": "1", + "tile": "1" + } + ] + }, + "is_data_src": false, + "num_accesses": "M*N" + } + } + }, + "src": "3", + "dst": "2", + "dst_connector": null, + "src_connector": "_c" + } + ], + "attributes": { + "executions": "1", + "dynamic_executions": false, + "guid": "048ae310-9f68-4ad6-a3cd-850a9519fa60" + } + } + ], + "edges": [], + "collapsed": false, + "label": "", + "id": null, + "sdfg_list_id": 0, + "start_state": 0, + "dace_version": "0.15.0" +} \ No newline at end of file diff --git a/tests/test_graphs/gemm_expanded_pure_tiled.sdfg b/tests/test_graphs/gemm_expanded_pure_tiled.sdfg index b47f9fc8..f25e5533 100644 --- a/tests/test_graphs/gemm_expanded_pure_tiled.sdfg +++ b/tests/test_graphs/gemm_expanded_pure_tiled.sdfg @@ -718,265 +718,10 @@ "guid": "9ccdcf75-5ca9-4f4c-8d42-354058481af7" }, "nodes": [ - { - "type": "SDFGState", - "label": "_MatMult_gemm_initstate", - "id": 0, - "collapsed": false, - "scope_dict": { - "-1": [ - 0, - 3 - ], - "0": [ - 1, - 2 - ] - }, - "nodes": [ - { - "type": "MapEntry", - "label": "gemm_init_map[_o0=0:N, _o1=0:M]", - "attributes": { - "label": "gemm_init_map", - "params": [ - "_o0", - "_o1" - ], - "range": { - "type": "Range", - "ranges": [ - { - "start": "0", - "end": "N - 1", - "step": "1", - "tile": "1" - }, - { - "start": "0", - "end": "M - 1", - "step": "1", - "tile": "1" - } - ] - }, - "debuginfo": { - "type": "DebugInfo", - "start_line": 103, - "end_line": 103, - "start_column": 0, - "end_column": 0, - "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" - }, - "guid": "1a93a12e-eb21-4037-9238-a3317aed8594" - }, - "id": 0, - "scope_entry": null, - "scope_exit": "2" - }, - { - "type": "Tasklet", - "label": "gemm_init", - "attributes": { - "code": { - "string_data": "out = 0", - "language": "Python" - }, - "debuginfo": { - "type": "DebugInfo", - "start_line": 103, - "end_line": 103, - "start_column": 0, - "end_column": 0, - "filename": "/home/phil/Repos/dace/dace/libraries/blas/nodes/gemm.py" - }, - "label": "gemm_init", - "out_connectors": { - "out": null - }, - "guid": "f53b1f56-9e4b-46d0-9b66-6bbd6b87012c" - }, - "id": 1, - "scope_entry": "0", - "scope_exit": "2" - }, - { - "type": "MapExit", - "label": "gemm_init_map[_o0=0:N, _o1=0:M]", - "attributes": { - "in_connectors": { - "IN__c": null - }, - "out_connectors": { - "OUT__c": null - }, - "guid": "5144b1f0-dd46-4756-86a1-8753e4eadc5c" - }, - "id": 2, - "scope_entry": "0", - "scope_exit": "2" - }, - { - "type": "AccessNode", - "label": "_c", - "attributes": { - "debuginfo": { - "type": "DebugInfo", - "start_line": 1811, - "end_line": 1811, - "start_column": 0, - "end_column": 0, - "filename": "/home/phil/Repos/dace/dace/sdfg/state.py" - }, - "data": "_c", - "guid": "6217fb9b-cf97-4ebc-8cc8-4c4ce8bf3956" - }, - "id": 3, - "scope_entry": null, - "scope_exit": null - } - ], - "edges": [ - { - "type": "MultiConnectorEdge", - "attributes": { - "data": { - "type": "Memlet", - "attributes": { - "volume": "1", - "debuginfo": null, - "guid": "b5b0794e-281c-4750-a560-1ecba58a41b8", - "src_subset": null, - "dst_subset": null, - "is_data_src": false, - "num_accesses": "1" - } - } - }, - "src": "0", - "dst": "1", - "dst_connector": null, - "src_connector": null - }, - { - "type": "MultiConnectorEdge", - "attributes": { - "data": { - "type": "Memlet", - "attributes": { - "volume": "M*N", - "subset": { - "type": "Range", - "ranges": [ - { - "start": "0", - "end": "N - 1", - "step": "1", - "tile": "1" - }, - { - "start": "0", - "end": "M - 1", - "step": "1", - "tile": "1" - } - ] - }, - "data": "_c", - "debuginfo": null, - "guid": "446e66c4-2285-41ec-95a1-08532e89c3e5", - "src_subset": null, - "dst_subset": { - "type": "Range", - "ranges": [ - { - "start": "0", - "end": "N - 1", - "step": "1", - "tile": "1" - }, - { - "start": "0", - "end": "M - 1", - "step": "1", - "tile": "1" - } - ] - }, - "is_data_src": false, - "num_accesses": "M*N" - } - } - }, - "src": "2", - "dst": "3", - "dst_connector": null, - "src_connector": "OUT__c" - }, - { - "type": "MultiConnectorEdge", - "attributes": { - "data": { - "type": "Memlet", - "attributes": { - "volume": "1", - "subset": { - "type": "Range", - "ranges": [ - { - "start": "_o0", - "end": "_o0", - "step": "1", - "tile": "1" - }, - { - "start": "_o1", - "end": "_o1", - "step": "1", - "tile": "1" - } - ] - }, - "data": "_c", - "debuginfo": null, - "guid": "446e66c4-2285-41ec-95a1-08532e89c3e5", - "src_subset": null, - "dst_subset": { - "type": "Range", - "ranges": [ - { - "start": "_o0", - "end": "_o0", - "step": "1", - "tile": "1" - }, - { - "start": "_o1", - "end": "_o1", - "step": "1", - "tile": "1" - } - ] - }, - "is_data_src": false, - "num_accesses": "1" - } - } - }, - "src": "1", - "dst": "2", - "dst_connector": "IN__c", - "src_connector": "out" - } - ], - "attributes": { - "guid": "df493a73-5bbb-451e-94e6-fc43b4c2f3c6" - } - }, { "type": "SDFGState", "label": "_MatMult_gemm_state", - "id": 1, + "id": 0, "collapsed": false, "scope_dict": { "-1": [ @@ -2189,20 +1934,6 @@ } ], "edges": [ - { - "type": "Edge", - "attributes": { - "data": { - "type": "InterstateEdge", - "attributes": { - "guid": "7310d962-192e-42b9-b6ba-b56b877d5236" - }, - "label": "" - } - }, - "src": "0", - "dst": "1" - } ], "collapsed": false, "label": "", diff --git a/tests/unit/sdfg_diff_viewer.test.ts b/tests/unit/sdfg_diff_viewer.test.ts index da5628b9..23abe211 100644 --- a/tests/unit/sdfg_diff_viewer.test.ts +++ b/tests/unit/sdfg_diff_viewer.test.ts @@ -1,2 +1,81 @@ -function testDiffTiledGemm(): void { +import path from 'path'; +import fs from 'fs'; +import { + checkCompatLoad, + parse_sdfg, +} from '../../src/utils/sdfg/json_serializer'; +import { JsonSDFG } from '../../src'; +import { SDFGDiffViewer } from '../../src/sdfg_diff_viewr'; + +function _loadSDFG(name: string): JsonSDFG { + const file = path.join( + __dirname, '..', 'test_graphs', name + '.sdfg' + ); + const contents = fs.readFileSync(file, { + encoding: 'utf-8', + }); + return checkCompatLoad(parse_sdfg(contents)); } + +async function testDiffTiledGemm(): Promise { + const sdfgA = _loadSDFG('gemm_expanded_pure'); + const sdfgB = _loadSDFG('gemm_expanded_pure_tiled'); + + const diff = await SDFGDiffViewer.diff(sdfgA, sdfgB); + const diffInverse = await SDFGDiffViewer.diff(sdfgB, sdfgA); + + const keysAddedToB = [ + 'e562bb57-462f-445d-8ed8-bf9969c757fa', + '70a0d824-b445-47e9-9f63-6cd4824c85c3', + '8401cf3a-a250-4c50-ad7d-95a1b864487c', + '8ba64156-455d-48d9-a244-31b5b408fc2e', + 'e49445d9-0bdc-4e64-b6d7-dc1eca194ac1', + '299e3980-2477-4ea7-ad30-4c8616cf33a6', + '6371609f-0c7d-4732-b432-2f18d785bc46', + 'df4da5a9-89ed-4d0a-8fe2-53925ec1212d', + '57d0797b-6f39-44b5-a5a2-df301b280a24', + 'dacd854b-3331-450b-a35e-206a1d129df7', + '94341c4d-d598-40b4-a96e-9e100b67b72d', + '6d8bfe3f-f22a-4333-a1a1-f32dea84865d', + '53c0c330-40c0-4f53-a147-fa24cc10fb4e', + '762fb2f4-8c7e-4eb3-a9fe-35c0a10a379b', + '93136e27-88c0-46f6-9f78-a27c39204137', + ]; + const keysRemovedInB = [ + 'df493a73-5bbb-451e-94e6-fc43b4c2f3c6', + '1a93a12e-eb21-4037-9238-a3317aed8594', + 'f53b1f56-9e4b-46d0-9b66-6bbd6b87012c', + '5144b1f0-dd46-4756-86a1-8753e4eadc5c', + '6217fb9b-cf97-4ebc-8cc8-4c4ce8bf3956', + 'b5b0794e-281c-4750-a560-1ecba58a41b8', + '446e66c4-2285-41ec-95a1-08532e89c3e5', + '7310d962-192e-42b9-b6ba-b56b877d5236', + ]; + const keysChanged = ['38ef19e5-7e2b-4611-ab17-22a0345766de']; + + expect(diff.addedKeys.size).toBe(15); + expect(diff.removedKeys.size).toBe(8); + expect(diff.changedKeys.size).toBe(1); + + for (const k of keysAddedToB) + expect(diff.addedKeys).toContain(k); + for (const k of keysRemovedInB) + expect(diff.removedKeys).toContain(k); + for (const k of keysChanged) + expect(diff.changedKeys).toContain(k); + + expect(diffInverse.removedKeys.size).toBe(15); + expect(diffInverse.addedKeys.size).toBe(8); + expect(diffInverse.changedKeys.size).toBe(1); + + for (const k of keysAddedToB) + expect(diffInverse.removedKeys).toContain(k); + for (const k of keysRemovedInB) + expect(diffInverse.addedKeys).toContain(k); + for (const k of keysChanged) + expect(diffInverse.changedKeys).toContain(k); +} + +describe('Test SDFG diffs', () => { + test('Test SDFG diff on a tiled GEMM (pure expansion)', testDiffTiledGemm); +}); diff --git a/tests/unit/utils/sdfg/sdfg_utils.test.ts b/tests/unit/utils/sdfg/sdfg_utils.test.ts index 9fcc202f..9584e6bb 100644 --- a/tests/unit/utils/sdfg/sdfg_utils.test.ts +++ b/tests/unit/utils/sdfg/sdfg_utils.test.ts @@ -1,6 +1,21 @@ import path from 'path'; import fs from 'fs'; -import { checkCompatLoad, parse_sdfg } from '../../../../src'; +import { + checkCompatLoad, + parse_sdfg, +} from '../../../../src/utils/sdfg/json_serializer'; +import { checkCompatSave, JsonSDFG, stringify_sdfg } from '../../../../src'; + +function _checkDidLoadGemmExpandedPureCorrectly(sdfg: JsonSDFG): void { + expect(sdfg.label).toBe(''); + expect(sdfg.attributes.name).toBe('gemm'); + expect(sdfg.attributes.arg_names).toContain('A'); + expect(sdfg.attributes.arg_names).toContain('B'); + expect(sdfg.attributes.arg_names).toContain('C'); + expect(sdfg.attributes.symbols).toHaveProperty('K'); + expect(sdfg.attributes.symbols).toHaveProperty('M'); + expect(sdfg.attributes.symbols).toHaveProperty('N'); +} function testReadSDFG(): void { const file = path.join( @@ -11,16 +26,55 @@ function testReadSDFG(): void { }); const sdfg = checkCompatLoad(parse_sdfg(contents)); - expect(sdfg.label).toBe(''); - expect(sdfg.attributes.name).toBe('gemm'); - expect(sdfg.attributes.arg_names).toContain('A'); - expect(sdfg.attributes.arg_names).toContain('B'); - expect(sdfg.attributes.arg_names).toContain('C'); - expect(sdfg.attributes.symbols).toHaveProperty('K'); - expect(sdfg.attributes.symbols).toHaveProperty('M'); - expect(sdfg.attributes.symbols).toHaveProperty('N'); + _checkDidLoadGemmExpandedPureCorrectly(sdfg); +} + +function _loadPreDaCe_0_16_Gemm(): JsonSDFG { + const file = path.join( + __dirname, '..', '..', '..', 'test_graphs', + 'gemm_expanded_pure_pre_0_16.sdfg' + ); + const contents = fs.readFileSync(file, { + encoding: 'utf-8', + }); + return checkCompatLoad(parse_sdfg(contents)); +} + +function testReadSDFGPreDaCe_0_16(): void { + const sdfg = _loadPreDaCe_0_16_Gemm(); + + expect((sdfg).dace_version).toBe('0.15.0'); + expect(sdfg).toHaveProperty('start_block'); + expect(sdfg.start_block).toBe(0); + + _checkDidLoadGemmExpandedPureCorrectly(sdfg); +} + +function testSaveSDFGPreDaCe_0_16(): void { + const sdfg = checkCompatSave(_loadPreDaCe_0_16_Gemm()); + + expect((sdfg).dace_version).toBe('0.15.0'); + expect(sdfg).toHaveProperty('start_state'); + expect(sdfg).not.toHaveProperty('start_block'); + expect((sdfg).start_state).toBe(0); + + const stringified = stringify_sdfg(sdfg); + + expect(stringified).toContain('start_state'); + expect(stringified).not.toContain('start_block'); + expect(stringified).toContain('sdfg_list_id'); + expect(stringified).not.toContain('cfg_list_id'); } describe('Test SDFG serialization and deserialization', () => { - test('Test reading a regular SDFG file from DaCe 0.16.0', testReadSDFG); + test('Test reading a regular SDFG file from DaCe 0.16.1', testReadSDFG); + test( + 'Test reading a regular SDFG file from DaCe 0.15.0', + testReadSDFGPreDaCe_0_16 + ); + test( + 'Test saving an SDFG file from DaCe 0.15.0, after being made 0.16+ ' + + 'compatible', + testSaveSDFGPreDaCe_0_16 + ); });