This is an archive of the discontinued LLVM Phabricator instance.

[SYCL][Driver] Add clang driver option to enable SYCL compilation mode
ClosedPublic

Authored by bader on Feb 5 2020, 6:20 AM.

Details

Summary

As a first step this implementation enables compilation of the offload
code.

Diff Detail

Event Timeline

bader created this revision.Feb 5 2020, 6:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2020, 6:20 AM

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

bader updated this revision to Diff 242590.Feb 5 2020, 6:27 AM

Rebased on ToT.

ABataev added inline comments.Feb 5 2020, 6:28 AM
clang/include/clang/Driver/Options.td
3413–3415

Usually, we add a pair of such flags, -fsycl and fno-sycl to have the explicit way to disable some functionality.

clang/lib/Driver/ToolChains/Clang.cpp
4027–4029

No need for braces here

clang/test/Driver/sycl.c
6

I would add a check that this flag is found on clang invocation with -cc1 option (i.e. it is passed to the frontend)

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

bader updated this revision to Diff 242627.Feb 5 2020, 8:12 AM

Applied suggestions from Alexey

bader marked 3 inline comments as done.Feb 5 2020, 8:14 AM

Thanks for the prompt review.
I've applied your suggestions.

Unit tests: unknown.

clang-tidy: pass.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

ABataev added inline comments.Feb 5 2020, 8:21 AM
clang/lib/Driver/ToolChains/Clang.cpp
4028–4030

I suggest to use hasFlag function, something like this:

if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
  CmdArgs.push_back("-fsycl-is-device");
bader updated this revision to Diff 242639.Feb 5 2020, 8:37 AM

Refactor clang/lib/Driver/ToolChains/Clang.cpp in accordance with Alexey's suggestion.

bader updated this revision to Diff 242640.Feb 5 2020, 8:45 AM

Applied clang-format.

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

This revision is now accepted and ready to land.Feb 5 2020, 8:47 AM

Unit tests: unknown.

clang-tidy: pass.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

This revision was automatically updated to reflect the committed changes.