This is the first of a series of patches to add support for OpenMP offloading to SPIR-V through liboffload with the first intended target being Intel GPUs. This patch implements the basic driver and `clang-linker-wrapper` work for JIT mode. There are still many missing pieces, so this is not yet usable. We introduce `spirv64-intel-unknown` as the only currently supported triple. The user-facing argument to enable offloading will be `-fopenmp -fopenmp-targets=spirv64-intel` Add a new `SPIRVOpenMPToolChain` toolchain based on the existing general SPIR-V toolchain which will call all the required SPIR-V tools (and eventually the SPIR-V backend) as well as add the corresponding device RTL as an argument to the linker. We can't get through the front end consistently yet, so it's difficult to add any LIT tests that execute any tools, but front end changes are planned very shortly, and then we can add those tests. --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
//==- SPIRVOpenMP.cpp - SPIR-V OpenMP Tool Implementations --------*- C++ -*==//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//==------------------------------------------------------------------------==//
|
|
#include "SPIRVOpenMP.h"
|
|
#include "CommonArgs.h"
|
|
|
|
using namespace clang::driver;
|
|
using namespace clang::driver::toolchains;
|
|
using namespace clang::driver::tools;
|
|
using namespace llvm::opt;
|
|
|
|
namespace clang::driver::toolchains {
|
|
SPIRVOpenMPToolChain::SPIRVOpenMPToolChain(const Driver &D,
|
|
const llvm::Triple &Triple,
|
|
const ToolChain &HostToolchain,
|
|
const ArgList &Args)
|
|
: SPIRVToolChain(D, Triple, Args), HostTC(HostToolchain) {}
|
|
|
|
void SPIRVOpenMPToolChain::addClangTargetOptions(
|
|
const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
|
|
Action::OffloadKind DeviceOffloadingKind) const {
|
|
|
|
if (DeviceOffloadingKind != Action::OFK_OpenMP)
|
|
return;
|
|
|
|
if (DriverArgs.hasArg(options::OPT_nogpulib))
|
|
return;
|
|
addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, "", getTriple(), HostTC);
|
|
}
|
|
} // namespace clang::driver::toolchains
|