Skip to content

Commit 69c5925

Browse files
authored
[Comgr] Add test for OpenCL 2.0
1 parent ca634f3 commit 69c5925

8 files changed

+36
-14
lines changed

amd/comgr/test-lit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
4040

4141
add_comgr_lit_binary(source-to-bc-with-dev-libs c)
4242
add_comgr_lit_binary(spirv-translator c)
43-
add_comgr_lit_binary(compile-minimal-test c)
43+
add_comgr_lit_binary(compile-opencl-minimal c)
4444
add_comgr_lit_binary(spirv-to-reloc c)
4545
add_comgr_lit_binary(unbundle c)
4646
add_comgr_lit_binary(data-action c)

amd/comgr/test-lit/cache-tests/compile-minimal-test-cached-bad-dir.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: AMD_COMGR_CACHE_DIR=%t.txt \
77
// RUN: AMD_COMGR_EMIT_VERBOSE_LOGS=1 \
88
// RUN: AMD_COMGR_REDIRECT_LOGS=%t.log \
9-
// RUN: compile-minimal-test %S/../compile-minimal-test.cl %t.bin
9+
// RUN: compile-opencl-minimal %S/../compile-minimal-test.cl %t.bin 1.2
1010
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
1111
// RUN: FileCheck --check-prefix=BAD %s < %t.log
1212
// BAD: Failed to open cache file

amd/comgr/test-lit/cache-tests/compile-minimal-test-cached-bad-policy.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: AMD_COMGR_CACHE_POLICY="foo=2h" \
77
// RUN: AMD_COMGR_EMIT_VERBOSE_LOGS=1 \
88
// RUN: AMD_COMGR_REDIRECT_LOGS=%t.log \
9-
// RUN: compile-minimal-test %S/../compile-minimal-test.cl %t.bin
9+
// RUN: compile-opencl-minimal %S/../compile-minimal-test.cl %t.bin 1.2
1010
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
1111
// RUN: FileCheck --check-prefix=BAD %s < %t.log
1212
// BAD: when parsing the cache policy: Unknown key: 'foo'

amd/comgr/test-lit/cache-tests/compile-minimal-test-cached.cl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// RUN: rm -fr %t.cache
22
//
33
// RUN: unset AMD_COMGR_CACHE
4-
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
5-
// RUN: %S/../compile-minimal-test.cl %t.bin
4+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-opencl-minimal \
5+
// RUN: %S/../compile-minimal-test.cl %t.bin 1.2
66
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
77
// RUN: [ -d %t.cache ]
88
//
99
// RUN: rm -fr %t.cache
1010
//
1111
// RUN: export AMD_COMGR_CACHE=0
12-
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
13-
// RUN: %S/../compile-minimal-test.cl %t.bin
12+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-opencl-minimal \
13+
// RUN: %S/../compile-minimal-test.cl %t.bin 1.2
1414
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
1515
// RUN: [ ! -d %t.cache ]
1616
//
@@ -19,17 +19,17 @@
1919
// COM: Run once and check that the cache directory exists and it has more than
2020
// COM 1 element (one for the cache tag, one or more for the cached
2121
// COM: commands)
22-
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
23-
// RUN: %S/../compile-minimal-test.cl %t_a.bin
22+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-opencl-minimal \
23+
// RUN: %S/../compile-minimal-test.cl %t_a.bin 1.2
2424
// RUN: llvm-objdump -d %t_a.bin | FileCheck %S/../compile-minimal-test.cl
2525
// RUN: COUNT_BEFORE=$(ls "%t.cache" | wc -l)
2626

2727
// COM: One element for the tag, one for bc->obj another for obj->exec. No
2828
// COM: elements for src->bc since we currently not support it.
2929
// RUN: [ 3 -eq $COUNT_BEFORE ]
3030
//
31-
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
32-
// RUN: %S/../compile-minimal-test.cl %t_b.bin
31+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-opencl-minimal \
32+
// RUN: %S/../compile-minimal-test.cl %t_b.bin 1.2
3333
// RUN: llvm-objdump -d %t_b.bin | FileCheck %S/../compile-minimal-test.cl
3434
// RUN: COUNT_AFTER=$(ls "%t.cache" | wc -l)
3535
// RUN: [ $COUNT_AFTER = $COUNT_BEFORE ]

amd/comgr/test-lit/comgr-sources/compile-minimal-test.c renamed to amd/comgr/test-lit/comgr-sources/compile-opencl-minimal.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- compile-minimal-test.c ---------------------------------------------===//
1+
//===- compile-opencl-minimal.c -------------------------------------------===//
22
//
33
// Part of Comgr, under the Apache License v2.0 with LLVM Exceptions. See
44
// amd/comgr/LICENSE.TXT in this repository for license information.
@@ -26,6 +26,16 @@ int main(int argc, char *argv[]) {
2626

2727
SizeSource = setBuf(argv[1], &BufSource);
2828

29+
amd_comgr_language_t OpenCLVersion;
30+
if (strcmp(argv[3], "1.2")) {
31+
OpenCLVersion = AMD_COMGR_LANGUAGE_OPENCL_1_2;
32+
}
33+
else if (strcmp(argv[3], "2.0")) {
34+
OpenCLVersion = AMD_COMGR_LANGUAGE_OPENCL_1_2;
35+
}
36+
else
37+
fail("unsupported OCL version: %s", argv[3]);
38+
2939
amd_comgr_(create_data_set(&DataSetIn));
3040
amd_comgr_(create_data(AMD_COMGR_DATA_KIND_SOURCE, &DataSource));
3141
amd_comgr_(set_data(DataSource, SizeSource, BufSource));

amd/comgr/test-lit/compile-minimal-test.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// COM: Run Comgr binary to compile OpenCL source into LLVM IR Bitcode,
22
// COM: and, then generate an executable
3-
// RUN: compile-minimal-test %s %t.bin
3+
// RUN: compile-opencl-minimal %s %t.bin 1.2
44

55
// COM: Dissasemble
66
// RUN: llvm-objdump -d %t.bin | FileCheck %s
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// COM: Run Comgr binary to compile OpenCL source into LLVM IR Bitcode,
2+
// COM: and, then generate an executable
3+
// RUN: compile-opencl-minimal %s %t.bin 2.0
4+
5+
// COM: Dissasemble
6+
// RUN: llvm-objdump -d %t.bin | FileCheck %s
7+
// CHECK: <add>:
8+
// CHECK: s_endpgm
9+
10+
void kernel add(__global float *A, __global float *B, __global float *C) {
11+
*C = *A + *B;
12+
}

amd/comgr/test-lit/time-statistics.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// COM: Check for any runtime errors with the Comgr Profilier
2-
// RUN: AMD_COMGR_TIME_STATISTICS=1 compile-minimal-test %s %t.bin
2+
// RUN: AMD_COMGR_TIME_STATISTICS=1 compile-opencl-minimal %s %t.bin 1.2
33
// RUN: test -f PerfStatsLog.txt
44

55
void kernel add(__global float *A, __global float *B, __global float *C) {

0 commit comments

Comments
 (0)