Depends on D104534
Add support for extensible dialects, which are dialects that can be
extended at runtime with new operations and types.
These operations and types cannot at the moment implement traits
or interfaces.
Paths
| Differential D104554
[mlir] Add extensible dialects ClosedPublic Authored by math-fehr on Jun 18 2021, 10:59 AM.
Details Summary Depends on D104534 These operations and types cannot at the moment implement traits
Diff Detail
Event TimelineComment Actions Sorry for the delay! Can you write up a doc (in the docs/ folder) detailing everything here? It would make it easier to understand the design, how it is intended to be used, etc.
Comment Actions
No problem!
math-fehr marked an inline comment as done. Comment ActionsFix memory error by allocating the dialect name in the MLIRContext.
Comment Actions Sorry for the delay! I responded to two inline comments about the design choices.
math-fehr marked 7 inline comments as done. Comment Actions
Comment Actions Took another scan, thanks for the ping!
Comment Actions Add some inline responses.
Comment Actions Sticking with attributes for now is fine. Will take another pass over in the next day or two, but should be good.
Comment Actions Thanks! Will likely just need one more round.
Comment Actions Sorry for not being active enough on this, I addressed all comments here. Otherwise, every comment should have been addressed!
Comment Actions
I think it would be nice to work in if we can. Is the problem that we need to pass in the dialect to the generatedTypeParser method? We could always extend that method to pass in the dialect or something. Either way though, given that we support it in the default generation (which is something we are working towards having on by default), it isn't a huge deal. I think we've hit a good enough starting point that we can land and start iterating in-tree. Thanks for all of the work on this! This revision is now accepted and ready to land.Feb 26 2022, 10:57 AM Comment Actions Thanks a lot for your reviews! Would it be possible to land it for me? I do not have commit access. math-fehr removed a parent revision: D104862: [mlir] NFC: make Dialect::getRegisteredInterface const.Feb 28 2022, 7:14 AM Comment Actions I rebased it to the latest commit, though I'm still investigating why the windows build is failing. This revision was landed with ongoing or failed builds.Mar 2 2022, 12:43 PM Closed by commit rGdbe9f0914fcf: [mlir] Add extensible dialects (authored by math-fehr, committed by rriddle). · Explain Why This revision was automatically updated to reflect the committed changes. awarzynski added a reverting change: rG1b2e35e4d484: Revert "[mlir] Add extensible dialects".Mar 3 2022, 2:31 AM Comment Actions Hi, I've just reverted this as it's been causing build failures in Flang's Windows buildbot: flang-x86_64-windows. I don't have a Windows machine to reproduce myself, but similar build failure was reported by the pre-commit CI: FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/ExtensibleDialect.cpp.obj sccache C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe /nologo /TP -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -DMLIR_CUDA_CONVERSIONS_ENABLED=1 -DMLIR_ROCM_CONVERSIONS_ENABLED=1 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\mlir\lib\IR -IC:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR -Iinclude -IC:\ws\w4\llvm-project\premerge-checks\llvm\include -IC:\ws\w4\llvm-project\premerge-checks\mlir\include -Itools\mlir\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi /Zc:rvalueCast /bigobj /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /Gw /MD /O2 /Ob2 /EHs-c- /GR- -UNDEBUG -std:c++14 /showIncludes /Fotools\mlir\lib\IR\CMakeFiles\obj.MLIRIR.dir\ExtensibleDialect.cpp.obj /Fdtools\mlir\lib\IR\CMakeFiles\obj.MLIRIR.dir\ /FS -c C:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR\ExtensibleDialect.cpp C:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR\ExtensibleDialect.cpp(159): error C2672: 'mlir::Type::hasTrait': no matching overloaded function found C:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR\ExtensibleDialect.cpp(159): error C3207: 'mlir::Type::hasTrait': invalid template argument for 'Trait', class template expected C:\ws\w4\llvm-project\premerge-checks\mlir\include\mlir/IR/Types.h(174): note: see declaration of 'mlir::Type::hasTrait' C:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR\ExtensibleDialect.cpp(278): error C2672: 'mlir::Attribute::hasTrait': no matching overloaded function found C:\ws\w4\llvm-project\premerge-checks\mlir\lib\IR\ExtensibleDialect.cpp(278): error C3207: 'mlir::Attribute::hasTrait': invalid template argument for 'Trait', class template expected C:\ws\w4\llvm-project\premerge-checks\mlir\include\mlir/IR/Attributes.h(91): note: see declaration of 'mlir::Attribute::hasTrait' Thanks for working on this and please let me know if I can help in any way! Comment Actions Thanks for taking care of this! This revision is now accepted and ready to land.Apr 21 2022, 1:28 PM Comment Actions Windows build looks good now, can your reformat/rebase/upload? I can land for you afterwards. Comment Actions Also I've recently added real docs for defining dialects (https://mlir.llvm.org/docs/DefiningDialects/), in a follow up patch can we merge the ExtensibleDialects.md doc into that one? Comment Actions Everything should be ready now! Could you land this for me? math-fehr added a child revision: D124353: [mlir] Allow setting operation legality with an OperationName.Apr 24 2022, 5:48 PM Comment Actions I just changed the names of the types, attributes, and ops in the test dialect, to address the comment of D124353. Closed by commit rG9e0b5533594e: [mlir] Add extensible dialects (authored by math-fehr, committed by rriddle). · Explain WhyApr 26 2022, 7:58 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 378961 mlir/docs/ExtensibleDialects.md
mlir/include/mlir/IR/AttributeSupport.h
mlir/include/mlir/IR/Dialect.h
mlir/include/mlir/IR/ExtensibleDialect.h
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/IR/TypeSupport.h
mlir/include/mlir/TableGen/Dialect.h
mlir/lib/IR/CMakeLists.txt
mlir/lib/IR/ExtensibleDialect.cpp
mlir/lib/TableGen/Dialect.cpp
mlir/test/IR/dynamic.mlir
mlir/test/lib/Dialect/Test/TestAttributes.cpp
mlir/test/lib/Dialect/Test/TestDialect.h
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/lib/Dialect/Test/TestTypes.cpp
mlir/tools/mlir-tblgen/DialectGen.cpp
|