Skip to content
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

refs #13513 - adjusted access of known int values #7181

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Jan 5, 2025

No description provided.

@firewave firewave force-pushed the knownint branch 2 times, most recently from 3ac7fcc to 516a7f3 Compare January 5, 2025 12:23
Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

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

I like it.. good catch

@firewave
Copy link
Collaborator Author

firewave commented Jan 6, 2025

This obviously still needs to use the proper calls but that might silently change the behavior and I would like to know if it does. But so far I have not been able to trigger any of those asserts and I do not feel comfortable putting those actually out there.

I will still give it a spin with daca and have some other tests to run which might help with finding at least a single test case.

@firewave firewave changed the title fixed #13513 - corrected access of known int values refs #13513 - adjusted access of known int values Jan 18, 2025
@firewave
Copy link
Collaborator Author

I will take a tiered approach. Using the wrapping functions here and actually adjusting to the proper calls in a follow-up.

I am doing this because I still want to test if we might trigger this along with some other tests. And I also need to profile this to make sure that I do not accidentally introduce performance regressions. Also it is not a drop-in replacement in several cases.

@firewave
Copy link
Collaborator Author

I am doing this because I still want to test if we might trigger this along with some other tests.

Turns out the unit tests actually trigger this. I definitely ran those locally with the changes and had no failures. Not sure what I did wrong...

@firewave
Copy link
Collaborator Author

Turns out the unit tests actually trigger this. I definitely ran those locally with the changes and had no failures. Not sure what I did wrong...

The code in question was only added a few days ago. That explains why.

Comment on lines 3737 to 3743
if (dimension_.tok && (dimension_.tok->hasKnownIntValue() ||
(dimension_.tok->isTemplateArg() && !dimension_.tok->values().empty()))) {
dimension_.num = dimension_.tok->getKnownIntValue();
if (dimension_.tok) {
if (dimension_.tok->hasKnownIntValue())
dimension_.num = dimension_.tok->getKnownIntValue();
else if (dimension_.tok->isTemplateArg() && !dimension_.tok->values().empty()) {
assert(dimension_.tok->values().front().isKnown());
dimension_.num = dimension_.tok->values().front().intvalue;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chrchr-github Please have a look. You changed this logic a few days ago in 46781df.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For template arguments, the values are only possible, not known. But since getKnownIntValue() just returns the first one, it is what we want in this case (I think).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So like the previous behavior? Just unconditionally use the first value and set dimension_.known to true?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, pretty much. I imagine/hope that template arguments can have at most one value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should set those values to known in the future, and prevent unwanted knownConditionTrueFalse warnings in a different way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I imagine/hope that template arguments can have at most one value.

I will just add a different assert.

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.

3 participants