CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
2.9 KiB
C++
94 lines
2.9 KiB
C++
//===-- nsan_stats.h --------------------------------------------*- 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 is a part of NumericalStabilitySanitizer.
|
|
//
|
|
// NSan statistics. This class counts the number of checks per code location,
|
|
// and is used to output statistics (typically when using
|
|
// `disable_warnings=1,enable_check_stats=1,enable_warning_stats=1`).
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef NSAN_STATS_H
|
|
#define NSAN_STATS_H
|
|
|
|
#include "sanitizer_common/sanitizer_addrhashmap.h"
|
|
#include "sanitizer_common/sanitizer_internal_defs.h"
|
|
#include "sanitizer_common/sanitizer_mutex.h"
|
|
|
|
namespace __nsan {
|
|
|
|
enum class CheckTypeT {
|
|
kUnknown = 0,
|
|
kRet,
|
|
kArg,
|
|
kLoad,
|
|
kStore,
|
|
kInsert,
|
|
kUser, // User initiated.
|
|
kFcmp,
|
|
kMaxCheckType,
|
|
};
|
|
|
|
class Stats {
|
|
public:
|
|
Stats();
|
|
~Stats();
|
|
|
|
// Signal that we checked the instruction at the given address.
|
|
void AddCheck(CheckTypeT check_ty, __sanitizer::uptr pc, __sanitizer::uptr bp,
|
|
double rel_err);
|
|
// Signal that we warned for the instruction at the given address.
|
|
void AddWarning(CheckTypeT check_ty, __sanitizer::uptr pc,
|
|
__sanitizer::uptr bp, double rel_err);
|
|
|
|
// Signal that we detected a floating-point load where the shadow type was
|
|
// invalid.
|
|
void AddInvalidLoadTrackingEvent(__sanitizer::uptr pc, __sanitizer::uptr bp);
|
|
// Signal that we detected a floating-point load where the shadow type was
|
|
// unknown but the value was nonzero.
|
|
void AddUnknownLoadTrackingEvent(__sanitizer::uptr pc, __sanitizer::uptr bp);
|
|
|
|
void Print() const;
|
|
|
|
private:
|
|
using IndexMap = __sanitizer::AddrHashMap<__sanitizer::uptr, 11>;
|
|
|
|
struct CheckAndWarningsValue {
|
|
CheckTypeT check_ty;
|
|
__sanitizer::u32 stack_id = 0;
|
|
__sanitizer::u64 num_checks = 0;
|
|
__sanitizer::u64 num_warnings = 0;
|
|
// This is a bitcasted double. Doubles have the nice idea to be ordered as
|
|
// ints.
|
|
double max_relative_err = 0;
|
|
};
|
|
// Map Key(check_ty, StackId) to indices in CheckAndWarnings.
|
|
IndexMap CheckAndWarningsMap;
|
|
__sanitizer::InternalMmapVectorNoCtor<CheckAndWarningsValue>
|
|
check_and_warnings;
|
|
mutable __sanitizer::Mutex check_and_warning_mutex;
|
|
|
|
struct LoadTrackingValue {
|
|
CheckTypeT check_ty;
|
|
__sanitizer::u32 stack_id = 0;
|
|
__sanitizer::u64 num_invalid = 0;
|
|
__sanitizer::u64 num_unknown = 0;
|
|
};
|
|
// Map Key(CheckTypeT::kLoad, StackId) to indices in TrackedLoads.
|
|
IndexMap LoadTrackingMap;
|
|
__sanitizer::InternalMmapVectorNoCtor<LoadTrackingValue> TrackedLoads;
|
|
mutable __sanitizer::Mutex TrackedLoadsMutex;
|
|
};
|
|
|
|
extern Stats *nsan_stats;
|
|
void InitializeStats();
|
|
|
|
} // namespace __nsan
|
|
|
|
#endif // NSAN_STATS_H
|