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

Fix and enable a large subset of tests on the z/OS OMR CI #4733

Merged
merged 22 commits into from
Jan 24, 2020

Conversation

fjeremic
Copy link
Contributor

@fjeremic fjeremic commented Jan 17, 2020

In this PR as a sequence of commits we fix a whole host of issues to get most of the tests currently ran by ctest working on z/OS. We can use ctest on z/OS as well, however at the moment the thread extended test is hanging and is preventing us from making the switch. Several other tests have failures which need to be investigated. However we are well on our way.

The following table represents the list of tests currently running on other platforms and the before/after work once this PR is merged.

Test name Runs before this PR Runs after this PR Test status Reason/Comment
gcexample ✔️ ✔️
python "run_tests.py" ✔️ ✔️
conditionals ✔️ ✔️
isSupportedType ✔️ ✔️
iterfib ✔️ ✔️
nestedloop ✔️ ✔️
pow2 ✔️ ✔️
simple ✔️ ✔️
worklist ✔️ ✔️
omralgotest ✔️ ✔️ ✔️
TestBytes ✔️ ✔️
TestIntrusiveList ✔️ ✔️
TestTypeTraits ✔️ ✔️
omrporttest #4747 (excluded via ctest)
omrrastest ✔️ ✔️ ✔️
omrsubscribertest ✔️ ✔️ ✔️
omrtraceoptiontest ✔️ ✔️ ✔️
omrsigtest ✔️ ✔️ ✔️
omrthreadextendedtest #4746 (excluded via ctest)
omrthreadtest 1 ✔️ ✔️ Pthread issues?
omrthreadtest 2 ✔️ ✔️ Pthread issues?
omrthreadtest 3 ✔️ ✔️ Pthread issues?
omrutiltest ✔️ ✔️ ✔️
omrvmtest ✔️ ✔️ ✔️
omrgctest ✔️ ✔️
jitbuildertest ✔️ ✔️
compilertest #4719 (excluded via ctest)
triltest ✔️ ✔️
comptest ✔️ ✔️

The end goal will be to get all tests functionally running on z/OS and have 100% parity with other platforms running via ctest. Goal has been achieved. We are currently running all checkmarked tests above via ctest on z/OS!

The recursive case was incorrectly placed under a define when it should
be always on by default. We also take this opportunity to migrate some
statics which are only used within the function into local statics.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
The cursor currently needs to be specified to `genCallNOPAndDescriptor`
to ensure it is generated after the call instruction. Currently because
of the way the `TR::S390Imm2Instruction` constructor works it ends up
generating the call descriptor at the start of the instruction stream
if a `NULL` preceeding instruction is specified. This will be fixed in
outside the scope of this change.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
We currently lack full trampoline support in OMR. To get JitBuilder
callouts to native functions working we must ensure we can encode the
distance from the JIT method body to the native with a `BRASL`
instruction which only has a signed 32-bit range.

The only way to currently achieve this is to allocate all code cache
memory below the bar. Once JitBuilder is hooked up to the port library
we should be able to safely use the port library APIs to accomplish
this. See eclipse-omr#4719 for more details to references of how this is done in
OpenJ9.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
The current Tril lexer transition table assumes ASCII so it only
creates 128 entries for the transitions. This will not work on z/OS
because the native encoding is EBCDIC, so the table size needs to be
bumped up to 256 to handle all EBCDIC characters so we have proper
transitions.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
The z/OS system linkage uses the `saveArguments` function to offload
arguments to the stack if needed. This function traverses the parameter
list looking for arguments which are part of the linkage (linkage
arguments) and if needed it stores them to the stack for use in the
method.

This is currently not done on z/OS for Doubles. What ends up happening
is that the linkage register index (lri) is -1 for Double parameters
and as such we never store them off to the stack. Subsequently the
method body when referencing such parameters tries to load them from
the stack and we get back garbage.

