Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging updated MLIR grammar from mlir-vscode repo #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

momenabdelkarim
Copy link

This updated MLIR grammar file comes from the mlir-visualizer/mlir-vscode repo. It adds support for: Affine Dialect, LLVM IR Dialect, TensorFlow Lite Dialect, Tile Dialect, gpu Dialect, nvvm Dialect, loop Dialect, and the vector Dialect.

The major additions are function name highlighting for the aforementioned dialects, highlighting keywords inside of CHECK comments, and additional data types (such as ui32).

Examples of changes (changes underlined in red summarize other changes in the file):

Affine with original grammar (before):
oldaffine

Affine with new grammar (after):
newaffine

Tile before:
oldtile

Tile after:
newtile

TensorFlow Lite before:
oldtflite

TensorFlow Lite after:
newtflite

This updated MLIR grammar file comes from the mlir-visualizer/mlir-vscode repo and adds support for: Affine Dialect, LLVM IR Dialect, TensorFlow Lite Dialect, Tile Dialect, gpu Dialect, nvvm Dialect, loop Dialect, and the vector Dialect
"name": "entity.name.function.mlir.tileFunctions"
},
"CHECK": {
"match": "(\/\/)\\s*(CHECK\\s*:|CHECK-\\w+\\s*:)(.*)$",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe "CHECK :" wouldn't trigger FileCheck (please verify) and so should ideally be marked as an error as it is very rarely intentional.

"include": "#CHECK"
},
{
"include": "#llvmType"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we makes these into categories? E.g., include "#llvmDialect" here and then have llvmDialect include all of these to avoid a flat list here.

{
"include":"#comment"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find highlighting comments distracting and will be more fragile (comments are not intended to be well formed IR). Also an op in a comment is not an op, it is just a comment for the user, highlighting inside a comment would indicate these are the same semantically, while they are not.

Now an exception would be if we tried to mark code segments inside comments (e.g.,

// mlir // %10 = addi %0, %1 : i32 //

but that would be pretty cumbersome to do in the syntax and the utility for the complexity is uncertain).

@Arm1stice
Copy link

Been a little busy but I'm still planning on working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants