[compiler-rt] [compiler-rt][nsan] Add support for nan detection (PR #101531)
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 11:24:17 PDT 2024
================
@@ -0,0 +1,49 @@
+// RUN: %clangxx_nsan -O0 -g -DSOFTMAX=softmax %s -o %t
+// RUN: NSAN_OPTIONS=halt_on_error=1,log2_max_relative_error=19 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_nsan -O0 -g -DSOFTMAX=softmax %s -o %t
+// RUN: NSAN_OPTIONS=halt_on_error=1,log2_max_relative_error=19 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_nsan -O0 -g -DSOFTMAX=stable_softmax %s -o %t
+// RUN: NSAN_OPTIONS=halt_on_error=1,log2_max_relative_error=19 %run %t 2>&1
+// RUN: %clangxx_nsan -O0 -g -DSOFTMAX=stable_softmax %s -o %t
+// RUN: NSAN_OPTIONS=halt_on_error=1,log2_max_relative_error=19 %run %t 2>&1
+
+#include<iostream>
+#include<vector>
+#include<algorithm>
+#include<cmath>
+// unstable softmax
+template <typename T>
+__attribute__((noinline)) void softmax(std::vector<T> &values) {
----------------
alexander-shaposhnikov wrote:
const std::vector<T> &values
https://github.com/llvm/llvm-project/pull/101531
More information about the llvm-commits
mailing list