To fix this we simply enable the logic to mark Double linkage argument
registers with proper indices on z/OS.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
On z/OS and Linux on Z we also do not currently support calls, so skip
the MinimalTest on those platforms, including other ones which do not
support calls.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
The shutdown sequence for the compilation controller was never called.
On platforms such as z/OS this is problematic because JitBuilder and
Tril initialize and shutdown the JIT many times, each time leaking
resources in the compilation controller.

One such resource is the thread local TLS `OMR::compilation` variable
which is typically accessed through `TR::comp()`. This TLS variable was
not being properly freed with every shutdown, eventually resulting in
inability to allocate the TLS variable which causes crashes later on.

The JIT compiler currently assumes `TR::comp()` is always non-NULL in
places where it should be available, thus we add fatal asserts if we
are for some reason unable to allocate this variable. These asserts
would have made investigating this problem trivial.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
The allocated code cache memory was not being freed up on z/OS causing
memory leaks and eventual failure of tests which would not be able to
allocate code cache memory.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
For consistency with all other header files in the compiler component.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
@fjeremic fjeremic changed the title Fix and enable a large subset of tests on the OMR CI Fix and enable a large subset of tests on the z/OS OMR CI Jan 17, 2020
@fjeremic
Copy link
Contributor Author

Suggesting @mstoodle and @Leonardo2718 for reviews.

@fjeremic
Copy link
Contributor Author

@genie-omr build all

This is a port of commit f816690 for z/OS. The same reasoning applies
and will hopefully be fixed in eclipse-omr#4719.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Copy link
Contributor

@mstoodle mstoodle left a comment

Choose a reason for hiding this comment

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

Mostly looks good to me. I opened a couple of issues to account for the things you found.

I am no z platform expert, so I'm hoping @joransiu will look over those linkage parts, in particular.

