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

[SYCL] Remove sycldevice target triple environment component #3929

Merged
merged 25 commits into from
Sep 2, 2021

Conversation

bader
Copy link
Contributor

@bader bader commented Jun 12, 2021

Today DPC++ compiler requires users to set "sycldevice" target triple component to separate SYCL compilation mode for SPIR target from other compilation mode (e.g. OpenCL).
Triple environment component is not intended to be used in such context and this patch removes sycldevice.

This patch also preserves backward compatibility with binaries built using old versions of the compiler, which enforced sycldevice environment component of the target triple. It's provided by clang-offload-bundler tool, which now implicitly looks for the additional SYCL offload kind bundle with a "legacy" triple.
A driver warning was added to let users know that sycldevice environment component is ignored now.

To simplify the review process, changes are split into multiple patches.
First nine patches updates the source code and three patches after that update target triples in llvm-spirv, llvm and clang project tests.
Commits after 46a928f address code review comments.

@bader
Copy link
Contributor Author

bader commented Jun 12, 2021

/summary:run

@bader bader linked an issue Jun 12, 2021 that may be closed by this pull request
@bader
Copy link
Contributor Author

bader commented Jun 12, 2021

/summary:run

@bader
Copy link
Contributor Author

bader commented Jun 12, 2021

  • TODO: add driver diagnostics about deprecated -sycldevice environment component.
  • TODO: keep supporting -sycldevice environment component explicitly set by users for backward compatibility

@bader
Copy link
Contributor Author

bader commented Jul 22, 2021

  • TODO: keep supporting -sycldevice environment component explicitly set by users for backward compatibility

@mdtoguchi, @AGindinson, I'd like to know your opinion on the direction to implement this.

I see that when we link an object file, we unbundle it using following command:
clang-offload-bundler -type=o -targets=host-x86_64-unknown-linux-gnu,sycl-spir64-unknown-unknown -inputs=/tmp/lib.o -outputs=/tmp/lib-697d81.o,/tmp/lib-641a53.o -unbundle -allow-missing-bundles

Note, device triple doesn't have -sycldevice already, so if object file was built using old compiler, we won't get the right image.
My idea is when we have an object file as an input, triple target architecture is spir* and doesn't have -sycldevice environment component, we add one more triple to unbundler (with -sycldevice environment component) and corresponding output file(s). New output file(s) should be added to llvm-link command as well.

This should cover the simplest case when we link with an object file. I haven't looked into other scenarios yet, but I'd like to confirm that this idea sounds sane to you.

@mdtoguchi
Copy link
Contributor

This should cover the simplest case when we link with an object file. I haven't looked into other scenarios yet, but I'd like to confirm that this idea sounds sane to you.

It does sound reasonable. Would there be a possibility of overlap of code (one previously built with -sycldevice and a new object without) that would both be linked in?

@bader
Copy link
Contributor Author

bader commented Jul 22, 2021

This should cover the simplest case when we link with an object file. I haven't looked into other scenarios yet, but I'd like to confirm that this idea sounds sane to you.

It does sound reasonable. Would there be a possibility of overlap of code (one previously built with -sycldevice and a new object without) that would both be linked in?

I need to check what target tripe llvm-link uses for the module linked from spir-unknown-unknow and spir-unknown-unknow-sycldevice modules.
According to my understanding old compiler is able to produce device modules with -sycldevice environment component only.
I intent to make new compiler to always keep environment component unknown unless it's set to some other value by user. But user won't be able to set -sycldevice with a new compiler anyway.

@bader bader force-pushed the remove-sycldevice branch from 8184779 to 46a928f Compare August 5, 2021 14:55
@bader bader changed the title Remove sycldevice target triple environment component [SYCL] Remove sycldevice target triple environment component Aug 5, 2021
@bader
Copy link
Contributor Author

bader commented Aug 5, 2021

This patch also preserves backward compatibility with binaries built using old versions of the compiler, which enforced sycldevice environment component of the target triple. It's provided by clang-offload-bundler tool, which now implicitly looks for the additional SYCL offload kind bundle with a "legacy" triple.

@vzakhari, does OpenMP compiler use the triple with sycldevice environment?

@bader
Copy link
Contributor Author

bader commented Aug 5, 2021

