Skip to content

Commit 89aa1ca

Browse files
authored
[Comgr] Move cache LIT tests to sub-directory (llvm#1922)
1 parent aefffa1 commit 89aa1ca

8 files changed

+55
-51
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
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
10-
// RUN: llvm-objdump -d %t.bin | FileCheck %S/compile-minimal-test.cl
9+
// RUN: compile-minimal-test %S/../compile-minimal-test.cl %t.bin
10+
// 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
1313
// BAD-SAME: Not a directory

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
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
10-
// RUN: llvm-objdump -d %t.bin | FileCheck %S/compile-minimal-test.cl
9+
// RUN: compile-minimal-test %S/../compile-minimal-test.cl %t.bin
10+
// 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'
1313
//
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: rm -fr %t.cache
2+
//
3+
// 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
6+
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
7+
// RUN: [ -d %t.cache ]
8+
//
9+
// RUN: rm -fr %t.cache
10+
//
11+
// 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
14+
// RUN: llvm-objdump -d %t.bin | FileCheck %S/../compile-minimal-test.cl
15+
// RUN: [ ! -d %t.cache ]
16+
//
17+
// RUN: export AMD_COMGR_CACHE=1
18+
//
19+
// COM: Run once and check that the cache directory exists and it has more than
20+
// COM 1 element (one for the cache tag, one or more for the cached
21+
// COM: commands)
22+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
23+
// RUN: %S/../compile-minimal-test.cl %t_a.bin
24+
// RUN: llvm-objdump -d %t_a.bin | FileCheck %S/../compile-minimal-test.cl
25+
// RUN: COUNT_BEFORE=$(ls "%t.cache" | wc -l)
26+
27+
// COM: One element for the tag, one for bc->obj another for obj->exec. No
28+
// COM: elements for src->bc since we currently not support it.
29+
// RUN: [ 3 -eq $COUNT_BEFORE ]
30+
//
31+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test \
32+
// RUN: %S/../compile-minimal-test.cl %t_b.bin
33+
// RUN: llvm-objdump -d %t_b.bin | FileCheck %S/../compile-minimal-test.cl
34+
// RUN: COUNT_AFTER=$(ls "%t.cache" | wc -l)
35+
// RUN: [ $COUNT_AFTER = $COUNT_BEFORE ]
36+
//

amd/comgr/test-lit/spirv-translator-cached.cl renamed to amd/comgr/test-lit/cache-tests/spirv-translator-cached.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: rm -fr %t.cache
44

55
// COM: Generate a spirv-targeted LLVM IR file from an OpenCL kernel
6-
// RUN: clang -c -emit-llvm --target=spirv64 %S/spirv-translator.cl -o %t.bc
6+
// RUN: clang -c -emit-llvm --target=spirv64 %S/../spirv-translator.cl -o %t.bc
77

88
// COM: Translate LLVM IR to SPIRV format
99
// RUN: amd-llvm-spirv --spirv-target-env=CL2.0 %t.bc -o %t.spv
@@ -15,9 +15,10 @@
1515
// RUN: [ 2 -eq $COUNT ]
1616

1717
// COM: Run again and check that the cache contents haven't changed
18-
// RUN: AMD_COMGR_CACHE_DIR=%t.cache spirv-translator %t.spv -o %t.translated.again.bc
18+
// RUN: AMD_COMGR_CACHE_DIR=%t.cache spirv-translator %t.spv -o \
19+
// RUN: %t.translated.again.bc
1920
// RUN: COUNT=$(ls "%t.cache" | wc -l)
2021
// RUN: [ 2 -eq $COUNT ]
2122

2223
// COM: Dissasemble LLVM IR bitcode to LLVM IR text
23-
// RUN: llvm-dis %t.translated.bc -o - | FileCheck %S/spirv-translator.cl
24+
// RUN: llvm-dis %t.translated.bc -o - | FileCheck %S/../spirv-translator.cl

amd/comgr/test-lit/unbundle-test-cached.hip renamed to amd/comgr/test-lit/cache-tests/unbundle-test-cached.hip

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@
1212
// With the cache enabled, test that we write one file to the cache
1313
// RUN: export AMD_COMGR_CACHE=1
1414
// RUN: export AMD_COMGR_CACHE_DIR=%t.cache
15-
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx900 %t.cache_1.bc
15+
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx900 \
16+
// RUN: %t.cache_1.bc
1617
// RUN: llvm-dis %t.cache_1.bc -o - | FileCheck --check-prefixes=BOTH,GFX9 %s
1718
// RUN: COUNT=$(ls "%t.cache" | wc -l)
1819
// RUN: [ 2 -eq $COUNT ]
1920
//
2021
// If there is a re-run, the cache contents remain the same
21-
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx900 %t.cache_2.bc
22+
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx900 \
23+
// RUN: %t.cache_2.bc
2224
// RUN: llvm-dis %t.cache_2.bc -o - | FileCheck --check-prefixes=BOTH,GFX9 %s
2325
// RUN: COUNT=$(ls "%t.cache" | wc -l)
2426
// RUN: [ 2 -eq $COUNT ]
2527
//
2628
// A run with different input options results in new contents in the cache
27-
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx1030 %t.cache_3.bc
29+
// RUN: unbundle %t.compressed-bundle.bc hip-amdgcn-amd-amdhsa-unknown-gfx1030 \
30+
// RUN: %t.cache_3.bc
2831
// RUN: llvm-dis %t.cache_3.bc -o - | FileCheck --check-prefixes=BOTH,GFX10 %s
2932
// RUN: COUNT=$(ls "%t.cache" | wc -l)
3033
// RUN: [ 3 -eq $COUNT ]

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

Lines changed: 0 additions & 28 deletions
This file was deleted.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// COM: Run Comgr binary to compile OpenCL source into LLVM IR Bitcode,
2-
// COM: And then generating an executable
3-
// RUN: compile-minimal-test %s %t.bin
1+
// COM: Run Comgr binary to compile OpenCL source into LLVM IR Bitcode,
2+
// COM: and, then generate an executable
3+
// RUN: compile-minimal-test %s %t.bin
44

55
// COM: Dissasemble
66
// RUN: llvm-objdump -d %t.bin | FileCheck %s
7-
// CHECK: <add>:
8-
// CHECK: s_endpgm
7+
// CHECK: <add>:
8+
// CHECK: s_endpgm
99

1010
void kernel add(__global float *A, __global float *B, __global float *C) {
1111
*C = *A + *B;

amd/comgr/test-lit/hello-world.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)