@@ -42,7 +42,7 @@ pipeline {
timestamps {
dir('build') {
echo "Sanity Test..."
sh'''./omralgotest -avltest:fvtest/algotest/avltest.lst && ./omrvmtest && ./omrutiltest && ./omrsigtest && ./omrrastest && ./omrsubscribertest && ./omrtraceoptiontest'''
sh'''ctest -V'''
Copy link
Contributor

Choose a reason for hiding this comment

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

not your mistake, but why doesn't this file have a copyright header?

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #4753 .

@@ -28,7 +28,7 @@ pipeline {
timestamps {
dir('build') {
echo "Sanity Test..."
sh'''./omralgotest -avltest:fvtest/algotest/avltest.lst && ./omrvmtest && ./omrutiltest && ./omrsigtest && ./omrrastest && ./omrsubscribertest && ./omrtraceoptiontest'''
sh'''ctest -V'''
Copy link
Contributor

Choose a reason for hiding this comment

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

same problem here: no copyright header

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #4753 .

compiler/ilgen/OMRMethodBuilder.hpp Show resolved Hide resolved
jitbuilder/control/Jit.cpp Show resolved Hide resolved
Copy link
Contributor

@mstoodle mstoodle left a comment

Choose a reason for hiding this comment

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

I have no concerns, but want a z expert other than Filip :) to review before it's merged.

@fjeremic
Copy link
Contributor Author

@genie-omr build zos

Comment on lines 72 to 81
#if defined(PPC)
// TODO (#4765): Fix the Power linkage and enable this test
// TODO (#4764): This is a poor man's SKIP_IF which is only available for Tril tests currently. We should find a
// nice home for this useful utility so we can use it in JitBuilder tests as well.
const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
::testing::Test::RecordProperty("skipped", "Known Bug");
std::cout << "Known Bug" << ": Skipping test: " << test_info->name() << "\n " << "Power system linkage cannot handle stack arguments (see issue #4765)" << "\n";
SUCCEED() << "Power system linkage cannot handle stack arguments (see issue #4765)";
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is another hack we are adding in, but I don't think this PR is the correct place to solve this. I've opened up two new issues to address the hack added here.

@fjeremic
Copy link
Contributor Author

This issue seems to be turning into a goldmine of spawning other issues. To avoid scope creep I will stop here as the number of fixes is getting large now. The task at hand has been achieved. We have parity now on z/OS and are running almost all the tests via ctest :yay:

One final whirl:

@genie-omr build all

lri = numVRFArgs;
}

numVRFArgs++;
Copy link
Contributor

@joransiu joransiu Jan 24, 2020

Choose a reason for hiding this comment

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

Reading the Vendor Interfaces, I think the same change for FPRs above to bump numGPRArgs should be applicable for VRs as well. Though it's not clear to me from the docs whether it would be numGPRArgs += 2 or 4.... as their prototype f29 suggests GPR would only hold 4 bytes worth of data for VRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find an updated reference for XPLINK with vector registers. Do they even participate in linkage conventions? How does one pass a vector register argument? If you have any links that would be appreciated. I'll make the change though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was referencing: https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3SA380688/$file/ceev100_v2r3.pdf around page 143/144, and the examples around page 911.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a03a579

Copy link
Contributor

Choose a reason for hiding this comment

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

Ever consider the alignment requirement of passing Vector arguments, i.e. leaving more holes in GPR side? or, is there alignment requirement at all? I remembered I did all these on AIX side before, need to read the code in details to see why it failed now.

Copy link
Contributor

@joransiu joransiu left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Thanks for addressing all these issues @fjeremic. Just have one comment about bumping of GPRs for vector parameters as well to handle the following from the Vendor Interfaces doc.

Up to eight vector arguments are passed in VR24-31, and not passed in the argument area, although space is set aside for these arguments in the argument area."

Implement XPLINK linkage register to parameter mapping as described in
the XPLINK documentation.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
On Linux on Z for example we can fit 4 integral and 4 floating point
arguments into registers for linkage. This means that no arguments are
ever passed through the stack. We want to test this path (it actually
has a bug which is fixed in the next commit) so we double the number of
arguments to the test to ensure some arguments are passed on the stack.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Because the Z architecture is big-endian we need to spill the entire
GPR contents for incoming arguments in the register to the stack, since
our stack slots on 64-bit are 64-bit wide. The parameters used within
the method are then properly initialized with offsets into the stack
slot. For example for a 4-byte parameter, we will spill all 8 bytes on
entry if needed and initialize the offset of the parameter with a +4
increment, so that the trees which end up using the parameter within
the method will only access the clean bits of the argument.

This also works for sub-32-bit types as well which more or less fixes
the issues noted in eclipse-omr#3525.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
See eclipse-omr#4746.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
See eclipse-omr#4747.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Currently due to a limitation of the z/OS CMake port we require to
specify an explicit `LIBPATH` so that the various tests which
dynamically load DLLs can find them. Once CMake is fixed to properly
generate the dynamic libraries in the correct directories setting of
the `LIBPATH` environment variable should be removed. See eclipse-omr#4761.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
@fjeremic
Copy link
Contributor Author

@mstoodle do you want to be a committer for this one?

@genie-omr build all

@mstoodle mstoodle self-assigned this Jan 24, 2020
@mstoodle
Copy link
Contributor

Nice to see all those tests running and passing on z/OS ! Even some JitBuilder tests are now enabled and passing! Woohoo!

Once the appveyor tests run and pass, just for pedantry, I'll merge :) .

@mstoodle
Copy link
Contributor

Thanks @fjeremic!

@mstoodle mstoodle merged commit 9d16f0d into eclipse-omr:master Jan 24, 2020
fjeremic added a commit to fjeremic/omr that referenced this pull request Feb 6, 2020
Now that eclipse-omr#4733 has been merged we have fixed the issue which was
preventing us from running various sub-int32 tests because the
incoming arguments were not being loaded correctly. We can now
re-enable all the sub-int32 tests which were disabled as a result.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
fjeremic added a commit to fjeremic/omr that referenced this pull request Feb 6, 2020
Now that eclipse-omr#4733 has been merged we have fixed the issue which was
preventing us from running various sub-int32 tests because the
incoming arguments were not being loaded correctly. We can now
re-enable all the sub-int32 tests which were disabled as a result.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants