Skip to content

Conversation

mikeurbach
Copy link
Contributor

@mikeurbach mikeurbach commented Apr 29, 2025

This is just adding a test that we can concatenate lists of lists and
return the right result in the Evaluator.

@mikeurbach mikeurbach requested a review from uenoku April 29, 2025 04:09
@mikeurbach
Copy link
Contributor Author

@uenoku do you mind taking a look at this one? It was an oversight in the initial list concat roll out.

@mikeurbach mikeurbach requested a review from leonardt April 29, 2025 18:29
" %6 = om.list_create %2, %3 : !om.string"
" %7 = om.list_create %6 : !om.list<!om.string>"
" %8 = om.list_concat %5, %7 : <!om.list<!om.string>>"
" om.class.fields %8 : !om.list<!om.list<!om.string>> "
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like %8 is a a list of lists of strings, but below grabbing the result via the evaluator returns a flat list. Is this the expected behavior for the semantics of the evaluator? My intuition would've expected a nested list value, so curious why it's being flattened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh hmm you are right, i was trying to write a test for concatenating lists of lists, but i do not want to actually flatten away that structure. let me take another look at this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, I was way off--this was actually working correctly, and I was mixing up what the test expectation should be. I've update the test, and I guess I will just merge it since it doesn't hurt to have more tests.

Copy link
Contributor

@leonardt leonardt left a comment

Choose a reason for hiding this comment

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

impl/test look good to me w.r.t. the desired semantics, just a curiosity question about the choice of semantics

@@ -621,8 +647,7 @@ circt::om::Evaluator::evaluateListConcat(ListConcatOp op,

// Append each EvaluatorValue from the sublist.
evaluator::ListValue *subList = extractList(result.value().get());
for (auto subValue : subList->getElements())
values.push_back(subValue);
extractElements(subList);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this assume that the concat argument is always a list of sublists? So this doesn't support concatenating two "depth 1" lists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this was just wrong.

This is just adding a test that we can concatenate lists of lists and
return the right result in the Evaluator.
@mikeurbach mikeurbach force-pushed the mikeurbach/om-evaluator-nested-lists branch from 1e1e113 to 54bea01 Compare April 29, 2025 19:03
@mikeurbach mikeurbach changed the title [OM] Evaluate nested lists in ListConcatOp evaluator. [OM] Add test for nested lists in ListConcatOp evaluator. Apr 29, 2025
@mikeurbach mikeurbach merged commit daf5c25 into main Apr 29, 2025
5 checks passed
@mikeurbach mikeurbach deleted the mikeurbach/om-evaluator-nested-lists branch April 29, 2025 21:47
TaoBi22 pushed a commit to TaoBi22/circt that referenced this pull request Jul 17, 2025
This is just adding a test that we can concatenate lists of lists and
return the right result in the Evaluator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants