8000 Remove __ubsan_ignore_undefined__ by cyyever · Pull Request #143252 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Remove __ubsan_ignore_undefined__ #143252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions aten/src/ATen/native/cpu/BinaryOpsKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ void add_clamp_kernel(
auto max_vec = Vectorized<scalar_t>(max_scalar);
cpu_kernel_vec(
iter,
[=](scalar_t a, scalar_t b) __ubsan_ignore_undefined__ -> scalar_t {
[=](scalar_t a, scalar_t b) -> scalar_t {
return std::min(
max_scalar,
std::max(min_scalar, static_cast<scalar_t>(a + alpha * b)));
},
[=](Vectorized<scalar_t> a, Vectorized<scalar_t> b)
__ubsan_ignore_undefined__ {
[=](Vectorized<scalar_t> a, Vectorized<scalar_t> b) {
auto add_clamp_res = vec::fmadd(b, alpha_vec, a);
add_clamp_res = vec::clamp_min(add_clamp_res, min_vec);
add_clamp_res = vec::clamp_max(add_clamp_res, max_vec);
Expand Down Expand Up @@ -142,10 +141,10 @@ void mul_kernel(TensorIteratorBase& iter) {
iter.remove_operand(2);
cpu_kernel_vec(
iter,
[=](scalar_t a) __ubsan_ignore_undefined__ -> scalar_t {
[=](scalar_t a) -> scalar_t {
return static_cast<opmath_t>(a) * b;
},
[=](Vectorized<scalar_t> a) __ubsan_ignore_undefined__ {
[=](Vectorized<scalar_t> a) {
return binary_op_scalar(
a,
b,
Expand All @@ -157,10 +156,8 @@ void mul_kernel(TensorIteratorBase& iter) {
_AT_DISPATCH_MUL_TYPES(dtype, "mul_cpu", [&]() {
cpu_kernel_vec(
iter,
[=](scalar_t a, scalar_t b)
__ubsan_ignore_undefined__ -> scalar_t { return a * b; },
[=](Vectorized<scalar_t> a, Vectorized<scalar_t> b)
__ubsan_ignore_undefined__ { return a * b; });
[=](scalar_t a, scalar_t b) -> scalar_t { return a * b; },
[=](Vectorized<scalar_t> a, Vectorized<scalar_t> b) { return a * b; });
});
}
}
Expand Down
Loading
0