[libclc] [libclc] Add initial LIT tests (PR #87989)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 09:41:39 PDT 2024


================
@@ -1,3 +1,6 @@
-__kernel void foo(int *i) {
+// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s
----------------
frasercrmck wrote:

Fair enough, I hadn't really appreciated that `update_cc_test_checks` was orthogonal to all of these other LIT concepts like `REQUIRES` and features more broadly, but that's due to my misunderstanding of how that script worked.

Those clang codegen tests that do have `REQUIRES` are relegated to their own target-specific source files. What we want for libclc I think is ideally to be testing every libclc builtin with every target. I was hoping we could use a single set of test files to avoid duplication, but that doesn't seem possible.

So each libclc target would have their own copy of each test source file: `test/amdgcn/smoothstep.cl`, `test/nvidia/smoothstep.cl`, etc? That's not so bad as long as it's easy enough to bring up a new libclc target (maybe with a generator script, though maybe just copy/pasting a directory of tests, removing the old checks, and running `update_cc_test_checks` is sufficient)? I suppose the `amdgpu` tests would be amalgamated and would `RUN` over each sub-target (`r600`, `amdgcn-mesa3d`, etc., as appropriate). Similar for NVIDIA and other groups.

I understand the idea of having libclc targets linked to the backend targets. Some, like `clspv`/`clspv64` and `spirv`/`spirv64`, aren't intrinsically tied to any specific backend. `clspv` targets seem to use the "generic" spir/spir64 triples so could probably be unconditionally enabled, and `spirv` targets are compiled to those same spir/spir64 triples before being compiled to SPIR-V, which we can't test here. My concern is that this might be a breaking change to some downstream users (we don't really know what they're doing with libclc). Either way I'm not sure this needs to concern this initial round of tests - we can probably stomach the complexity.

https://github.com/llvm/llvm-project/pull/87989


More information about the cfe-commits mailing list