forked from google/clspv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The corresponding OpLifetimeStart and OpLifetimeEnd instructions require Kernel capability, so we can't use them in Vulkan shaders anyway. Just remove them. Fixes google#142
- Loading branch information
Showing
2 changed files
with
72 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Remove @llvm.lifetime.start.* | ||
// Fixes https://github.com/google/clspv/issues/142 | ||
|
||
|
||
// RUN: clspv %s -S -o %t.spvasm -cluster-pod-kernel-args | ||
// RUN: FileCheck %s < %t.spvasm | ||
// RUN: clspv %s -o %t.spv -cluster-pod-kernel-args | ||
// RUN: spirv-dis -o %t2.spvasm %t.spv | ||
// RUN: FileCheck %s < %t2.spvasm | ||
// RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
|
||
// Just check that the compiler works at all. | ||
|
||
// CHECK: ; SPIR-V | ||
// CHECK: ; Version: 1.0 | ||
// CHECK: OpEntryPoint | ||
// CHECK: OpFunctionEnd | ||
|
||
#define CHUNK_SIZE 32 | ||
|
||
kernel void cfc(global const int *in, global int *out, int limit) { | ||
size_t x = get_global_id(0); | ||
|
||
int temp[CHUNK_SIZE]; | ||
for (int i = 0; i < CHUNK_SIZE; ++i) { | ||
temp[i] = in[i]; | ||
} | ||
|
||
if (x < limit) { | ||
out[x] = x; | ||
} else { | ||
out[x] = temp[x % CHUNK_SIZE]; | ||
} | ||
} |