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

[CI] Use oneAPI for Windows postcommit builds #16355

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Dec 12, 2024

Getting this working was an unbelievable amount of work. I hit so many weird issues caused by dumb Windows things (case insensitivity, cmd vs bash, bugs in cmake/ninja/sccache themselves) but finally I got something that consistently passes.

You can see the funniest dumb Windows issue in the comment in the CMake file change.

The basic idea is to extend the Windows build workflow to allow using icx, add an action to setup the oneAPI environment, call it from the build action and the test action (since we need some of the shared libs on path even for testing), and fix some oneAPI-only build issues.

We need to do some Powershell magic after calling the oneAPI setup bat script because the environment variables get lost since it's run in a subprocess.

We also switch to ccache instead of sccache, because sccache doesn't support icx (actually neither does ccache, but I added it upstream here and we are using a local build of ccache, it was easier to add support to ccache). Manually tested it to confirmed cache reads and write are working as expected.

At some point we should probably investigate why some tests fail or some compiler flags are required with icx only and not cl, but let's do that as separate work because I am done with Windows for now.

I already set up all Windows runners used here to work with this change.

Next I'll add oneAPI builds on Linux, which I really hope is easier.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
@sarnex sarnex marked this pull request as ready for review December 13, 2024 16:12
@sarnex sarnex requested review from a team as code owners December 13, 2024 16:12
@aelovikov-intel
Copy link
Contributor

We also switch to ccache instead of sccache

@bader , do you know the history why we used sccache on win?

@sarnex
Copy link
Contributor Author

sarnex commented Dec 13, 2024

Google says they are exactly the same except sccache supports Rust, which we shouldn't care about. Also I have no idea how to add icx support to sccache, it was trivial for ccache.

run: |
cmake --build build --target check-sycl
if [[ ${{inputs.compiler}} == 'icx' ]]; then
export LIT_FILTER_OUT="host_tanpi_double_accuracy"
Copy link
Contributor

Choose a reason for hiding this comment

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

Was host_tanpi_double_accuracy failing with icx? Do we have any related bug report?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this and some LIT tests are failing when the compiler is built with icx. I don't know why, I made #16362 to look at it later, I've had enough with windows for a few days


with:
compiler: icx
build_configure_extra_args: --cmake-opt=-DCMAKE_C_FLAGS="/clang:-Wno-nonportable-include-path /clang:-Wno-cast-function-type-mismatch" --cmake-opt=-DCMAKE_CXX_FLAGS="/clang:-Wno-nonportable-include-path /clang:-Wno-cast-function-type-mismatch" --cmake-opt="-DCMAKE_EXE_LINKER_FLAGS=/manifest:no" --cmake-opt="-DCMAKE_MODULE_LINKER_FLAGS=/manifest:no" --cmake-opt="-DCMAKE_SHARED_LINKER_FLAGS=/manifest:no"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should go to CMake instead, but it's been a tremendous amount of work already, so I won't insist :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree but yeah please allow me some time regain my sanity, will do in follow up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made #16363 for follow up

type: choice
options:
- cl
- icx
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it work without build_configure_extra_args for manual dispatch? Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need this to pass the compiler flags we set in sycl-post-commit.yml, and then we use it an an envvar named ARGS in this file that is passed to configure.py, we need the compiler flags to get the thing to build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

talked offline, fixed in latest commit, thx

run: |
if [[ ${{inputs.compiler}} == 'icx' ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly to CMake options, that's better be handled elsewhere (LIT feature + REQUIRES?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i think its reasonable to add a LIT feature but hopefully I can do this in a follow-up commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made #16363 for follow up

Comment on lines +226 to +230
# When building using icx on Windows, the VERSION file
# produced by cmake is used in source code
# when including '<version>' because Windows is
# case-insensitive and icx adds the build directory
# to the system header search path.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow... Just speechless...

Do you know if "VERSION" is some standard naming? If not, maybe we can rename it instead of this workaround.

Copy link
Contributor Author

@sarnex sarnex Dec 13, 2024

Choose a reason for hiding this comment

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

the variable as a CMake variable is standard but writing it to disk seems to be somewhat standard but not done by every project. im pretty sure here it's coming from this code.

static constexpr int MemoryMapCounterBase = 1000;
static int MemoryMapCounter = MemoryMapCounterBase;
#ifndef _WIN32
Copy link
Contributor

Choose a reason for hiding this comment

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

For other reviewers - looks like we have some tests excluded on _WIN32 making these static functions unused. I suppose icx emits a warning about that and then it gets turned into a error due to -Werror.

Copy link
Contributor Author

@sarnex sarnex Dec 13, 2024

Choose a reason for hiding this comment

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

yeah tbh i dont know why these dont error with cl, but they seem unused always on windows so this change should be safe for any compiler

@bader
Copy link
Contributor

bader commented Dec 13, 2024

We also switch to ccache instead of sccache

@bader , do you know the history why we used sccache on win?

I don't remember all the details. From what I recall, we tried ccache and it didn't work for us back then. Either there was some issues with using it with MSVC or some issues with installing ccache in CI.
IIRC, sccache has some unique features missing in ccache like being able to store cache on remote machine, but I don't think we utilize them in our workflow.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

Thanks for all the heavy uplift done here. Future improvements/cleanup can be done in other PRs (possibly by other folks :)).

Copy link
Contributor

@aarongreig aarongreig left a comment

Choose a reason for hiding this comment

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

UR LGTM

@bader
Copy link
Contributor

bader commented Dec 13, 2024

We also switch to ccache instead of sccache, because sccache doesn't support icx (actually neither does ccache, but I added it upstream here and we are using a local build of ccache, it was easier to add support to ccache). Manually tested it to confirmed cache reads and write are working as expected.

I see that you added support only for MSVC compatible drivers: icx and icx-cl. Intel Compiler provides Clang-compatible icpx and icx-cc on Windows as well. Shouldn't ccache support these drivers as well?

@sarnex
Copy link
Contributor Author

sarnex commented Dec 13, 2024

@bader Yeah probably but I'd prefer to do it in another PR after upstream merges this one, I'll retitle it to be clear it's MSVC only

@sarnex sarnex merged commit 4e8b647 into intel:sycl Dec 13, 2024
23 checks passed
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.

5 participants