-
Notifications
You must be signed in to change notification settings - Fork 14
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
Remove tt::target::DataType::None #1103
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jackson! :)
@@ -18,9 +18,9 @@ table ToMemoryConfigOp { | |||
table ToLayoutOp { | |||
in: tt.target.TensorRef; | |||
layout: tt.target.TensorLayout; | |||
dtype: tt.target.DataType; | |||
dtype: tt.target.DataType = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to set this to null, each field is optional in flatbuffers, and defaults to 0/null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For enums it has to be set, 0/null only works for flatbuffers::Offset types which tables get compiled to. Enums get directly compiled to C++ enums. That's why I previously had to add a NONE type to the enum type to make it behave similarly. If we set it to 0 it would assume we're assigning the enum value that maps to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, thanks for letting me know!
bb70931
to
fb5d6c1
Compare
@@ -35,8 +35,8 @@ void run(const ::tt::target::ttnn::ToLayoutOp *op, ProgramContext &context) { | |||
std::optional<::ttnn::MemoryConfig> memoryConfig = std::nullopt; | |||
::ttnn::Device *device = nullptr; | |||
|
|||
if (op->dtype() != ::tt::target::DataType::None) { | |||
dtype = ::tt::runtime::ttnn::utils::toTTNNDataType(op->dtype()); | |||
if (op->dtype()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work for Float32
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it will because the enum is wrapped in a flatbuffers::Optional (because we're assigning null in the fbs file), so this check will solely check if the Optional has a value and is not a flatbuffers::nullopt. That's also why I dereference the dtype on the next line to extract the enum value.
d9d0cd9
to
146fc32
Compare
146fc32
to
3840b83
Compare
Closes #1102