Skip to content

[SYCL][Cmake] Redesign OpenCL dependencies #3485

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 10 commits into from
Apr 30, 2021
Merged

Conversation

pvchupin
Copy link
Contributor

@pvchupin pvchupin commented Apr 4, 2021

  • Moved from ExternalProject to FetchContent:
    • External dependencies are downloaded at configure stage, not build
    • All dependencies targets become available earlier and become reusable
    • All dependencies are consolidated under _deps directory
    • Simplified cmake files for better maintenance
  • Outline opencl deps into separate opencl/CMakeLists.txt
  • Update other targets to new deps accordingly
  • Cleaned up CUDA plugin and CUDA unittest target dependencies
  • Removed broken --system-ocl configure feature
  • Added comments inlined for not very clear logic in our cmake build system

Signed-off-by: Pavel V Chupin pavel.v.chupin@intel.com

@pvchupin pvchupin requested review from bader, smaslov-intel and a team as code owners April 4, 2021 07:49
@pvchupin pvchupin marked this pull request as draft April 4, 2021 07:52
@pvchupin pvchupin force-pushed the opencl-cmake1 branch 3 times, most recently from 47665e9 to 40af3a5 Compare April 5, 2021 05:14
smaslov-intel
smaslov-intel previously approved these changes Apr 5, 2021
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

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

LGTM

@pvchupin pvchupin force-pushed the opencl-cmake1 branch 2 times, most recently from 2f0171b to 5300a98 Compare April 13, 2021 04:55
* Moved from ExternalProject to FetchContent:
  * External dependencies are downloaded at configure stage, not build
  * All dependencies targets become available earlier and become reusable
  * All dependencies are consolidated under _deps directory
  * Simplified cmake files for better maintenance
* Outline opencl deps into separate opencl/CMakeLists.txt
* Update other targets to new deps accordingly
* Added comments inlined for not very clear logic in our cmake build system

Signed-off-by: Pavel V Chupin <pavel.v.chupin@intel.com>
@pvchupin pvchupin marked this pull request as ready for review April 14, 2021 15:47
@pvchupin pvchupin requested a review from vladimirlaz April 14, 2021 15:48
@pvchupin
Copy link
Contributor Author

Finished the cleanup. Now it's ready for review.
I'm planning to do separate follow up patches. Next one is switching opencl-aot to reuse the same OpenCL deps.
I'm also thinking on moving opencl-aot into opencl folder. Let me know what you think about idea and potential impact.

@pvchupin pvchupin requested a review from dm-vodopyanov April 14, 2021 15:50
@dm-vodopyanov
Copy link
Contributor

I'm also thinking on moving opencl-aot into opencl folder. Let me know what you think about idea and potential impact.

LGTM to move opencl-aot to opencl folder. The only problem is that opencl-aot history will be lost. It looks like there is a way to see the history before the movement, but it is unideal and may not work correctly sometimes. Anyway, there are 3-4 contributors to this component and it is ok to lose the history.

@bader bader requested a review from alexbatashev April 15, 2021 16:42
bader
bader previously approved these changes Apr 15, 2021
Copy link
Contributor

@bader bader 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 cleaning this up.
opencl/CMakeLists.txt looks good to me with one minor comment.

@bader
Copy link
Contributor

bader commented Apr 15, 2021

@pvchupin, please, resolve merge conflicts.

alexbatashev
alexbatashev previously approved these changes Apr 15, 2021
Copy link
Contributor

@alexbatashev alexbatashev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor Author

@pvchupin pvchupin left a comment

Choose a reason for hiding this comment

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

Thank you all for good review. I'm going to try suggestions mentioned.
Give me some time for the next iteration.

@pvchupin pvchupin dismissed stale reviews from alexbatashev and bader via adf882f April 16, 2021 05:04
@bader bader changed the title [SYCL][Cmake] Redesign opencl dependencies [SYCL][Cmake] Redesign OpenCL dependencies Apr 27, 2021
@pvchupin
Copy link
Contributor Author

-system-ocl configure?

It didn't work for me. @vladimirlaz suggested a few tricks with paths, but it didn't help. Either it has some special undocumented prerequisites, or it's just broken for a while. We decided to cleanup the vars that's been used and I went further in removing the option from the script. These deps are downloaded in a few seconds anyway with the specific version we want.

@bader
Copy link
Contributor

bader commented Apr 27, 2021

@pvchupin, FYI. BuildBot CI explicitly builds icd-loader in a separate dependency step: http://ci.llvm.intel.com:8010/#/builders/2/builds/10563/steps/7/logs/stdio.

