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

Make the project compatible with FetchContent and find_package #200

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

AndreyPavlenko
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko commented Jul 30, 2024

to simplify integration with thirdparty projects.

  • Introduced the GcInterface target. It has the public imports and the compiler options, that are populated to the linked targets.
  • Use the Gc prefix in the target names.
  • Added a separate shared library for oneDNN integration - GcDnnl.
  • The GcDnnl library and the OneDNNGraphDialect are not built if GC_ENABLE_DNNL=OFF.
  • Added new build options: GC_ENABLE_TEST(renamed), GC_ENABLE_TEST_DNNL, GC_ENABLE_TEST_MLIR, GC_ENABLE_OPT.
  • Renamed the GC_USE_GPU build option to GC_ENABLE_IMEX.
  • Export the OpenMP flags to resolve the "JIT session error: Symbols not found: _kmpc...".
  • Minor compile.sh script enhancements.

@AndreyPavlenko AndreyPavlenko marked this pull request as ready for review July 31, 2024 00:28
Copy link
Contributor

@kurapov-peter kurapov-peter left a comment

Choose a reason for hiding this comment

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

Great patch, thanks! I've put some minor comments and questions. Otherwise looks good. Could you also add a smoke test for exporting functionality? Like an example that uses cmake's find_package.

@@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifdef GC_HAS_ONEDNN_DIALECT
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not include the file in the build instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but in this case I'm getting the error:

LLVM's build system enforces that all source files are added to a build target

I could suppress the error, but I'm not sure if it's a better solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can conditionally add it to the global property that forms an appropriate library (be that gcpasses or a separate one, no matter). I had a similar problem in #205

scripts/compile.sh Show resolved Hide resolved
scripts/compile.sh Outdated Show resolved Hide resolved
scripts/compile.sh Show resolved Hide resolved
test/CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated
Comment on lines 126 to 135
GcCpuRuntime
GcGpuPasses
GcInterface
GcJitWrapper
GcPasses
GcUtilsIR
MLIRCPURuntimeDialect
MLIRCPURuntimeTransforms
MLIRLinalgx
MLIRMicrokernel
Copy link
Contributor

Choose a reason for hiding this comment

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

So these are to cover the static scenario. I think this should eventually be passed through via a global property to be flexible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean so that each module adds its targets to the global property?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, this is just a thought.

CMakeLists.txt Outdated
option(GC_ENABLE_TEST "Build the tests" ON)
option(GC_ENABLE_TEST_DNNL "Build the dnnl tests" ${GC_ENABLE_DNNL})
option(GC_ENABLE_TEST_MLIR "Build the mlir tests" ON)
option(GC_ENABLE_OPT "Build gc-opt" ON)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be more generic, i.e. GC_ENABLE_TOOLS.

to simplify integration with thirdparty projects.

 - Use the Gc prefix in the target names.
 - Added a separate shared library for oneDNN integration - GcDnnl.
 - The GcDnnl library and the OneDNNGraphDialect are not built if GC_ENABLE_DNNL=OFF.
 - Added new build options: GC_ENABLE_TEST(renamed), GC_ENABLE_TEST_DNNL, GC_ENABLE_TEST_MLIR, GC_ENABLE_OPT.
 - Renamed the GC_USE_GPU option to GC_ENABLE_GPU to be consistent with other options.
 - Export the OpenMP flags to resolve the "JIT session error: Symbols not found: __kmpc_...".
 - Minor compile.sh script enhancements.
This was linked to issues Aug 1, 2024
@leshikus
Copy link
Contributor

leshikus commented Aug 1, 2024

I would suggest splitting the PR into several PRs which match items in the list, it just very hard to follow when we have all the items mixed.

At least I suggest splitting it into two parts: essential and non-essential like renamings.

Copy link
Contributor

@leshikus leshikus left a comment

Choose a reason for hiding this comment

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

LGTM I cannot see any style violations, yet as I've said before big changes like this are hard to follow

@AndreyPavlenko
Copy link
Contributor Author

LGTM I cannot see any style violations, yet as I've said before big changes like this are hard to follow

Sorry for that. Initially it was much smaller...

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.

OV GPU integration OV CPU integration
3 participants