This PR introduces the initial version of a C++ framework for the conformance testing of GPU math library functions, building upon the skeleton provided in #146391. The main goal of this framework is to systematically measure the accuracy of math functions in the GPU libc, verifying correctness or at least conformance to standards like OpenCL via exhaustive or random accuracy tests.
47 lines
1.9 KiB
C++
47 lines
1.9 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file contains the definition of error handling macros for reporting
|
|
/// fatal error conditions and validating Offload API calls.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef MATHTEST_ERRORHANDLING_HPP
|
|
#define MATHTEST_ERRORHANDLING_HPP
|
|
|
|
#include "mathtest/OffloadForward.hpp"
|
|
|
|
#include "llvm/ADT/Twine.h"
|
|
|
|
#define FATAL_ERROR(Message) \
|
|
mathtest::detail::reportFatalError(Message, __FILE__, __LINE__, __func__)
|
|
|
|
#define OL_CHECK(ResultExpr) \
|
|
do { \
|
|
ol_result_t Result = (ResultExpr); \
|
|
if (Result != OL_SUCCESS) \
|
|
mathtest::detail::reportOffloadError(#ResultExpr, Result, __FILE__, \
|
|
__LINE__, __func__); \
|
|
\
|
|
} while (false)
|
|
|
|
namespace mathtest {
|
|
namespace detail {
|
|
|
|
[[noreturn]] void reportFatalError(const llvm::Twine &Message, const char *File,
|
|
int Line, const char *FuncName);
|
|
|
|
[[noreturn]] void reportOffloadError(const char *ResultExpr, ol_result_t Result,
|
|
const char *File, int Line,
|
|
const char *FuncName);
|
|
} // namespace detail
|
|
} // namespace mathtest
|
|
|
|
#endif // MATHTEST_ERRORHANDLING_HPP
|