"GPU_BlockDimOp": {
"!anonymous": false,
"!fields": [],
"!locs": [
"GPUOps.td:155"
],
"!name": "GPU_BlockDimOp",
"!superclasses": [
"Op",
"GPU_Op",
"Arguments",
"Results",
"GPU_IndexOp"
],
"arguments": {
"args": [
[
{
"def": "GPU_DimensionAttr",
"kind": "def",
"printable": "GPU_DimensionAttr"
},
"dimension"
],
[
{
"def": "anonymous_547",
"kind": "def",
"printable": "anonymous_547"
},
"upper_bound"
]
],
"kind": "dag",
"operator": {
"def": "ins",
"kind": "def",
"printable": "ins"
},
"printable": "(ins GPU_DimensionAttr:$dimension, anonymous_547:$upper_bound)"
},
"assemblyFormat": "$dimension (`upper_bound` $upper_bound^)? attr-dict",
"builders": [
{
"def": "anonymous_548",
"kind": "def",
"printable": "anonymous_548"
},
{
"def": "anonymous_549",
"kind": "def",
"printable": "anonymous_549"
}
],
"cppNamespace": "::mlir::gpu",
"description": "\n Returns the number of threads in the thread block (aka the block size) along\n the x, y, or z `dimension`.\n\n Example:\n\n ```mlir\n %bDimX = gpu.block_dim x\n ```\n\n If `known_block_size` is set on an this operation's enclosing `gpu.func`,\n or `gpu.known_block_size` is set on an enclosing `FunctionOpInterface`\n implementor, or if the enclosing `gpu.launch` specifies a constant size for\n `dimension`'s blocks, these contextual facts may be used to infer that this\n operation has a constant value, though such a transformation will not be\n performed by canonicalization or the default constant folder. Executions which\n cause that constant-value assumption to be false incur undefined behavior.\n\n If `upper_bound` is set, executions where the bblock size along `dimension`\n exceeds `upper_bound` cause undefined behavior.\n\n There is an implicit upper bound of `kMaxDim` (currently uint32_t::max).\n ",
"extraClassDeclaration": null,
"extraClassDefinition": "\n void $cppClass::getAsmResultNames(\n llvm::function_ref<void(mlir::Value, mlir::StringRef)> setNameFn) {\n auto dimStr = stringifyDimension(getDimensionAttr().getValue());\n auto opName = getOperationName();\n opName.consume_front(\"gpu.\");\n SmallString<8> resultName({opName, \"_\", dimStr});\n setNameFn(getResult(),resultName);\n }\n ",
"hasCanonicalizeMethod": 0,
"hasCanonicalizer": 0,
"hasCustomAssemblyFormat": 0,
"hasFolder": 0,
"hasRegionVerifier": 0,
"hasVerifier": 0,
"opDialect": {
"def": "GPU_Dialect",
"kind": "def",
"printable": "GPU_Dialect"
},
"opDocGroup": null,
"opName": "block_dim",
"regions": {
"args": [],
"kind": "dag",
"operator": {
"def": "region",
"kind": "def",
"printable": "region"
},
"printable": "(region)"
},
"results": {
"args": [
[
{
"def": "Index",
"kind": "def",
"printable": "Index"
},
null
]
],
"kind": "dag",
"operator": {
"def": "outs",
"kind": "def",
"printable": "outs"
},
"printable": "(outs Index)"
},
"skipDefaultBuilders": 0,
"successors": {
"args": [],
"kind": "dag",
"operator": {
"def": "successor",
"kind": "def",
"printable": "successor"
},
"printable": "(successor)"
},
"summary": "",
"traits": [
{
"def": "Pure",
"kind": "def",
"printable": "Pure"
},
{
"def": "anonymous_545",
"kind": "def",
"printable": "anonymous_545"
},
{
"def": "anonymous_546",
"kind": "def",
"printable": "anonymous_546"
}
],
"useCustomPropertiesEncoding": 0
}
Recursing through the traits field isn't the right approach either.
I'm not even sure which trait is being picked up in the old generator, as I don't find any of SameOperandsAndResultType, FirstAttrDerivedResultType, or InferTypeOpInterface in the tablegen sources for this operation...
The old
jl-generators.cccallscanInferTypewhich is defined as:with these functions:
It is not clear to me how to do this using Tablegen's json backend.
To debug, I'm looking at
gpu.block_dimfor which the old generator generates the code for result inference:result_inference=(length(_results) == 0 ? true : false).The json for this operation does not contain any clear indication of any of these traits
json (only the operation itself)
I'm not even sure which trait is being picked up in the old generator, as I don't find any of
SameOperandsAndResultType,FirstAttrDerivedResultType, orInferTypeOpInterfacein the tablegen sources for this operation...