<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/146629>146629</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir][support] Operation::getRawDictionaryAttrs return value that does not meet expectations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          lipracer
      </td>
    </tr>
</table>

<pre>
    When I wanted to obtain a list of attributes from `Operation` that were declared in the same order as the tbgen file, I found this method defined in `Operation.h:509 getRawDictionaryAttrs `, but this method returns an empty list. Here is a simple test:
```
constexpr char ir[] = R"(
func.func @test_unary_f32(%arg0 : tensor<4xf32>) -> () {
  %2 = tosa.clamp %arg0 { min_val = 0.0 : f32, max_val = 10.0 : f32 } : (tensor<4xf32>) -> tensor<*xf32>
  return
  }
)";

TEST(OperationAttribueTest, getRawDictionaryAttrs) {
  MLIRContext context;
 context.getOrLoadDialect<tosa::TosaDialect>();
 context.getOrLoadDialect<func::FuncDialect>();
  auto module =
 mlir::parseSourceString<mlir::ModuleOp>(ir, mlir::ParserConfig{&context});
 auto clampOp =
 &module->getBodyRegion().front().front().getRegion(0).front().front();
 clampOp->dump();
  llvm::errs() << clampOp->getRawDictionaryAttrs() << "\n";
}
```
and test output:
```
%0 = tosa.clamp %arg0 { min_val = 0.0 : f32, max_val = 10.0 : f32 } : (tensor<4xf32>) -> tensor<*xf32>
{}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVV1vszgT_TXOzagRsQOECy4oafRWeh71VVtpLysDA3gFNrKHfvz7le1Nmkrt7u1KVSGemTMz54wH6ZwaNGLJ0luWHjdypdHYclKLlS3aTWO6j_KPETXcw5vUhB2QAdOQVBokTMoRmB4kkVXNSuigt2YGliUPC1pJymiWJUCjJHhDi9BhO0mLHSgNNCI4OSMY26EF6cIJNQNq6NWE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