Skip to content

Conversation

@HariK3927
Copy link

Ticket

#2094

Problem description

Added dataarguments for ttir operations

What's changed

added the dtype arguments and done the changes in test files for verification.

Checklist

  • New/Existing tests provide coverage for changes

}];

let arguments = (ins DenseI32ArrayAttr:$shape);
let arguments = (ins DenseI32ArrayAttr:$shape,TypeAttr:$dtype);
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix formatting

Copy link
Author

Choose a reason for hiding this comment

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

fixed

starting point for accumulation operations.
}];
let arguments = (ins DenseI32ArrayAttr:$shape,
TypeAttr:$dtype); // Added dtype argument
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding this directly to zerosop, add to TTIR_NamedFullOp so that it applied to all named full-like ops (ones, zeros, etc.)

Copy link
Author

Choose a reason for hiding this comment

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

yes added

Comment on lines 1644 to 1645

// Create TypeAttr for the dtype argument
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove comment

Copy link
Author

Choose a reason for hiding this comment

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

Removed the comment

.create<ttir::ArangeOp>( // perform arange on the last dimension to
// match how ttnn behaves
op.getLoc(), arangeOutputType, start, end, step, 0)
op.getLoc(), arangeOutputType, start, end, step, 0,outputType.getElementType())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
op.getLoc(), arangeOutputType, start, end, step, 0,outputType.getElementType())
op.getLoc(), arangeOutputType, start, end, step, 0, outputType.getElementType())

Copy link
Author

Choose a reason for hiding this comment

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

fixed formatting

func.func @forward_reuse_zeros(%arg0: tensor<32x32xbf16> {ttcore.argument_type = #ttcore.argument_type<input>}, %arg1: tensor<32x32xbf16> {ttcore.argument_type = #ttcore.argument_type<parameter>}, %arg2: tensor<32x32xbf16> {ttcore.argument_type = #ttcore.argument_type<parameter>}, %arg3: tensor<32x32xbf16> {ttcore.argument_type = #ttcore.argument_type<constant>}) -> tensor<32x32xbf16> {
// CHECK: = ttcore.load_cached(@forward_reuse_zeros_const_eval_0, [%arg1, %arg2])
%0 = "ttir.zeros"() <{shape = array<i32:32, 32>}> : () -> tensor<32x32xbf16>
%0 = "ttir.zeros"() <{shape = array<i32:32, 32>,dtype = i64}> : () -> tensor<32x32xbf16>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
%0 = "ttir.zeros"() <{shape = array<i32:32, 32>,dtype = i64}> : () -> tensor<32x32xbf16>
%0 = "ttir.zeros"() <{shape = array<i32:32, 32>, dtype = i64}> : () -> tensor<32x32xbf16>

Copy link
Author

Choose a reason for hiding this comment

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

fixed the formatting

func.func @zeros_f32() -> tensor<32x64x128xf32> {
// CHECK: {{.*}} = "ttnn.zeros"({{.*}}) {{.*}} -> tensor<32x64x128xf32{{.*}}>
%0 = "ttir.zeros"() <{shape = array<i32:32, 64, 128>}> : () -> tensor<32x64x128xf32>
%0 = "ttir.zeros"() <{shape = array<i32:32, 64, 128>,dtype = i64}> : () -> tensor<32x64x128xf32>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
%0 = "ttir.zeros"() <{shape = array<i32:32, 64, 128>,dtype = i64}> : () -> tensor<32x64x128xf32>
%0 = "ttir.zeros"() <{shape = array<i32:32, 64, 128>, dtype = i64}> : () -> tensor<32x64x128xf32>

Copy link
Author

Choose a reason for hiding this comment

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

fixed the formatting


func.func @zeros() -> tensor<13x24x56x42xbf16> {
%0 = "ttir.zeros"() <{shape = array<i32:13, 24, 56, 42>}> : () -> tensor<13x24x56x42xbf16>
%0 = "ttir.zeros"() <{shape = array<i32:13, 24, 56, 42>, dtype = i64}> : () -> tensor<13x24x56x42xbf16>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why i64?

Copy link
Contributor

Choose a reason for hiding this comment

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

You've added i64 in many other places, please fix everywhere.

Copy link
Author

Choose a reason for hiding this comment

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

changed according to the return type

@HariK3927
Copy link
Author

@svuckovicTT fixed the changes and passed the tests successfully.Can you please review?

@svuckovicTT
Copy link
Contributor

Hey @HariK3927, I've enabled the CI pipeline, there are some failures in the pre-commit stage. You can look at the logs and manually fix things, but I suggest installing the pre-commit hooks and running the tool which will do this automatically for you. You can find more info here: https://docs.tenstorrent.com/tt-mlir/getting-started.html?#pre-commit

@svuckovicTT
Copy link
Contributor

@nsumrakTT @vvukomanTT Hey guys, any ideas why the prepare-run job might be failing for this bounty?

@nsumrakTT
Copy link
Contributor

@svuckovicTT Yes, permission error, I'll fix in separate PR.

@svuckovicTT
Copy link
Contributor

@HariK3927 can you please rebase once this PR lands? I'll launch tests after. Thanks!

#5398

@HariK3927
Copy link
Author

@svuckovicTT It seems the build fix PR is merged to main.Shall I merge this PR to updated main or rebasing needed ?

@nsumrakTT
Copy link
Contributor

@HariK3927 Whatever is easier for you.

@HariK3927
Copy link
Author

@nsumrakTT I have merged to latest main branch . If anyfurther changes required please let me know . Thank you.

@HariK3927
Copy link
Author

@svuckovicTT yes using this command fixed the errors and passed the build .Hope some luck this time

@HariK3927
Copy link
Author

@nsumrakTT @svuckovicTT Can I execute CI workflow ?
I have fixed the build errors .It will be easy If I have access of CI workflow execution since some errors are not visible in local?

@anuragsingh-tt
Copy link
Contributor

anuragsingh-tt commented Nov 4, 2025

Hi @HariK3927, you should be able to reproduce the error for some of these failing tests on your side. E.g:
ttmlir/Conversion/StableHLOToTTIR/data_movement/sort_op.mlir

Can I execute CI workflow ?

Refer to this to run the test suite locally. It does not cover all the CI tests but is a good sanity check.

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.23%. Comparing base (5b898c5) to head (8bc9585).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5036      +/-   ##
==========================================
+ Coverage   69.21%   69.23%   +0.02%     
==========================================
  Files         333      333              
  Lines       50762    50766       +4     
==========================================
+ Hits        35136    35150      +14     
+ Misses      15626    15616      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@anuragsingh-tt anuragsingh-tt left a comment

Choose a reason for hiding this comment

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

test_ones is still failing.

@HariK3927
Copy link
Author

HariK3927 commented Nov 10, 2025

Will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[$200 Bounty]TTIR tensor creation ops missing DataType arguments

5 participants