Summary: The AMDGPU backend can handle wavefront sizes of 32 and 64, with the native hardware preferring one or the other. The user can override the hardware with `-mwavefrontsize64` or `-mwavefrontsize32` which previously wasn't handled. We need to know the wavefront size to know how much memory to allocate and how to index the RPC buffer. There isn't a good way to do this with ROCm so we just use the LLVM support for offloading to check this from the image.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
//===-- Loader test to check the RPC interface with the loader ------------===//
|
|
//
|
|
// 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 "include/llvm-libc-types/test_rpc_opcodes_t.h"
|
|
#include "src/__support/GPU/utils.h"
|
|
#include "src/__support/RPC/rpc_client.h"
|
|
#include "test/IntegrationTest/test.h"
|
|
|
|
using namespace LIBC_NAMESPACE;
|
|
|
|
static void test_add() {
|
|
uint64_t cnt = gpu::get_lane_id();
|
|
LIBC_NAMESPACE::rpc::Client::Port port =
|
|
LIBC_NAMESPACE::rpc::client.open<RPC_TEST_INCREMENT>();
|
|
port.send_and_recv(
|
|
[=](LIBC_NAMESPACE::rpc::Buffer *buffer, uint32_t) {
|
|
reinterpret_cast<uint64_t *>(buffer->data)[0] = cnt;
|
|
},
|
|
[&](LIBC_NAMESPACE::rpc::Buffer *buffer, uint32_t) {
|
|
cnt = reinterpret_cast<uint64_t *>(buffer->data)[0];
|
|
});
|
|
port.close();
|
|
EXPECT_EQ(cnt, gpu::get_lane_id() + 1);
|
|
EXPECT_EQ(gpu::get_thread_id(), gpu::get_lane_id());
|
|
}
|
|
|
|
TEST_MAIN(int argc, char **argv, char **envp) {
|
|
test_add();
|
|
|
|
return 0;
|
|
}
|