Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Explicitly specify target in Compilation constructor #5506
Explicitly specify target in Compilation constructor #5506
Changes from all commits
d0e0cc1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
If this is the pattern to be adopted does the visibility of TR::Compiler->target need to change to stop people accidentally using it rather than the target from the compilation? Having the two and having them potentially vary seems dangerous and likely to produce subtle bugs...
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.
I was suggesting to not attach a default value to
_target
and force user to specify one when they useTR::Compilation()
.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.
I think @andrewcraik's concern is around other areas of the compiler codebase using
TR::Compiler->
such as the optimizer or codegen and expecting it to be the same ascomp()->target()->
. Does that sound correct?Whether we specify a
_target
or not inTR::Compilation()
, his concern will still be valid.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.
@dchopra001 yup - any time there are two ways to answer seemingly the same question and they don't give the same answer you will get bugs. So I would prefer we find a way to avoid this duality or prevent the bugs before they happen through the structure of the code if possible.
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.
I think this was a problem before as well though. We would change the
comp()->target
'scpu
inside theTR::Compilation
constructor. So if anyone was usingTR::Compiler->target.cpu
to grab information, it would end up being incorrect. I don't think the code in this PR specifically is introducing this problem.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 okay, that seems like a tough issue to solve and we've already run into countless bugs related to
comp()->target()
vs.TR::Compiler->target
. In places where we are not doing compilation, TR::Compiler->target is still needed.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.
Most of the queries to the target is done via the comp object; there are some outstanding locations where that hasn't happened (see #4518). I think my intention originally was to make the
_target
private toTR::Compiler
but I couldn't do it because of those outstanding locations.EDIT: Here's the PR where the switch to comp local target was made: #4568
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.
I believe changes were made as part of the processor detection work to avoid using
TR::Compiler->target.cpu.getSupportsArch
and only usecomp()->target().cpu.isAtLeast
when checking for a particular architecture level support. I believe this is the only area that would be different at the moment.But I agree, this is an issue, and I did have to deal with the above mentioned problem on Z.