This should cover the simplest case when we link with an object file. I haven't looked into other scenarios yet, but I'd like to confirm that this idea sounds sane to you.

It does sound reasonable. Would there be a possibility of overlap of code (one previously built with -sycldevice and a new object without) that would both be linked in?

@mdtoguchi, FYI.
I talked to @AGindinson and decided to take a different route and update clang-offload-bundler. Here is the change - 0b0317a. This seems to be much simpler than the driver changes adding another target for unbudling job.

@vzakhari
Copy link
Contributor

vzakhari commented Aug 5, 2021

This patch also preserves backward compatibility with binaries built using old versions of the compiler, which enforced sycldevice environment component of the target triple. It's provided by clang-offload-bundler tool, which now implicitly looks for the additional SYCL offload kind bundle with a "legacy" triple.

@vzakhari, does OpenMP compiler use the triple with sycldevice environment?

No, OpenMP compiler does not use sycldevice (or any other) environment. I believe it uses unknown.

@bader
Copy link
Contributor Author

bader commented Aug 5, 2021

/summary:run

jinge90
jinge90 previously approved these changes Aug 26, 2021
@bader
Copy link
Contributor Author

bader commented Sep 1, 2021

/summary:run

AGindinson pushed a commit to AGindinson/SPIRV-LLVM-Translator that referenced this pull request Sep 1, 2021
Recent changes in the DPC++ compiler
(intel/llvm#3929) allow to disregard the
`sycldevice` component from the target triple in command lines. From
there on, producing IR files for tests should use the simplified
target triple. Clean up the existing tests to match this change.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
AGindinson pushed a commit to AGindinson/SPIRV-LLVM-Translator that referenced this pull request Sep 1, 2021
Recent changes in the DPC++ compiler
(intel/llvm#3929) allow to disregard the
`sycldevice` component from the target triple in command lines. From
there on, IR files for the Translator tests should be produced using
the simplified target triple. Clean up the existing tests to match
this change.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
Copy link
Contributor

@AGindinson AGindinson left a comment

Choose a reason for hiding this comment

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

LGTM.

@bader bader merged commit 29a1f16 into intel:sycl Sep 2, 2021
@bader bader deleted the remove-sycldevice branch September 2, 2021 10:08
MrSidims pushed a commit to KhronosGroup/SPIRV-LLVM-Translator that referenced this pull request Sep 2, 2021
Recent changes in the DPC++ compiler
(intel/llvm#3929) allow to disregard the
`sycldevice` component from the target triple in command lines. From
there on, IR files for the Translator tests should be produced using
the simplified target triple. Clean up the existing tests to match
this change.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
vmaksimo pushed a commit to vmaksimo/llvm that referenced this pull request Sep 6, 2021
Recent changes in the DPC++ compiler
(intel#3929) allow to disregard the
`sycldevice` component from the target triple in command lines. From
there on, IR files for the Translator tests should be produced using
the simplified target triple. Clean up the existing tests to match
this change.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@0a1f59c
AGindinson pushed a commit to AGindinson/llvm that referenced this pull request Oct 1, 2021
With `-sycldevice` triple environment removal (as performed in
intel#3929), backwards compatibility has been enforced for SYCL
objects/object-format libraries only. To ensure that `.a` libraries
(archives) built by older compiler versions are usable with newer
compiler version, adjust `clang-offload-deps` to consider
`-sycldevice`-marked symbols when encountering a SYCL target.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
againull pushed a commit that referenced this pull request Oct 3, 2021
…4685)

With `-sycldevice` triple environment removal (as performed in
#3929), backwards compatibility has been enforced for SYCL
objects/object-format libraries only. To ensure that `.a` libraries
(archives) built by older compiler versions are usable with newer
compiler version, adjust `clang-offload-deps` to consider
`-sycldevice`-marked symbols when encountering a SYCL target.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
Quetzonarch pushed a commit to Quetzonarch/SPIRV-LLVM-Translator that referenced this pull request Jul 13, 2022
Recent changes in the DPC++ compiler
(intel/llvm#3929) allow to disregard the
`sycldevice` component from the target triple in command lines. From
there on, IR files for the Translator tests should be produced using
the simplified target triple. Clean up the existing tests to match
this change.

Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
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.

Can we drop target triple environment component -sycldevice?