-
Notifications
You must be signed in to change notification settings - Fork 38
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
[ETFeeder] Update attrs to optional #8
[ETFeeder] Update attrs to optional #8
Conversation
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
modified: et_feeder/et_feeder_node.cpp modified: et_feeder/et_feeder_node.h
51afaab
to
ff23ee8
Compare
Thank you for your contribution. First, as et_feeder had bugs that were fixed by another PR with a different design, it is unlikely that we can approve this PR as it stands. Second, I am not sure if there's a clear advantage to having the optional keyword in the et_feeder design. Let @srinivas212 decide. |
@TaekyungHeo @changhai0109 |
@TaekyungHeo Thanks for your comments. I will check the PR #18 and migrate changes based on that. @srinivas212 @JoongunPark As we know an optional value has two states: {exist, not_exist}. The "required" field in ETFeeder can only handle "exist" cases, but not "not_exist" cases, as there should be no value of a "required" field should be mapped to a "not_exist" state since all possible values of a "required" should be valid value as a "exist" state for most basic datatypes like int or float. For example, with type int32_t, the optional filed has 2^32 possibile values in "exist" state, and 1 additional of "not_exist", however, required field can only fit 2^32 states. In current design we assume the downstream user of ETFeeder has a set of rules that, they know for a certain type of node, which attrs should be there and which are not. However, that is just an assumption. We do not know who are going to use ETFeeder in their application (as chakra is open source, it do not have constraint to its user), and how they are going to use it. @JoongunPark About the vulnerabilities, could you please show me how this change will introduce vulnerabilities. From my understanding, it does not introduce vulnerabilities, instead, it reduces the vulnerabilities as it elimitate a case of undefined behavior(user read non-exist attrs, and god know what they are reading). |
Oh I what I meant was if we don't add 'optional' keyword, the 'empty memory space with random value' can introduce vulnerabilities. So basically we are saying the same thing.
|
Hi, @srinivas212. Could you please decide whether we need optional attrs in ETFeederNode? Some recent astrasim PR are depending on this feature. If not, we need to find an alternative solution. |
Summary
For those optional attrs in chakra schema, we introduce std::optional to store attr fields, which can be used to indicate whether a attr exists or not. Also add helper functions to check if has this attr, also try_get with default values.
Test Plan
Then have output: