Summary: This removes the use of OpenMP offloading to build the device runtime. The main benefit here is that we no longer need to rely on offloading semantics to build a device only runtime. Things like variants are now no longer needed and can just be simple if-defs. In the future, I will remove most of the special handling here and fold it into calls to the `<gpuintrin.h>` functions instead. Additionally I will rework the compilation to make this a separate runtime. The current plan is to have this, but make including OpenMP and offloading either automatically add it, or print a warning if it's missing. This will allow us to use a normal CMake workflow and delete all the weird 'lets pull the clang binary out of the build' business. ``` -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=offload -DLLVM_RUNTIME_TARGETS=amdgcn-amd-amdhsa ``` After that, linking the OpenMP device runtime will be `-Xoffload-linker -lomp`. I.e. no more fat binary business. Only look at the most recent commit since this includes the two dependencies (fix to AMDGPUEmitPrintfBinding and the PointerToMember bug).
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
//===--- Debug.cpp -------- Debug utilities ----------------------- 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains debug utilities
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Shared/Environment.h"
|
|
|
|
#include "Configuration.h"
|
|
#include "Debug.h"
|
|
#include "DeviceTypes.h"
|
|
#include "Interface.h"
|
|
#include "Mapping.h"
|
|
#include "State.h"
|
|
|
|
using namespace ompx;
|
|
|
|
extern "C" {
|
|
void __assert_assume(bool condition) { __builtin_assume(condition); }
|
|
|
|
#ifndef OMPTARGET_HAS_LIBC
|
|
[[gnu::weak]] void __assert_fail(const char *expr, const char *file,
|
|
unsigned line, const char *function) {
|
|
__assert_fail_internal(expr, nullptr, file, line, function);
|
|
}
|
|
#endif
|
|
|
|
void __assert_fail_internal(const char *expr, const char *msg, const char *file,
|
|
unsigned line, const char *function) {
|
|
if (msg) {
|
|
printf("%s:%u: %s: Assertion %s (`%s`) failed.\n", file, line, function,
|
|
msg, expr);
|
|
} else {
|
|
printf("%s:%u: %s: Assertion `%s` failed.\n", file, line, function, expr);
|
|
}
|
|
__builtin_trap();
|
|
}
|
|
}
|