Skip to content

Add linker map and .def file #197

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 5 commits into from
Feb 9, 2024
Merged

Add linker map and .def file #197

merged 5 commits into from
Feb 9, 2024

Conversation

igchor
Copy link
Member

@igchor igchor commented Jan 31, 2024

No description provided.

@igchor igchor requested a review from a team as a code owner January 31, 2024 21:52
@igchor igchor mentioned this pull request Jan 31, 2024
@igchor igchor changed the title Add linker map and .def file Add linker map and .def file and expose ops through getter functions Jan 31, 2024
Copy link
Contributor

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

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

👍

include:
- os: 'windows-2022'
build_type: Release
compiler: {c: clang-cl, cxx: clang-cl}
pool_tracking: 'ON'
os_provider: ['ON']
Copy link
Contributor

Choose a reason for hiding this comment

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

['ON'] -> 'ON' 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

not quite - pls only update in includes, not in matrix (a list is required there)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, done.

@bratpiorka
Copy link
Contributor

it would be really great if you split this PR to smaller single-commit PRs

@igchor
Copy link
Member Author

igchor commented Feb 2, 2024

it would be really great if you split this PR to smaller single-commit PRs

Ok, done:
#200
#201

@bratpiorka
Copy link
Contributor

@igchor please rebase + change the name of this PR + could you also extract the changes in the github action file into a separate PR?

@igchor
Copy link
Member Author

igchor commented Feb 5, 2024

@igchor please rebase + change the name of this PR + could you also extract the changes in the github action file into a separate PR?

I'll do that once #200 is merged

@igchor igchor changed the title Add linker map and .def file and expose ops through getter functions Add linker map and .def file Feb 5, 2024
@igchor
Copy link
Member Author

igchor commented Feb 5, 2024

@igchor please rebase + change the name of this PR + could you also extract the changes in the github action file into a separate PR?

Done - rebased and changed the name of the PR. I've left the github action changes though since they are mostly to make sure that adding .def/.map file doesn't break anything.

@bratpiorka
Copy link
Contributor

@igor please resolve the issue pointed by @lukaszstolarczuk
also, I think it would be good to generate def/map files in the future and add a test for that - I will create a JIRA task for this

@lukaszstolarczuk
Copy link
Contributor

besides the issue (mentioned by Rafał) blocking CI, lgtm

@igchor
Copy link
Member Author

igchor commented Feb 6, 2024

@igor please resolve the issue pointed by @lukaszstolarczuk also, I think it would be good to generate def/map files in the future and add a test for that - I will create a JIRA task for this

Done.

@igchor
Copy link
Member Author

igchor commented Feb 6, 2024

Hm, there's now another problem after we started using base alloc in jemalloc/scalable pool implementations. For dynamic library we should hide base_alloc symbols from libumf.so but that means we would need to build jemalloc/scalable pool with base_alloc sources (same as tests in: #200).

However, for static libumf, we do not control symbol visibility so if both libumf.a and jemalloc/scalable_pool.a are build with base_alloc we'll have conflicting symbols I think. Any ideas how we can solve this? Should we make base_alloc a separate dynamic library?

@bratpiorka
Copy link
Contributor

Hm, there's now another problem after we started using base alloc in jemalloc/scalable pool implementations. For dynamic library we should hide base_alloc symbols from libumf.so but that means we would need to build jemalloc/scalable pool with base_alloc sources (same as tests in: #200).

However, for static libumf, we do not control symbol visibility so if both libumf.a and jemalloc/scalable_pool.a are build with base_alloc we'll have conflicting symbols I think. Any ideas how we can solve this? Should we make base_alloc a separate dynamic library?

can't we check for this case in cmake? and do not include base_alloc sources in static jemalloc/scallable pools? These libs will never be used without libumf.a

On linux, we haven't limited symbol visibility in any way
- this patch does that by introducing linker map.

On windows, this patch replaces UMF_EXPORT with .def file
to keep headers clean.
To verify building with OS memory provider turned off
if umf is build as a shared lib. This is
needed because ba_alloc symbols are not longer
exported from libumf
@igchor
Copy link
Member Author

igchor commented Feb 8, 2024

Hm, there's now another problem after we started using base alloc in jemalloc/scalable pool implementations. For dynamic library we should hide base_alloc symbols from libumf.so but that means we would need to build jemalloc/scalable pool with base_alloc sources (same as tests in: #200).
However, for static libumf, we do not control symbol visibility so if both libumf.a and jemalloc/scalable_pool.a are build with base_alloc we'll have conflicting symbols I think. Any ideas how we can solve this? Should we make base_alloc a separate dynamic library?

can't we check for this case in cmake? and do not include base_alloc sources in static jemalloc/scallable pools? These libs will never be used without libumf.a

Ok, done. I've also had to add ba_alloc init code to jemalloc and scalable pools (see topmost commit). Still, this is not an ideal solution since our jemalloc/scalable pool libs will only work with libum that they were build with (.e.g. if jemalloc_pool.a was build with libumf.so it won't work with libumf.a).

Since ba_alloc sources are compiled directly into those pools
they each have a separate copy of base_alloc.
@bratpiorka
Copy link
Contributor

Hm, there's now another problem after we started using base alloc in jemalloc/scalable pool implementations. For dynamic library we should hide base_alloc symbols from libumf.so but that means we would need to build jemalloc/scalable pool with base_alloc sources (same as tests in: #200).
However, for static libumf, we do not control symbol visibility so if both libumf.a and jemalloc/scalable_pool.a are build with base_alloc we'll have conflicting symbols I think. Any ideas how we can solve this? Should we make base_alloc a separate dynamic library?

can't we check for this case in cmake? and do not include base_alloc sources in static jemalloc/scallable pools? These libs will never be used without libumf.a

Ok, done. I've also had to add ba_alloc init code to jemalloc and scalable pools (see topmost commit). Still, this is not an ideal solution since our jemalloc/scalable pool libs will only work with libum that they were build with (.e.g. if jemalloc_pool.a was build with libumf.so it won't work with libumf.a).

ok, thanks. About the scnario you mentioned - currently there is no way to build only jemalloc_pool.a without building libumf. So I think the problem here is very limited

@bratpiorka bratpiorka merged commit 310dbe1 into oneapi-src:main Feb 9, 2024
@igchor igchor deleted the windows branch February 9, 2024 16:13
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