Skip to content

Commit

Permalink
PR #22572: Fix build break in convolution_thunk_internal
Browse files Browse the repository at this point in the history
Imported from GitHub PR #22572

After this change 8e6b84b, following build error occurred:

```
In file included from xla/backends/cpu/runtime/convolution_thunk_f16.cc:16:
./xla/backends/cpu/runtime/convolution_thunk_internal.h: In lambda function:
./xla/backends/cpu/runtime/convolution_thunk_internal.h:345:71: error: no matching function for call to ‘tsl::CountDownAsyncValueRef<tsl::Chain>::CountDown() const’
  345 |           auto on_done = [count_down]() mutable { count_down.CountDown(); };
      |                                                   ~~~~~~~~~~~~~~~~~~~~^~
In file included from ./xla/backends/cpu/runtime/convolution_thunk_internal.h:26,
                 from xla/backends/cpu/runtime/convolution_thunk_f16.cc:16:
./xla/tsl/concurrency/async_value_ref.h:867:8: note: candidate: ‘bool tsl::CountDownAsyncValueRef<T>::CountDown(size_t, const absl::lts_20230802::Status&) [with T = tsl::Chain; size_t = long unsigned int]’
  867 |   bool CountDown(size_t count, const absl::Status& status = absl::OkStatus()) {
      |        ^~~~~~~~~
./xla/tsl/concurrency/async_value_ref.h:867:8: note:   candidate expects 2 arguments, 0 provided
./xla/tsl/concurrency/async_value_ref.h:919:8: note: candidate: ‘bool tsl::CountDownAsyncValueRef<T>::CountDown(absl::lts_20230802::Status) [with T = tsl::Chain]’ (near match)
  919 |   bool CountDown(absl::Status status = absl::OkStatus()) {
      |        ^~~~~~~~~
./xla/tsl/concurrency/async_value_ref.h:919:8: note:   passing ‘const tsl::CountDownAsyncValueRef<tsl::Chain>*’ as ‘this’ argument discards qualifiers
```
Copybara import of the project:

--
69268a6 by Milica Makevic <[email protected]>:

Allow modification of captured variable in nested lambda

Merging this change closes #22572

COPYBARA_INTEGRATE_REVIEW=#22572 from ROCm:ci_build_fix_250211 69268a6
PiperOrigin-RevId: 726463713
  • Loading branch information
mmakevic-amd authored and Google-ML-Automation committed Feb 13, 2025
1 parent 7251cc7 commit 26f990f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions xla/backends/cpu/runtime/convolution_thunk_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,16 @@ void EigenGenericConv2D(
auto num_tasks = Eigen::numext::div_ceil(feature_group_count, task_size);

if (use_thunk_runtime) {
ScheduleAll(&device, num_tasks, [=, &device](Eigen::Index task_index) {
Eigen::Index start = task_index * task_size;
Eigen::Index end = std::min(start + task_size, feature_group_count);
for (Eigen::Index i = start; i < end; ++i) {
auto on_done = [count_down]() mutable { count_down.CountDown(); };
auto [output, convolved] = convolve_group(i);
output.device(device, std::move(on_done)) = convolved;
}
});
ScheduleAll(
&device, num_tasks, [=, &device](Eigen::Index task_index) mutable {
Eigen::Index start = task_index * task_size;
Eigen::Index end = std::min(start + task_size, feature_group_count);
for (Eigen::Index i = start; i < end; ++i) {
auto on_done = [count_down]() mutable { count_down.CountDown(); };
auto [output, convolved] = convolve_group(i);
output.device(device, std::move(on_done)) = convolved;
}
});
} else {
Eigen::Barrier barrier(num_tasks);
ScheduleAll(
Expand Down

0 comments on commit 26f990f

Please sign in to comment.