Skip to content

[SYCL][PI] Change const to constexpr to make GCC happy #1017

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

Merged
merged 3 commits into from
Jan 16, 2020

Conversation

jbrodman
Copy link
Contributor

GCC older than 7.2 requires constexpr instead of const.

Signed-off-by: James Brodman [email protected]

@jbrodman jbrodman requested review from bader and romanovvlad January 15, 2020 16:21
bader
bader previously approved these changes Jan 15, 2020
@jbrodman
Copy link
Contributor Author

Only the latest VS accepts "constexpr". Are we ok with some preprocessor #if s?

Clang/MSVC take "const". GCC before 7.2 requires "constexpr"

Signed-off-by: James Brodman <[email protected]>
@romanovvlad
Copy link
Contributor

Also we can consider using array of strings and enum values of which maps to corresponding values in the array:

const char *USMFunctionsNames[] = {"AAA", "BBB"};
enum USMFunctionsT {
  AAA = 0,
  BBB
}

vladimirlaz
vladimirlaz previously approved these changes Jan 16, 2020
@vladimirlaz
Copy link
Contributor

I suggest to submit the change to unblock the build and then implement improvements

@jbrodman
Copy link
Contributor Author

Ok I have no clue why that test failed.

@vladimirlaz
Copy link
Contributor

Ok I have no clue why that test failed.

This is flacky test. Please ignore it.

@bader bader merged commit 7a7f47d into intel:sycl Jan 16, 2020
CONSTFIX char clEnqueueMemcpyName[] = "clEnqueueMemcpyINTEL";
CONSTFIX char clEnqueueMigrateMemName[] = "clEnqueueMigrateMemINTEL";
CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
CONSTFIX char clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL";
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 actually thinking to just

auto constexpr clHostMemAllocName = "clHostMemAllocINTEL";

but it might not work on some old compilers... Who cares about old compilers? SYCL is about the future. :-)

CONSTFIX char clEnqueueMemAdviseName[] = "clEnqueueMemAdviseINTEL";
CONSTFIX char clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL";

#undef CONSTFIX
Copy link
Contributor

Choose a reason for hiding this comment

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

__SYCL_CONST_FIX to limit the risk of collision?

aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Feb 23, 2023
…#1017)

The behavior of -fsycl-instrument-device-code has modified the requirements
for tests which perform separate compilation. Update these tests to pull
in the needed device code to alleviate issues as seen below:

Error: unimplemented function(s) used:
__itt_offload_wi_start_wrapper is undefined
__itt_offload_wi_finish_wrapper is undefined
CompilerException Failed to parse IR
-17 (CL_LINK_PROGRAM_FAILURE)

Signed-off-by: Michael D Toguchi [email protected]
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.

6 participants