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

Create macro to identify openXL compiler #7480

Closed
wants to merge 1 commit into from

Conversation

ishitaR88
Copy link

Added macro CMAKE_C_COMPILER_IS_OPENXL that will be used to add compiler options for openXL

# TODO we don't actually have a clang config
# just use GNU config
set(_OMR_TOOLCONFIG "gnu")
elseif(CMAKE_C_COMPILER_ID MATCHES "^Clang$")
Copy link
Contributor

Choose a reason for hiding this comment

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

Z system will use OpenXL compiler too. Have you make sure either of the two below?

  1. Z system will not use Clang compiler ID for that expected switch; or
  2. this config setting is applicable to them as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

@r30shah please comment ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe the COMPILER_ID on Z will be IBMClang and TOOLCONFIG will be set to openxl. I would like @Deigue to confirm this.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't consider that the COMPILER_ID can be different for Z system.

Copy link
Contributor

Choose a reason for hiding this comment

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

you had better get together with @Deigue
either, both can use the same ID, if we can;
or, AIX uses a more differentiating and meaningful ID, rather than this very generic "Clang"

Copy link
Author

Choose a reason for hiding this comment

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

I can't find any existing toolconfig for "openxl" that's why I used "gnu" for now.

Copy link
Contributor

@Deigue Deigue Oct 4, 2024

Choose a reason for hiding this comment

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

I've made the compiler id related changes here: #7319 ,
also will be moving the "IBMClang$" somewhere alongside the xlc clause so that all that compiler id variations can navigate to openxl toolchain easily from one spot based on Keiths feedback.

From what I remember, I was seeing zOS as the compiler ID while running locally, but when trying a Open XL build on Jenkins for z/OS, I was seeing the compiler id come out as "IBMClang" ...

In any case, I did create my own openxl.cmake toolconfig in the PR above.

Copy link
Author

Choose a reason for hiding this comment

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

@Deigue Can this openxl.cmake be used for AIX as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say yes, because there is a section in the file I left behind that says
if(OMR_OS_AIX) , that leaves the default state of setup/configs, I suspect from xlc.cmake .

So you would be able to use that section, but you may need to adapt the AIX configs to be whatever you need to make things work.

Comment on lines 197 to 199
# OpenXL17 uses CMAKE_C_COMPILER_ID "Clang"
set(_OMR_TOOLCONFIG "gnu")
set(CMAKE_C_COMPILER_IS_OPENXL TRUE CACHE BOOL "OpenXL is the C compiler")
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines should be indented with tabs (like the rest of this file).

Copy link
Author

Choose a reason for hiding this comment

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

resolved

@@ -499,7 +499,7 @@ int32_t TR_PPCTableOfConstants::lookUp(TR::SymbolReference *symRef, TR::CodeGene
int8_t local_buffer[1024];
int8_t *name = local_buffer;
bool isAddr = false;
intptr_t myTag;
intptr_t myTag=0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a space both sides of = (like the lines above).

Copy link
Author

Choose a reason for hiding this comment

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

resolved

This macro will specify if openXL17 clang is used.

Signed-off-by: Ishita Ray <[email protected]>
@@ -499,7 +499,7 @@ int32_t TR_PPCTableOfConstants::lookUp(TR::SymbolReference *symRef, TR::CodeGene
int8_t local_buffer[1024];
int8_t *name = local_buffer;
bool isAddr = false;
intptr_t myTag;
intptr_t myTag = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems unrelated to the title of this pull request; perhaps it should be proposed separately?

Copy link
Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor

Choose a reason for hiding this comment

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

It is a good change: It just should just be independent of build configurations.

Copy link
Author

Choose a reason for hiding this comment

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

Yes. We need this change. We will add this change through another PR.

Comment on lines +200 to +206
if(CMAKE_C_COMPILER_IS_OPENXL)
set(OMR_ENV_OPENXL 1)
set(ENV{OMR_ENV_OPENXL} ${OMR_ENV_OPENXL})
else()
set(OMR_ENV_OPENXL 0)
set(ENV{OMR_ENV_OPENXL} ${OMR_ENV_OPENXL})
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we want this? Won't CMAKE_C_COMPILER_IS_OPENXL be sufficient?

Copy link
Author

Choose a reason for hiding this comment

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

That environment variable is for Makefiles to check if the compiler is openxl. I used that env variable instead of adding openxl in defaults.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

Which makefiles? With cmake, we don't write makefiles (cmake might even use another generator, e.g. ninja).
I don't see any references to OMR_ENV_OPENXL, neither in cmakefiles nor the environment; perhaps it would help if you provided a sample of how you imagine they would be used.

Copy link
Author

Choose a reason for hiding this comment

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

Following is an example where the environment variable is used in openj9/runtime/makelib/targets.mk.aix.inc.ftl

ifeq ($(OMR_ENV_OPENXL),1)
  # openxl options
  CXXFLAGS += -std=c++11 -qarch=ppc -fno-strict-aliasing -fstack-protector
else
  CXXFLAGS += -qlanglvl=extended0x -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect
endif

More use of this env variable can be found in this PR eclipse-openj9/openj9#20045

Copy link
Contributor

Choose a reason for hiding this comment

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

Those makefiles are not used when cmake is being used.

Copy link
Author

Choose a reason for hiding this comment

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

Yes. I used this CMAKE variable to let the makefiles know that the compiler is openxl. The other way of doing it may be by setting the compiler in defaults.yml

Copy link
Contributor

Choose a reason for hiding this comment

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

My point is that when using cmake, files like openj9/runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk are not used, so the reference there (in eclipse-openj9/openj9#20045) is not helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

these PRs were intended to make changes which allows builds by all available (and being used) compilers (i.e. xlC/xlclang/OpenXL), through either cmake or UMA. so, we need to keep these changes anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we would like UMA builds to be possible with OpenXL (although I consider that a bonus, not a necessity), but setting an environment variable for cmake can't benefit UMA builds, so the question remains: why is the variable being set (in cmake)?

@midronij
Copy link
Contributor

Ishita will be away for the foreseeable future, so I will be taking over this contribution here: #7561
@zl-wang could you please close this PR when you have a moment?

@zl-wang
Copy link
Contributor

zl-wang commented Nov 27, 2024

i remembered she had 3 PRs (2 OMR and 1 OpenJ9). @midronij have you squashed that 2 OMR into your single one? also, you might need a separate one to init myTag to zero (in order to avoid OpenXL generating garbage code).

@midronij
Copy link
Contributor

midronij commented Nov 27, 2024

This PR is included in my new OMR PR, yes. Specifically in this commit: 201f3c8. The fix to initialize myTag is also included (a1c05d4), but I can separate it out into another PR if that would be better

@dsouzai
Copy link
Contributor

dsouzai commented Nov 27, 2024

Closing as requested.

@dsouzai dsouzai closed this Nov 27, 2024
midronij added a commit to midronij/omr that referenced this pull request Nov 28, 2024
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.

7 participants