Skip to content

Instantly share code, notes, and snippets.

@ScottTodd
Last active May 14, 2020 04:22
Show Gist options
  • Save ScottTodd/0df392699cd3853275210b4f092ddc52 to your computer and use it in GitHub Desktop.
Save ScottTodd/0df392699cd3853275210b4f092ddc52 to your computer and use it in GitHub Desktop.
IREE MLIR VSCode Snippets
{
// General
"Insert TODO": {
"prefix": "todo",
"body": [
"// TODO(${1:name}): $2"
],
"description": "Insert a TODO comment"
},
// Constants
"iree.unfoldable_constant": {
"prefix": "unf",
"body": [
"%${1:input} = iree.unfoldable_constant dense<[${2:values}]> : tensor<${3:type}>"
],
"description": "Unfoldable constant definition"
},
// Check dialect: https://google.github.io/iree/Dialects/CheckDialect
"check.expect_all_true": {
"prefix": "alltrue",
"body": [
"check.expect_all_true(%${1:value}) : ${2:type}"
],
"description": "Check \"expect all true\""
},
"check.expect_true": {
"prefix": "true",
"body": [
"check.expect_true(%${1:value}) : i32"
],
"description": "Check \"expect true\""
},
"check.expect_false": {
"prefix": "false",
"body": [
"check.expect_false(%${1:value}) : i32"
],
"description": "Check \"expect false\""
},
"check.expect_almost_eq_const": {
"prefix": "aeqc",
"body": [
"check.expect_almost_eq_const(%${1:result}, dense<[${2:values}]> : tensor<${3:type}>) : tensor<${3:type}>"
],
"description": "Check \"expect almost equals constant\""
},
"check.expect_almost_eq": {
"prefix": "aeq",
"body": [
"check.expect_almost_eq(%${1:value1}, %${2:value2}) : tensor<${3:type}>"
],
"description": "Check \"expect almost equals\""
},
"check.expect_eq_const": {
"prefix": "eqc",
"body": [
"check.expect_eq_const(%${1:result}, dense<[${2:values}]> : tensor<${3:type}>) : tensor<${3:type}>"
],
"description": "Check \"expect equals constant\""
},
"check.expect_eq": {
"prefix": "eq",
"body": [
"check.expect_eq(%${1:value1}, %${2:value2}) : tensor<${3:type}>"
],
"description": "Check \"expect equals\""
},
"Insert function": {
"prefix": "func",
"body": [
"func @${1:function_name}() ${2:attributes { iree.module.export \\}} {",
" ${0}",
" return",
"}"
],
"description": "Function definition"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment