Skip to content

[SYCL] Support for arrays as kernel parameters #1387

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

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6f524c9
[SYCL] Support for arrays as kernel parameters
rdeodhar Mar 24, 2020
1945657
[SYCL] Support for array kernel parameters
rdeodhar Mar 25, 2020
462cae0
Conflict resolved
rdeodhar Mar 25, 2020
1c4137c
[SYCL][CUDA] Fix usage of multiple backends in the same program (#1252)
Ruyk Mar 25, 2020
b48f08f
[SYCL] Default work-group sizes based on max (#952)
nyalloc Mar 25, 2020
b51bb87
[SYCL] Remove unexpected double in complex SPIR-V for float support (…
jinge90 Mar 25, 2020
4eab55e
[SYCL] Add experimental flag to enable front-end optimizations (#1376)
bader Mar 25, 2020
b01e868
[SYCL][FPGA] Emit multiple IR variants for the IVDep attribute (#1383)
Mar 25, 2020
5d1d716
[SYCL] Fixed sub-buffer alloca search (#1385)
Mar 25, 2020
ce53521
[SYCL][Doc] First revision of standard layout relaxation extension (#…
Mar 25, 2020
899600b
[SYCL][NFC] Unify setting kernel arguments (#1379)
AlexeySachkov Mar 26, 2020
64b771a
[SPIR-V] Enabling SPIR-V builtin lookup in device SYCL mode (#1384)
Naghasan Mar 26, 2020
2b6f4f4
[Driver][SYCL][FPGA] Proper dependency output location when given /Fo…
mdtoguchi Mar 26, 2020
a5b9804
[SYCL][FPGA] Enable a set of loop attributes (#1312)
vmaksimo Mar 26, 2020
fb72758
[SYCL] Fix buffer constructor using iterators (#1386)
bso-intel Mar 26, 2020
48e0314
[Support] Implement a property set I/O library (#1357)
kbobrovs Mar 26, 2020
96de11d
[Support] Implement a simple tabular data management library (#1358)
kbobrovs Mar 26, 2020
09a4b44
[SYCL] updated kernel array parameter support
rdeodhar Mar 27, 2020
568e0ad
Revert "[SYCL] workaround for memory consumption issue"
vladimirlaz Mar 25, 2020
59272d8
[SYCL][Doc] Deploy Sphinx documentation (#1406)
Mar 27, 2020
6b44ebb
Add a file-table-tform tool: manipulating tabular string data files. …
kbobrovs Mar 27, 2020
0408899
[SYCL] Fix unexpected acceptance of id argument in nd_range parallel_…
yubingex007-a11y Mar 27, 2020
dc7d851
[SYCL] Simplify handing of builtins in LowerWGScope (#1399)
Naghasan Mar 27, 2020
c98559b
[SYCL] Cast address spaces before replacing byval argument usages (#1…
againull Mar 27, 2020
017af4e
[SYCL] Enable algorithm support for sub_group (#1392)
Pennycook Mar 27, 2020
c687b91
Fix translation of relational operations (#1409)
Fznamznon Mar 27, 2020
9be1566
[SYCL][NFC] Doxygen doc for CUDA backend (#1394)
Ruyk Mar 27, 2020
29abe37
[SYCL] Implement specialization constants. (#1356)
kbobrovs Mar 27, 2020
c0e498b
[SYCL] Support for array kernel parameters
rdeodhar Mar 28, 2020
a4ee1f6
[SYCL] Support for array kernel parameters
rdeodhar Mar 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ jobs:
ref: sycl
path: repo
- name: Install deps
run: sudo apt-get install -y doxygen graphviz ssh ninja-build
run: |
sudo apt-get install -y doxygen graphviz ssh ninja-build
sudo pip3 install sphinx recommonmark sphinx_markdown_tables
- name: Build Docs
run: |
mkdir -p $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
python $GITHUB_WORKSPACE/repo/buildbot/configure.py -w $GITHUB_WORKSPACE \
-s $GITHUB_WORKSPACE/repo -o $GITHUB_WORKSPACE/build -t Release --docs
cmake --build . --target doxygen-sycl
cmake --build . --target docs-sycl-html
- name: Deploy
env:
SSH_KEY: ${{secrets.ACTIONS_DEPLOY_KEY}}
Expand All @@ -32,7 +35,11 @@ jobs:
ssh-add -k ~/.ssh/id_rsa
git clone [email protected]:intel/llvm-docs.git docs
cd $GITHUB_WORKSPACE/docs
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/doxygen/html/* .
git rm -rf .
touch .nojekyll
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/html/* .
mkdir doxygen
yes | \cp -rf $GITHUB_WORKSPACE/build/tools/sycl/doc/doxygen/html/* doxygen/
git config --global user.name "iclsrc"
git config --global user.email "[email protected]"
git add .
Expand Down
3 changes: 3 additions & 0 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def do_configure(args):
sycl_build_pi_cuda = 'OFF'
llvm_enable_assertions = 'ON'
llvm_enable_doxygen = 'OFF'
llvm_enable_sphinx = 'OFF'
llvm_build_shared_libs = 'OFF'

if platform.system() == 'Linux':
Expand All @@ -38,6 +39,7 @@ def do_configure(args):

if args.docs:
llvm_enable_doxygen = 'ON'
llvm_enable_sphinx = 'ON'

if args.shared_libs:
llvm_build_shared_libs = 'ON'
Expand All @@ -63,6 +65,7 @@ def do_configure(args):
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
"-DSYCL_INCLUDE_TESTS=ON", # Explicitly include all kinds of SYCL tests.
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
"-DSYCL_ENABLE_XPTI_TRACING=ON", # Explicitly turn on XPTI tracing
llvm_dir
Expand Down
9 changes: 1 addition & 8 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,7 @@ set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
"Enable the experimental new pass manager by default.")

# Clang tool executes cc1 commands in the same process after b4a99a0
# It causes increasing memory consumption for compilations where several
# source files are passed (for C++ application) or several build steps (e.g.
# for SYCL application we have host, device and integration header step
# per source file). Memory is not freed for all cc1 commands until end
# This change forces clang driver use old behavior untill memory issue
# is fixed.
set(CLANG_SPAWN_CC1 ON CACHE BOOL
set(CLANG_SPAWN_CC1 OFF CACHE BOOL
"Whether clang should use a new process for the CC1 invocation")

# TODO: verify the values against LangStandards.def?
Expand Down
51 changes: 51 additions & 0 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,57 @@ def SYCLIntelFPGAMaxConcurrency : Attr {
let Documentation = [SYCLIntelFPGAMaxConcurrencyAttrDocs];
}

def SYCLIntelFPGALoopCoalesce : Attr {
let Spellings = [CXX11<"intelfpga","loop_coalesce">];
let Args = [ExprArgument<"NExpr">];
let LangOpts = [SYCLIsDevice, SYCLIsHost];
let HasCustomTypeTransform = 1;
let AdditionalMembers = [{
static const char *getName() {
return "loop_coalesce";
}
}];
let Documentation = [SYCLIntelFPGALoopCoalesceAttrDocs];
}

def SYCLIntelFPGADisableLoopPipelining : Attr {
let Spellings = [CXX11<"intelfpga","disable_loop_pipelining">];
let LangOpts = [SYCLIsDevice, SYCLIsHost];
let HasCustomTypeTransform = 1;
let AdditionalMembers = [{
static const char *getName() {
return "disable_loop_pipelining";
}
}];
let Documentation = [SYCLIntelFPGADisableLoopPipeliningAttrDocs];
}

def SYCLIntelFPGAMaxInterleaving : Attr {
let Spellings = [CXX11<"intelfpga","max_interleaving">];
let Args = [ExprArgument<"NExpr">];
let LangOpts = [SYCLIsDevice, SYCLIsHost];
let HasCustomTypeTransform = 1;
let AdditionalMembers = [{
static const char *getName() {
return "max_interleaving";
}
}];
let Documentation = [SYCLIntelFPGAMaxInterleavingAttrDocs];
}

def SYCLIntelFPGASpeculatedIterations : Attr {
let Spellings = [CXX11<"intelfpga","speculated_iterations">];
let Args = [ExprArgument<"NExpr">];
let LangOpts = [SYCLIsDevice, SYCLIsHost];
let HasCustomTypeTransform = 1;
let AdditionalMembers = [{
static const char *getName() {
return "speculated_iterations";
}
}];
let Documentation = [SYCLIntelFPGASpeculatedIterationsAttrDocs];
}

def IntelFPGALocalNonConstVar : SubsetSubject<Var,
[{S->hasLocalStorage() &&
S->getKind() != Decl::ImplicitParam &&
Expand Down
47 changes: 47 additions & 0 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,53 @@ be applied multiple times to the same loop.
}];
}

def SYCLIntelFPGALoopCoalesceAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "loop_coalesce";
let Content = [{
This attribute applies to a loop. Indicates that the loop nest should be
coalesced into a single loop without affecting functionality. Parameter N is
optional. If specified, it shall be a positive integer, and indicates how many
of the nested loop levels should be coalesced.
}];
}

def SYCLIntelFPGADisableLoopPipeliningAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "disable_loop_pipelining";
let Content = [{
This attribute applies to a loop. Disables pipelining of the loop data path,
causing the loop to be executed serially. Cannot be used on the same loop in
conjunction with max_interleaving, speculated_iterations, max_concurrency, ii
or ivdep.
}];
}

def SYCLIntelFPGAMaxInterleavingAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "max_interleaving";
let Content = [{
This attribute applies to a loop. Places a maximum limit N on the number of
interleaved invocations of an inner loop by an outer loop (note, this does not
mean that this attribute can only be applied to inner loops in user code - outer
loops in user code may still be contained in an implicit loop due to NDRange).
Parameter N is mandatory, and shall be non-negative integer. Cannot be
used on the same loop in conjunction with disable_loop_pipelining.
}];
}

def SYCLIntelFPGASpeculatedIterationsAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "speculated_iterations";
let Content = [{
This attribute applies to a loop. Specifies the number of concurrent speculated
iterations that will be in flight for a loop invocation (i.e. the exit
condition for these iterations will not have been evaluated yet).
Parameter N is mandatory, and may either be 0, or a positive integer. Cannot be
used on the same loop in conjunction with disable_loop_pipelining.
}];
}

def SYCLDeviceIndirectlyCallableDocs : Documentation {
let Category = DocCatFunction;
let Heading = "intel::device_indirectly_callable";
Expand Down
52 changes: 51 additions & 1 deletion clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include <initializer_list>
#include <string>

namespace llvm {
Expand Down Expand Up @@ -78,9 +79,10 @@ class Action {
SYCLPostLinkJobClass,
PartialLinkJobClass,
BackendCompileJobClass,
FileTableTformJobClass,

JobClassFirst = PreprocessJobClass,
JobClassLast = BackendCompileJobClass
JobClassLast = FileTableTformJobClass
};

// The offloading kind determines if this action is binded to a particular
Expand Down Expand Up @@ -679,6 +681,13 @@ class SYCLPostLinkJobAction : public JobAction {
static bool classof(const Action *A) {
return A->getKind() == SYCLPostLinkJobClass;
}

void setRTSetsSpecConstants(bool Val) { RTSetsSpecConsts = Val; }

bool getRTSetsSpecConstants() const { return RTSetsSpecConsts; }

private:
bool RTSetsSpecConsts = true;
};

class PartialLinkJobAction : public JobAction {
Expand All @@ -705,6 +714,47 @@ class BackendCompileJobAction : public JobAction {
}
};

// Represents a file table transformation action. The order of inputs to a
// FileTableTformJobAction at construction time must accord with the tforms
// added later - some tforms "consume" inputs. For example, "replace column"
// needs another file to read the replacement column from.
class FileTableTformJobAction : public JobAction {
void anchor() override;

public:
struct Tform {
enum Kind { EXTRACT, EXTRACT_DROP_TITLE, REPLACE };

Tform() = default;
Tform(Kind K, std::initializer_list<StringRef> Args) : TheKind(K) {
for (auto A : Args)
TheArgs.emplace_back(A.str());
}

Kind TheKind;
SmallVector<std::string, 2> TheArgs;
};

FileTableTformJobAction(Action *Input, types::ID OutputType);
FileTableTformJobAction(ActionList &Inputs, types::ID OutputType);

// Deletes all columns except the one with given name.
void addExtractColumnTform(StringRef ColumnName, bool WithColTitle = true);

// Replaces a column with title <From> in this table with a column with title
// <To> from another file table passed as input to this action.
void addReplaceColumnTform(StringRef From, StringRef To);

static bool classof(const Action *A) {
return A->getKind() == FileTableTformJobClass;
}

const ArrayRef<Tform> getTforms() const { return Tforms; }

private:
SmallVector<Tform, 2> Tforms; // transformation actions requested
};

} // namespace driver
} // namespace clang

Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/CC1Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,8 @@ def fsycl_std_layout_kernel_params: Flag<["-"], "fsycl-std-layout-kernel-params"
def fsycl_allow_func_ptr : Flag<["-"], "fsycl-allow-func-ptr">,
HelpText<"Allow function pointers in SYCL device.">;
def fno_sycl_allow_func_ptr : Flag<["-"], "fno-sycl-allow-func-ptr">;
def fsycl_enable_optimizations: Flag<["-"], "fsycl-enable-optimizations">,
HelpText<"Experimental flag enabling standard optimization in the front-end.">;

} // let Flags = [CC1Option]

Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class ToolChain {
mutable std::unique_ptr<Tool> SYCLPostLink;
mutable std::unique_ptr<Tool> PartialLink;
mutable std::unique_ptr<Tool> BackendCompiler;
mutable std::unique_ptr<Tool> FileTableTform;

Tool *getClang() const;
Tool *getFlang() const;
Expand All @@ -161,6 +162,7 @@ class ToolChain {
Tool *getSYCLPostLink() const;
Tool *getPartialLink() const;
Tool *getBackendCompiler() const;
Tool *getTableTform() const;

mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
mutable std::unique_ptr<XRayArgs> XRayArguments;
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Types.def
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TYPE("spirv", SPIRV, INVALID, "spv", phases
TYPE("sycl-header", SYCL_Header, INVALID, "h", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("sycl-fatbin", SYCL_FATBIN, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("tempfilelist", Tempfilelist, INVALID, "txt", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("tempentriesfilelist", TempEntriesfilelist, INVALID, "txt", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("tempfiletable", Tempfiletable,INVALID, "table", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("tempAOCOfilelist", TempAOCOfilelist, INVALID, "txt", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("archive", Archive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("wholearchive", WholeArchive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
Expand Down
12 changes: 11 additions & 1 deletion clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ class SYCLIntegrationHeader {
/// invocation descriptor has finished.
void endKernel();

/// Registers a specialization constant to emit info for it into the header.
void addSpecConstant(StringRef IDName, QualType IDType);

private:
// Kernel actual parameter descriptor.
struct KernelParamDesc {
Expand Down Expand Up @@ -407,6 +410,13 @@ class SYCLIntegrationHeader {
/// SYCLIntegrationHeader::startKernel
SmallVector<KernelDesc, 4> KernelDescs;

using SpecConstID = std::pair<QualType, std::string>;

/// Keeps specialization constants met in the translation unit. Maps spec
/// constant's ID type to generated unique name. Duplicates are removed at
/// integration header emission time.
llvm::SmallVector<SpecConstID, 4> SpecConsts;

/// Used for emitting diagnostics.
DiagnosticsEngine &Diag;

Expand Down Expand Up @@ -1754,7 +1764,7 @@ class Sema final {
Expr *Expr2);
template <typename FPGALoopAttrT>
FPGALoopAttrT *BuildSYCLIntelFPGALoopAttr(const AttributeCommonInfo &A,
Expr *E);
Expr *E = nullptr);

LoopUnrollHintAttr *BuildLoopUnrollHintAttr(const AttributeCommonInfo &A,
Expr *E);
Expand Down
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "CGObjCRuntime.h"
#include "CGOpenMPRuntime.h"
#include "CGRecordLayout.h"
#include "CGSYCLRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "ConstantEmitter.h"
Expand Down
Loading