| 1 | //===-- GPU implementation of abort ---------------------------------------===// |
| 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 "src/__support/GPU/utils.h" |
| 10 | #include "src/__support/RPC/rpc_client.h" |
| 11 | #include "src/__support/common.h" |
| 12 | #include "src/__support/macros/config.h" |
| 13 | |
| 14 | #include "src/stdlib/abort.h" |
| 15 | |
| 16 | namespace LIBC_NAMESPACE_DECL { |
| 17 | |
| 18 | LLVM_LIBC_FUNCTION(void, abort, ()) { |
| 19 | // We want to first make sure the server is listening before we abort. |
| 20 | rpc::Client::Port port = rpc::client.open<LIBC_ABORT>(); |
| 21 | port.send_and_recv([](rpc::Buffer *, uint32_t) {}, |
| 22 | [](rpc::Buffer *, uint32_t) {}); |
| 23 | port.send([&](rpc::Buffer *, uint32_t) {}); |
| 24 | port.close(); |
| 25 | |
| 26 | gpu::end_program(); |
| 27 | } |
| 28 | |
| 29 | } // namespace LIBC_NAMESPACE_DECL |
| 30 | |