Add a new way to hold structs in PolymorphicValue#791
Conversation
| #include <memory> | ||
| #include <string> | ||
|
|
||
| namespace nvfuser { |
There was a problem hiding this comment.
Add note describing the big picture of nvFuser struct support.
…o polymorphic-struct
…to polymorphic-struct
| return tv->fusion()->metadataOf(tv); | ||
| } | ||
|
|
||
| Val* IrBuilder::structExpr( |
There was a problem hiding this comment.
Moved to header file, because it now needs a template parameter
|
!build |
PolymorphicValue
There was a problem hiding this comment.
Is there any specific reason to name this file with .inl? Personally I haven't seen this suffix. When should we use this suffix?
There was a problem hiding this comment.
inl seems to be the standard suffix for the case where you feel a header is too long, and want to put part of it in a separate file:
https://www.oreilly.com/library/view/c-cookbook/0596007612/ch02s06.html
There was a problem hiding this comment.
The example in the linked page makes sense. It separates declarations and implementations. That doesn't seem to be the case with Struct?
There was a problem hiding this comment.
For the case of Struct, I am considering StructHandle as an interface (with PolymorphicValue) for struct implementation, but Struct and Accessor and NotImplementedStruct as implementation detail for struct. I agree that this separation of interface vs detail is not accurate, but still, I think:
- It's better to put them in a separate file.
- I can not think of a better name than
.inlfor that separate file.
I can name it to struct.h, but I have never seen one header includes another header in its end for pulling in more thing. But I have seen the name inl being used a few times. There is an example for using *-inl.h for implementations like inline function and numeric_limits. https://github.com/pytorch/pytorch/blob/main/c10/util/Half-inl.h
There was a problem hiding this comment.
That makes sense. Thanks for the explanation.
See note `[Struct Support in PolymorphicValue]` for description, and the new test `PolymorphicValueTest.Struct` for examples.
See note
[Struct Support in PolymorphicValue]for description, and the new testPolymorphicValueTest.Structfor examples.