Skip to content

[SYCL][ESIMD][EMU] URL for pre-built CM_EMU library package #6027

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

Conversation

dongkyunahn-intel
Copy link
Contributor

  • For ESIMD_EMULATOR, URL for pre-built CM_EMU library package is
    provided with 'ESIMD_EMU_USE_PREBUILT_CM_PACKAGE' cmake argument

- For ESIMD_EMULATOR, URL for pre-built CM_EMU library package is
provided with 'ESIMD_EMU_USE_PREBUILT_CM_PACKAGE' cmake argument
Copy link
Contributor

@kbobrovs kbobrovs left a comment

Choose a reason for hiding this comment

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

I would suggest the following overall logic below. When running CMake, variables starting with USE_ can be overridden from the command line.

DEFAULT_LIBCM_PREBUILT_PACKAGE=github.com/.../xxx.tgz
DEFAULT_LIBCM_SOURCES=github.com/.../cm-cpu-emulation.it

if (USE_DEFAULT_LIBCM_SOURCES) {
  # USE_DEFAULT_LIBCM_SOURCES is a boolean flag
  download DEFAULT_LIBCM_SOURCES and build it
  assert(!USE_LIBCM_PREBUILT_PACKAGE && !USE_LIBCM_SOURCES)
} else if (USE_LIBCM_SOURCES) {
  # USE_LIBCM_SOURCES is a directory
  treat USE_LIBCM_SOURCES as a local source directory, and build it
  assert(!USE_LIBCM_PREBUILT_PACKAGE)
} else {
  ACTUAL_LIBCM_PREBUILT_PACKAGE=$DEFAULT_LIBCM_PREBUILT_PACKAGE
  if (USE_LIBCM_PREBUILT_PACKAGE) {
    ACTUAL_LIBCM_PREBUILT_PACKAGE=$USE_LIBCM_PREBUILT_PACKAGE
  }
  use libCM binaries pointed to by ACTUAL_LIBCM_PREBUILT_PACKAGE
}

@dongkyunahn-intel
Copy link
Contributor Author

Unrelated failures

SYCL / Linux / OCL GEN9 LLVM Test Suite

Failed Tests (1):
  SYCL :: DiscardEvents/invalid_event.cpp

SYCL / Linux / OCL x64 LLVM Test Suite

Failed Tests (1):
  SYCL :: KernelAndProgram/undefined-symbol.cpp

endif()
endif ()
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cm-emu_install)
ExternalProject_Add(cm-emu
Copy link
Contributor

Choose a reason for hiding this comment

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

ExternalProject_Add seems not the right tool for downloading pre-built packages, AFAIU, it is for adding external CMakeProjects and build them from source. Please check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FetchContent_* functions can be used for downloading archives. However, it seems that using the functions requires extra steps for CM_EMU as the downloaded library package is used for both toolchain build and kernel compilation. I would like to keep this part as it is with TODO comments due to urgency of this change set. CMake for LevelZero PI also uses ExternalProject_Add for LevelZero module and already has TODO comment for FetchContent -

#TODO: Replace ExternalProject with FetchContent for better maintainance and
.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, please add a TODO then too

if (MSVC)
message(FATAL_ERROR "Online-building of CM_EMU library is not supported under Windows environment")
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to factor out the MSVC check and do it once (there is another one at line 50).
More than that, I think it is better to check if you are running on Windows, in which case bail out. Then the MSVC check should be replaced with single platform/OS check.

)
endif()
else()
set(ACTUAL_CM_EMU_PREBUILT_PACKAGE ${DEFAULT_CM_EMU_PREBUILT_PACKAGE})
Copy link
Contributor

@kbobrovs kbobrovs Apr 28, 2022

Choose a reason for hiding this comment

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

I suggest to add a message here so that users can see what USE_* variables are available to adjust the emulator build, something like
"Neither of USE_DEFAULT_CM_EMU_SOURCE, USE_LOCAL_CM_EMU_SOURCE, USE_CM_EMU_PREBUILT_PACKAGE is set, using prebuilt libCM from ${ACTUAL_CM_EMU_PREBUILT_PACKAGE}"

@dongkyunahn-intel dongkyunahn-intel requested a review from a team as a code owner May 2, 2022 22:30
@dongkyunahn-intel
Copy link
Contributor Author

dongkyunahn-intel commented May 5, 2022

Unrelated failure from Jenkins/Precommit.

SYCL :: Basic/sampler/sampler.cpp

kbobrovs
kbobrovs previously approved these changes May 5, 2022
@kbobrovs
Copy link
Contributor

kbobrovs commented May 5, 2022

@smaslov-intel , could you please review/approve?

@dongkyunahn-intel
Copy link
Contributor Author

@kbobrovs , I updated this PR as new version of open-source CM_EMU library was released. Only download URL changed after your approval.

@smaslov-intel , would you review & approve this PR?

@dongkyunahn-intel
Copy link
Contributor Author

Unrelated failure from Jenkins/Precommit

SYCL :: Basic/queue/release.cpp

@kbobrovs
Copy link
Contributor

@smaslov-intel , please review & approve this PR

@@ -146,7 +146,7 @@ if ("hip" IN_LIST SYCL_ENABLE_PLUGINS)
set(SYCL_BUILD_PI_HIP ON)
endif()
if ("esimd_emulator" IN_LIST SYCL_ENABLE_PLUGINS)
set(SYCL_BUILD_PI_HIP ON)
set(SYCL_BUILD_PI_ESIMD_EMULATOR ON)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it documented anywhere? Is it set from anywhere, e.g. buildbot/congigure.py?

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 need to look up, but @pvchupin confirmed that this is typo. #5799 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding it's initialized at this specific point. Everything configure.py is doing is adding esimd_emulator to SYCL_ENABLE_PLUGINS under the switch.
I'm not sure if we are using SYCL_BUILD_PI_ESIMD_EMULATOR anywhere, but it seems there are a few occurrences in in LIT infra.

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.

4 participants