I think this patch will introduce unnecessary redundancy in building ICD loader twice.
IMO, we should have an option to skip fetching and building OpenCL ICD-loader.

@bader
Copy link
Contributor

bader commented Apr 27, 2021

-system-ocl configure?

It didn't work for me. @vladimirlaz suggested a few tricks with paths, but it didn't help. Either it has some special undocumented prerequisites, or it's just broken for a while. We decided to cleanup the vars that's been used and I went further in removing the option from the script. These deps are downloaded in a few seconds anyway with the specific version we want.

I think we should fix this feature rather than removing it.

@pvchupin
Copy link
Contributor Author

@pvchupin, FYI. BuildBot CI explicitly builds icd-loader in a separate dependency step: http://ci.llvm.intel.com:8010/#/builders/2/builds/10563/steps/7/logs/stdio.

I think this patch will introduce unnecessary redundancy in building ICD loader twice.
IMO, we should have an option to skip fetching and building OpenCL ICD-loader.

Currently it's built twice because opencl-aot builds it separately. Note that it's been built twice before my patch. Next patch I'm going to make for opencl-aot will start reusing dependency.

@pvchupin
Copy link
Contributor Author

I think we should fix this feature rather than removing it.

Can you or anybody specify what this feature was supposed to do and when/how it was working when it was working? Or how to use it now if it's still working for anybody.
I don't see much value to fix it if it's broken indeed.

@pvchupin
Copy link
Contributor Author

@pvchupin, FYI. BuildBot CI explicitly builds icd-loader in a separate dependency step:

Thanks. I didn't know that. Will take a closer look tomorrow. Probably we should remove the whole dependency step. We have more dependencies right now than just opencl (level_zero, vc_intrinsics) and this script is getting opencl only. Can be fetched/reused at configure stage instead.

@bader
Copy link
Contributor

bader commented Apr 27, 2021

I think we should fix this feature rather than removing it.

Can you or anybody specify what this feature was supposed to do and when/how it was working when it was working? Or how to use it now if it's still working for anybody.
I don't see much value to fix it if it's broken indeed.

I use it and works for me.
I manually fetched OpenCL headers and OpenCL-ICD loader sources locally, built OpenCL-ICD loader library and set their location using cmake variables for LLVM build configuration. I expect that when I build SYCL project, fetching and building OpenCL headers and ICD loader library is skipped.

@bader
Copy link
Contributor

bader commented Apr 27, 2021

I think we should fix this feature rather than removing it.

Can you or anybody specify what this feature was supposed to do and when/how it was working when it was working? Or how to use it now if it's still working for anybody.
I don't see much value to fix it if it's broken indeed.

I use it and works for me.
I manually fetched OpenCL headers and OpenCL-ICD loader sources locally, built OpenCL-ICD loader library and set their location using cmake variables for LLVM build configuration. I expect that when I build SYCL project, fetching and building OpenCL headers and ICD loader library is skipped.

This feature is critical for scenarios when we need to build SYCL project on the system w/o access to the Internet/GitHub.

smaslov-intel
smaslov-intel previously approved these changes Apr 27, 2021
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: smaslov-intel <48694368+smaslov-intel@users.noreply.github.com>
Can be used by configure.py --cmake-opt="-DOpenCL_HEADERS=path"
--cmake-opt="-DOpenCL_LIBRARY_SRC=path"
@pvchupin
Copy link
Contributor Author

@bader as discussed added possibility to use predownloaded headers and library sources through cmake flags.

bader
bader previously approved these changes Apr 28, 2021
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

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

@vladimirlaz, please, take a look.

vladimirlaz
vladimirlaz previously approved these changes Apr 28, 2021
Copy link
Contributor

@vladimirlaz vladimirlaz left a comment

Choose a reason for hiding this comment

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

LGTM
Some ideas next improvements (in next PR):

@bader bader requested a review from smaslov-intel April 29, 2021 19:34
@pvchupin pvchupin dismissed stale reviews from vladimirlaz and bader via 9dd80bd April 30, 2021 07:10
@pvchupin
Copy link
Contributor Author

Adding one last change in this PR, actually the last from @vladimirlaz todo list. It will allow easier customizations of these if needed.
Other TODOs will be in separate PRs.

@bader bader requested a review from vladimirlaz April 30, 2021 07:19
@pvchupin pvchupin merged commit 66919a2 into intel:sycl Apr 30, 2021
@pvchupin pvchupin deleted the opencl-cmake1 branch April 30, 2021 17:36
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