File tree Expand file tree Collapse file tree 3 files changed +73
-4
lines changed
test/integration/startup/gpu Expand file tree Collapse file tree 3 files changed +73
-4
lines changed Original file line number Diff line number Diff line change @@ -476,14 +476,14 @@ function(add_integration_test test_name)
476476
477477 if (LIBC_TARGET_ARCHITECTURE_IS_AMDGPU)
478478 target_link_options (${fq_build_target_name} PRIVATE
479- ${LIBC_COMPILE_OPTIONS_DEFAULT} -Wno-multi-gpu
480- -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto
479+ ${LIBC_COMPILE_OPTIONS_DEFAULT} ${INTEGRATION_TEST_COMPILE_OPTIONS}
480+ -Wno-multi-gpu - mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto
481481 "-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0" -nostdlib -static
482482 "-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION} " )
483483 elseif (LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
484484 target_link_options (${fq_build_target_name} PRIVATE
485- ${LIBC_COMPILE_OPTIONS_DEFAULT} -Wno-multi-gpu
486- "-Wl,--suppress-stack-size-warning"
485+ ${LIBC_COMPILE_OPTIONS_DEFAULT} ${INTEGRATION_TEST_COMPILE_OPTIONS}
486+ "-Wl,--suppress-stack-size-warning" -Wno-multi-gpu
487487 "-Wl,-mllvm,-nvptx-lower-global-ctor-dtor=1"
488488 "-Wl,-mllvm,-nvptx-emit-init-fini-kernel"
489489 -march=${LIBC_GPU_TARGET_ARCHITECTURE} -nostdlib -static
Original file line number Diff line number Diff line change @@ -53,3 +53,36 @@ add_integration_test(
5353 --threads 32
5454 --blocks 8
5555)
56+
57+ if (LIBC_TARGET_ARCHITECTURE_IS_AMDGPU)
58+ add_integration_test(
59+ startup_rpc_lane_test_w32
60+ SUITE libc-startup-tests
61+ SRCS
62+ rpc_lane_test
63+ LOADER_ARGS
64+ --threads 32
65+ COMPILE_OPTIONS
66+ -mno-wavefrontsize64
67+ )
68+
69+ add_integration_test(
70+ startup_rpc_lane_test_w64
71+ SUITE libc-startup-tests
72+ SRCS
73+ rpc_lane_test.cpp
74+ LOADER_ARGS
75+ --threads 64
76+ COMPILE_OPTIONS
77+ -mwavefrontsize64
78+ )
79+ else ()
80+ add_integration_test(
81+ startup_rpc_lane_test_w32
82+ SUITE libc-startup-tests
83+ SRCS
84+ rpc_lane_test.cpp
85+ LOADER_ARGS
86+ --threads 32
87+ )
88+ endif ()
Original file line number Diff line number Diff line change 1+ // ===-- Loader test to check the RPC interface with the loader ------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " include/llvm-libc-types/test_rpc_opcodes_t.h"
10+ #include " src/__support/GPU/utils.h"
11+ #include " src/__support/RPC/rpc_client.h"
12+ #include " test/IntegrationTest/test.h"
13+
14+ using namespace LIBC_NAMESPACE ;
15+
16+ static void test_add () {
17+ uint64_t cnt = gpu::get_lane_id ();
18+ LIBC_NAMESPACE::rpc::Client::Port port =
19+ LIBC_NAMESPACE::rpc::client.open <RPC_TEST_INCREMENT>();
20+ port.send_and_recv (
21+ [=](LIBC_NAMESPACE::rpc::Buffer *buffer, uint32_t ) {
22+ reinterpret_cast <uint64_t *>(buffer->data )[0 ] = cnt;
23+ },
24+ [&](LIBC_NAMESPACE::rpc::Buffer *buffer, uint32_t ) {
25+ cnt = reinterpret_cast <uint64_t *>(buffer->data )[0 ];
26+ });
27+ port.close ();
28+ ASSERT_TRUE (cnt == gpu::get_lane_id () + 1 && " Incorrect sum" );
29+ ASSERT_TRUE (gpu::get_thread_id () == gpu::get_lane_id () && " Not in same lane" );
30+ }
31+
32+ TEST_MAIN (int argc, char **argv, char **envp) {
33+ test_add ();
34+
35+ return 0 ;
36+ }
You can’t perform that action at this time.
0 commit comments