xref: /llvm-project/libc/src/stdlib/gpu/abort.cpp (revision a6ef0debb1d60966b5bcc69f7d58a2b75c9c621d)
107102a11SJoseph Huber //===-- GPU implementation of abort ---------------------------------------===//
207102a11SJoseph Huber //
307102a11SJoseph Huber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
407102a11SJoseph Huber // See https://llvm.org/LICENSE.txt for license information.
507102a11SJoseph Huber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
607102a11SJoseph Huber //
707102a11SJoseph Huber //===----------------------------------------------------------------------===//
807102a11SJoseph Huber 
9197e0125SJoseph Huber #include "src/__support/GPU/utils.h"
1007102a11SJoseph Huber #include "src/__support/RPC/rpc_client.h"
1107102a11SJoseph Huber #include "src/__support/common.h"
125ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
1307102a11SJoseph Huber 
1407102a11SJoseph Huber #include "src/stdlib/abort.h"
1507102a11SJoseph Huber 
165ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
1707102a11SJoseph Huber 
1807102a11SJoseph Huber LLVM_LIBC_FUNCTION(void, abort, ()) {
1907102a11SJoseph Huber   // We want to first make sure the server is listening before we abort.
20*a6ef0debSJoseph Huber   rpc::Client::Port port = rpc::client.open<LIBC_ABORT>();
21be0c67c9SJoseph Huber   port.send_and_recv([](rpc::Buffer *, uint32_t) {},
22be0c67c9SJoseph Huber                      [](rpc::Buffer *, uint32_t) {});
23be0c67c9SJoseph Huber   port.send([&](rpc::Buffer *, uint32_t) {});
2407102a11SJoseph Huber   port.close();
2507102a11SJoseph Huber 
2668801985SJoseph Huber   gpu::end_program();
2707102a11SJoseph Huber }
2807102a11SJoseph Huber 
295ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
30