Skip to content

Revert "Make serial parallel_for "polyfill" iterate backwards in debug builds (#9044)" #9188

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

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions .ci/scripts/unittest-buck2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ buck2 query "//backends/apple/... + //backends/example/... + \
//kernels/optimized/... + //kernels/portable/... + //kernels/quantized/... + \
//kernels/test/... + //runtime/... + //schema/... + //test/... + //util/..."

UNBUILDABLE_OPTIMIZED_OPS_REGEX="gelu|fft_r2c|log_softmax"
BUILDABLE_OPTIMIZED_OPS=$(buck2 query //kernels/optimized/cpu/... | grep -E -v $UNBUILDABLE_OPTIMIZED_OPS_REGEX)
# TODO: expand the covered scope of Buck targets.
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
buck2 test $BUILDABLE_OPTIMIZED_OPS //kernels/portable/... //runtime/backend/... //runtime/core/... \
buck2 test //kernels/portable/... //runtime/backend/... //runtime/core/... \
//runtime/executor: //runtime/kernel/... //runtime/platform/...
1 change: 0 additions & 1 deletion kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ def define_libs(is_fbcode=False):
exported_deps = [
"//executorch/kernels/optimized:libutils",
"//executorch/runtime/core/exec_aten:lib",
"//executorch/runtime/kernel:thread_parallel_interface",
],
**get_apple_framework_deps_kwargs(is_fbcode),
)
1 change: 0 additions & 1 deletion runtime/kernel/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def define_common_targets():
exported_headers = ["thread_parallel_interface.h"],
exported_deps = [
"//executorch/runtime/core:core",
"//executorch/runtime/core/portable_type/c10/c10:c10",
"//executorch/runtime/platform:platform",
],
visibility = [
Expand Down
11 changes: 0 additions & 11 deletions runtime/kernel/thread_parallel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <cstdint>
#include <functional>

#include <c10/util/irange.h>
#include <executorch/runtime/core/error.h>
#include <executorch/runtime/platform/assert.h>

Expand All @@ -30,17 +29,7 @@ inline bool parallel_for_no_threadpool(
begin,
end);
ET_CHECK_OR_RETURN_FALSE(grain_size > 0, "grain_size = %" PRId64, grain_size);
#ifndef NDEBUG
// Go backwards through the range elementwise to catch code that
// assumes parallel_for is in order like a regular for loop.
for (const auto i : c10::irange(begin, end)) {
const auto offset = i - begin;
const auto idx = end - offset - 1;
f(idx, idx + 1);
}
#else // NDEBUG
f(begin, end);
#endif
return true;
}

Expand Down
Loading