-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V] Enable SPIR-V format emitter in clang.
Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
- Loading branch information
1 parent
fa1ff0a
commit e802518
Showing
382 changed files
with
62,334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Make sure that OpenCL builtins declared in opencl.h are translated | ||
// to corresponding SPIR-V instructions, not a function calls. | ||
// Builtins must be declared as overloadable, so Clang mangles their names, | ||
// and LLVM-SPIRV translator can recognize them. | ||
|
||
// RUN: %clang_cc1 %s -emit-spirv -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -include opencl-c.h -o %t.spv | ||
// RUN: llvm-spirv -to-text %t.spv -o - | FileCheck %s | ||
|
||
// CHECK: CreateUserEvent | ||
// CHECK: IsValidEvent | ||
// CHECK-NOT: FunctionCall | ||
|
||
bool test() { | ||
clk_event_t e = create_user_event(); | ||
return is_valid_event(e); | ||
} |
39 changes: 39 additions & 0 deletions
39
clang/test/CodeGenSPIRV/intel/private-array-initialization.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-spirv -o %t.spv | ||
// RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV | ||
|
||
// CHECK-LLVM: @__const.test.arr = private unnamed_addr addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4 | ||
|
||
// CHECK-SPIRV-DAG: TypeInt [[i32:[0-9]+]] 32 0 | ||
// CHECK-SPIRV-DAG: TypeInt [[i8:[0-9]+]] 8 0 | ||
// CHECK-SPIRV-DAG: Constant [[i32]] [[one:[0-9]+]] 1 | ||
// CHECK-SPIRV-DAG: Constant [[i32]] [[two:[0-9]+]] 2 | ||
// CHECK-SPIRV-DAG: Constant [[i32]] [[three:[0-9]+]] 3 | ||
// CHECK-SPIRV-DAG: Constant [[i32]] [[twelve:[0-9]+]] 12 | ||
// CHECK-SPIRV-DAG: TypeArray [[i32x3:[0-9]+]] [[i32]] [[three]] | ||
// CHECK-SPIRV-DAG: TypePointer [[i32x3_ptr:[0-9]+]] 7 [[i32x3]] | ||
// CHECK-SPIRV-DAG: TypePointer [[const_i32x3_ptr:[0-9]+]] 0 [[i32x3]] | ||
// CHECK-SPIRV-DAG: TypePointer [[i8_ptr:[0-9]+]] 7 [[i8]] | ||
// CHECK-SPIRV-DAG: TypePointer [[const_i8_ptr:[0-9]+]] 0 [[i8]] | ||
// CHECK-SPIRV: ConstantComposite [[i32x3]] [[test_arr_init:[0-9]+]] [[one]] [[two]] [[three]] | ||
// CHECK-SPIRV: Variable [[const_i32x3_ptr]] [[test_arr:[0-9]+]] 0 [[test_arr_init]] | ||
// CHECK-SPIRV: Variable [[const_i32x3_ptr]] [[test_arr2:[0-9]+]] 0 [[test_arr_init]] | ||
|
||
void test() { | ||
__private int arr[] = {1,2,3}; | ||
__private const int arr2[] = {1,2,3}; | ||
// CHECK-LLVM: %arr = alloca [3 x i32], align 4 | ||
// CHECK-LLVM: %[[arr_i8_ptr:[0-9]+]] = bitcast [3 x i32]* %arr to i8* | ||
// CHECK-LLVM: call void @llvm.memcpy.p0i8.p2i8.i32(i8* align 4 %0, i8 addrspace(2)* align 4 bitcast ([3 x i32] addrspace(2)* @__const.test.arr to i8 addrspace(2)*), i32 12, i1 false) | ||
|
||
// CHECK-SPIRV: Variable [[i32x3_ptr]] [[arr:[0-9]+]] 7 | ||
// CHECK-SPIRV: Variable [[i32x3_ptr]] [[arr2:[0-9]+]] 7 | ||
|
||
// CHECK-SPIRV: Bitcast [[i8_ptr]] [[arr_i8_ptr:[0-9]+]] [[arr]] | ||
// CHECK-SPIRV: Bitcast [[const_i8_ptr]] [[test_arr_const_i8_ptr:[0-9]+]] [[test_arr]] | ||
// CHECK-SPIRV: CopyMemorySized [[arr_i8_ptr]] [[test_arr_const_i8_ptr]] [[twelve]] 2 4 | ||
|
||
// CHECK-SPIRV: Bitcast [[i8_ptr]] [[arr2_i8_ptr:[0-9]+]] [[arr2]] | ||
// CHECK-SPIRV: Bitcast [[const_i8_ptr]] [[test_arr2_const_i8_ptr:[0-9]+]] [[test_arr2]] | ||
// CHECK-SPIRV: CopyMemorySized [[arr2_i8_ptr]] [[test_arr2_const_i8_ptr]] [[twelve]] 2 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BasedOnStyle: LLVM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,-llvm-header-guard' | ||
CheckOptions: | ||
- key: readability-identifier-naming.ClassCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.EnumCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.FunctionCase | ||
value: camelBack | ||
- key: readability-identifier-naming.MemberCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.ParameterCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.UnionCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.VariableCase | ||
value: CamelCase | ||
- key: llvm-namespace-comment.ShortNamespaceLines | ||
value: '25' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#==============================================================================# | ||
# This file specifies intentionally untracked files that git should ignore. | ||
# See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html | ||
# | ||
# This file is intentionally different from the output of `git svn show-ignore`, | ||
# as most of those are useless. | ||
#==============================================================================# | ||
|
||
#==============================================================================# | ||
# File extensions to be ignored anywhere in the tree. | ||
#==============================================================================# | ||
# Temp files created by most text editors. | ||
*~ | ||
# Merge files created by git. | ||
*.orig | ||
# Byte compiled python modules. | ||
*.pyc | ||
# vim swap files | ||
.*.swp | ||
.sw? | ||
#OS X specific files. | ||
.DS_store | ||
|
||
#==============================================================================# | ||
# Explicit files to ignore (only matches one). | ||
#==============================================================================# | ||
# Various tag programs | ||
/tags | ||
/TAGS | ||
/GPATH | ||
/GRTAGS | ||
/GSYMS | ||
/GTAGS | ||
.gitusers | ||
autom4te.cache | ||
cscope.files | ||
cscope.out | ||
autoconf/aclocal.m4 | ||
autoconf/autom4te.cache | ||
compile_commands.json | ||
|
||
#==============================================================================# | ||
# Directories to ignore (do not add trailing '/'s, they skip symlinks). | ||
#==============================================================================# | ||
# External projects that are tracked independently. | ||
projects/* | ||
!projects/CMakeLists.txt | ||
!projects/Makefile | ||
# Clang, which is tracked independently. | ||
tools/clang | ||
# LLDB, which is tracked independently. | ||
tools/lldb | ||
# lld, which is tracked independently. | ||
tools/lld | ||
# llgo, which is tracked independently. | ||
tools/llgo | ||
# Polly, which is tracked independently. | ||
tools/polly | ||
# Sphinx build tree, if building in-source dir. | ||
docs/_build | ||
|
||
#==============================================================================# | ||
# Files created in tree by the Go bindings. | ||
#==============================================================================# | ||
bindings/go/llvm/llvm_config.go | ||
bindings/go/llvm/workdir |
Oops, something went wrong.