-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang][libc] Add wrapper headers for
assert.h
for the GPU libc
Summary: This patch adds the `assert.h` wrapper header. I forgot to include this in the last patch.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//===-- Wrapper for C standard assert.h declarations on the GPU ------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ | ||
#define __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ | ||
|
||
#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) | ||
#error "This file is for GPU offloading compilation only" | ||
#endif | ||
|
||
#include_next <assert.h> | ||
|
||
#if __has_include(<llvm-libc-decls/assert.h>) | ||
|
||
#if defined(__HIP__) || defined(__CUDA__) | ||
#define __LIBC_ATTRS __attribute__((device)) | ||
#endif | ||
|
||
#pragma omp begin declare target | ||
|
||
#include <llvm-libc-decls/assert.h> | ||
|
||
#pragma omp end declare target | ||
|
||
#undef __LIBC_ATTRS | ||
|
||
#endif | ||
|
||
#endif // __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ |