This patch enables integration tests running on the GPU. This uses the
RPC interface implemented in D145913 to compile the necessary
dependencies for the integration test object. We can then use this to
compile the objects for the GPU directly and execute them using the AMD
HSA loader combined with its RPC server. For example, the compiler is
performing the following actions to execute the integration tests.
```
$ clang++ --target=amdgcn-amd-amdhsa -mcpu=gfx1030 -nostdlib -flto -ffreestanding \
crt1.o io.o quick_exit.o test.o rpc_client.o args_test.o -o image
$ ./amdhsa_loader image 1 2 5
args_test.cpp:24: Expected 'my_streq(argv[3], "3")' to be true, but is false
```
This currently only works with a single threaded client implementation
running on AMDGPU. Further work will implement multiple clients for AMD
and the ability to run on NVPTX as well.
Depends on D145913
Reviewed By: sivachandra, JonChesterfield
Differential Revision: https://reviews.llvm.org/D146256
28 lines
819 B
C++
28 lines
819 B
C++
//===-- Loader test to check args to main ---------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "test/IntegrationTest/test.h"
|
|
|
|
static bool my_streq(const char *lhs, const char *rhs) {
|
|
const char *l, *r;
|
|
for (l = lhs, r = rhs; *l != '\0' && *r != '\0'; ++l, ++r)
|
|
if (*l != *r)
|
|
return false;
|
|
|
|
return *l == '\0' && *r == '\0';
|
|
}
|
|
|
|
TEST_MAIN(int argc, char **argv) {
|
|
ASSERT_TRUE(argc == 4);
|
|
ASSERT_TRUE(my_streq(argv[1], "1"));
|
|
ASSERT_TRUE(my_streq(argv[2], "2"));
|
|
ASSERT_TRUE(my_streq(argv[3], "3"));
|
|
|
|
return 0;
|
|
}
|