-
Notifications
You must be signed in to change notification settings - Fork 396
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
Create relocation records of type TR_BlockFrequency and TR_RecompQueuedFlag #5202
Create relocation records of type TR_BlockFrequency and TR_RecompQueuedFlag #5202
Conversation
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.
Overall looks ok to me.
@@ -2970,6 +2970,14 @@ OMR::Power::CodeGenerator::addMetaDataForLoadAddressConstantFixed( | |||
TR::DebugCounter::generateRelocation(comp, firstInstruction, node, counter, seqKind); | |||
return; | |||
} | |||
|
|||
case TR_BlockFrequency: | |||
{ |
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.
Formatting.
I don't have questions related to the "how" in this PR but I did have a question around "why" we feel that relocating this data is important ? |
@genie-omr build all |
It would be good if that information was in the commit message too. |
Ping @ashu-mehra this is probably only awaiting some more description from you before it can be considered for merging. |
Ping again to see if this can be pushed forward in the next few days |
c4d5d33
to
df97e33
Compare
The request for a more descriptive commit message in prior comments probably needs to be addressed. |
|
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for recompilation queue flag. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
df97e33
to
c215809
Compare
I have updated the commit messages to provide more information. |
Okay if you don't mind, please make it WIP until you are ready to have me consider it for merging. That way, I don't mistakenly take action when you did not want me to. |
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for recompilation queue flag. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
c215809
to
c16938a
Compare
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for recompilation queue flag. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
Any update on this ? |
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for recompilation queue flag. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for recompilation queue flag. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records specifically for block frequency. Signed-off-by: Ashutosh Mehra <mehra.ashutosh@ibm.com>
deeb63f
to
f77ef57
Compare
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records for block frequency and the recompilation queued flag. Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
f77ef57
to
831b33e
Compare
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. OpenJ9 PR eclipse-omr/omr#5202 creates the necessary structures representing the relocation record for this data. This commit adds the code for generating the relocation records for block frequency and the recompilation queued flag. Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
831b33e
to
3943892
Compare
Windows failure is due to SegFault in |
@dsouzai another pr for your review. |
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 noticed that you you've only created the relo records for x and p; I know that this stuff isn't supported on the other platforms, but you might as well add them for the others. That way when it's finally enabled on the other platforms, the infra will already be in place.
(uint8_t *)recordInfo, | ||
TR_BlockFrequency, self()); | ||
break; | ||
} |
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.
How come you don't also need a relo record for TR_RecompQueuedFlag
here?
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.
TR_RecompQueuedFlag
gets taken care by the default case towards the end of the method:
if (!relo)
{
relo = new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(
firstInstruction,
(uint8_t *)value,
(uint8_t *)seqKind,
(TR_ExternalRelocationTargetKind)typeAddress,
self());
}
(uint8_t *)recordInfo, | ||
(TR_ExternalRelocationTargetKind)typeAddress, self()), | ||
__FILE__, __LINE__, node); | ||
} |
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.
How come you don't also need a relo record for TR_RecompQueuedFlag
here?
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.
TR_RecompQueuedFlag
gets taken care by the last else if
block:
else if (typeAddress != -1)
{
TR_RelocationRecordInformation *recordInfo = ( TR_RelocationRecordInformation *)comp->trMemory()->allocateMemory(sizeof( TR_RelocationRecordInformation), heapAlloc);
recordInfo->data1 = (uintptr_t)value;
recordInfo->data3 = orderedPairSequence2;
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation((uint8_t *)firstInstruction,
(uint8_t *)secondInstruction,
(uint8_t *)recordInfo,
(TR_ExternalRelocationTargetKind)typeAddress, self()),
__FILE__, __LINE__, node);
}
//TR::StaticSymbol *staticSym = sr.getSymbol()->getStaticSymbol(); | ||
//TR_ASSERT(staticSym, "Expected static symbol for block frequency\n"); | ||
//TR::Relocation *relocation = new (cg->trHeapMemory()) TR::ExternalRelocation(displacementLocation, (uint8_t *)staticSym->getStaticAddress(), TR_BlockFrequency, cg); |
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.
Can these comments be removed?
TR::Relocation *relocation = new (cg->trHeapMemory()) TR::ExternalRelocation(displacementLocation, (uint8_t *)recordInfo, TR_BlockFrequency, cg); | ||
cg->addExternalRelocation(relocation, __FILE__, __LINE__, containingInstruction->getNode()); | ||
} | ||
} |
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.
How come you don't also need a relo record for TR_RecompQueuedFlag
here?
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.
hmm it does look like TR_RecompQueuedFlag
should be handled here, but during my testing I noticed relocation records are getting generated for TR_RecompQueuedFlag
. Probably they are getting generated from other locations.
Let me check why it is working without the relo record for TR_RecompQueuedFlag
here.
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.
Looking at the relocation records generated with this change set I see TR_BlockFrequency
is getting generated twice for the same offset, eg:
TR_BlockFrequency (102) /home/asmehra/data/ashu-mehra/openj9-openjdk-jdk11/omr/compiler/x/amd64/codegen/OMRMemoryReference.cpp 524 0191 0151 00007F9E174BFD80
TargetAddress1:00007F9E15DE4D10, TargetAddress2:0000000000000000
TR_BlockFrequency (102) /home/asmehra/data/ashu-mehra/openj9-openjdk-jdk11/omr/compiler/x/codegen/X86BinaryEncoding.cpp 2937 0191 0151 00007F9E174BFD80
TargetAddress1:00007F9E15DE4DA0, TargetAddress2:0000000000000000
but TR_RecompQueuedFlag
is generated only once.
OMR::X86::AMD64::MemoryReference::generateBinaryEncoding
creates a new instruction to move the addr to reg [1].
Then we add metadata for the address as part of which relocation records are generated [2].
This is the place where this patch has code for creating relo record for TR_BlockFrequency
but not for TR_RecompQueuedFlag
.
Then further down in OMR::X86::AMD64::MemoryReference::generateBinaryEncoding
when the binary encoding for the new instruction is generated [3], we again generate metadata [4] where this patch creates relo records for TR_BlockFrequency
and TR_RecompQueuedFlag
.
So effectively we end up creating duplicate relo records for TR_BlockFrequency
. We should be generating the relo record only at one place, which I feel should be when adding metadata for the instruction. Going by that logic, the relo record generated at [2] for TR_BlockFrequency
should be avoided.
On similar note, probably TR_DebugCounter
also has similar issue of duplicate records getting generated.
@dsouzai your thoughts on this?
[1] https://github.com/eclipse/omr/blob/bded46caf73287830139853961ffacb96cc9758e/compiler/x/amd64/codegen/OMRMemoryReference.cpp#L612
[2] https://github.com/eclipse/omr/blob/bded46caf73287830139853961ffacb96cc9758e/compiler/x/amd64/codegen/OMRMemoryReference.cpp#L644
[3] https://github.com/eclipse/omr/blob/bded46caf73287830139853961ffacb96cc9758e/compiler/x/amd64/codegen/OMRMemoryReference.cpp#L664
[4] https://github.com/eclipse/omr/blob/bded46caf73287830139853961ffacb96cc9758e/compiler/x/codegen/X86BinaryEncoding.cpp#L2796
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.
Hm interesting. Yeah I think you're right; the debug counter relo doesn't look like it belongs in [2] above, especially since there's no TR_DataAddress
in [2]. So TR_BlockFrequency
doesn't belong in [2] either.
|
||
case TR_RecompQueuedFlag: | ||
{ | ||
TR::StaticSymbol *staticSym = symbol->getStaticSymbol(); |
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.
This seems to be unused.
} | ||
else if (symbol->isRecompQueuedFlag()) | ||
{ | ||
TR::StaticSymbol *staticSym = symbol->getStaticSymbol(); |
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.
This seems to be unused.
3943892
to
9475912
Compare
4d70afa
to
27a98fd
Compare
In OpenJ9 the JProfiling framework is used to create profiled code which contains references to internal data structures like block frequencies stored in `TR_BlockFrequencInfo` class, or the flag for checking if the method is already in recompilation queue. To support AOT compilation for such code, we need to generate relocation records for such data structures referenced by the compiled code. This commit adds the code for generating the relocation records for block frequency and the recompilation queued flag. Currently it only handles x and p architectures. Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
27a98fd
to
c249f4d
Compare
@dsouzai I have updated the pr addressing the review comments and also added the changes for z arch. Thanks to @dchopra001 for testing the z changes using eclipse-openj9/openj9#11625. |
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.
lgtm; thanks @ashu-mehra
@genie-omr build all |
@vijaysun-omr can this be merged? |
In OpenJ9 the JProfiling framework is used to create profiled code
which contains references to internal data structures like block
frequencies stored in
TR_BlockFrequencInfo
class, or the flag forchecking if the method is already in recompilation queue.
To support AOT compilation for such code, we need to generate relocation
records for such data structures referenced by the compiled code.
This commit adds the code for generating the relocation records
for block frequency and the recompilation queued flag.
Currently it only handles x and p architectures.
Signed-off-by: Ashutosh Mehra mehra.ashutosh@ibm.com