Skip to content

Conversation

@dbort
Copy link
Contributor

@dbort dbort commented Oct 18, 2024

Summary:
Now that we're using C++17, we don't need to maintain a custom implementation of optional.

The standard optional has an implicit ctor that causes ambiguities in some reduce_util.h functions. Add explicit overrides to resolve the ambiguities.

Note that this is technically an API break, since exec_aten::optional is changing in a way that can break some existing code. There is no way to roll this out incrementally, though, and there should not be many examples of user code that would break because of this change.

Differential Revision: D64634702

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 18, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6366

Note: Links to docs will display an error until the docs builds have been completed.

❌ 27 New Failures

As of commit 0caf233 with merge base 3a1f8d2 (image):

NEW FAILURES - The following jobs have failed:

  • Build documentation / build (buck2) / Build doc (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-binary-size-linux-gcc / linux-job (gh)
    RuntimeError: Command docker exec -t 8683b7d5a9adea4d100c687978d95f2224ba5ebb4258d1a45ce89a4b813358a6 /exec failed with exit code 1
  • pull / test-custom-ops-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-eval_llama-mmlu-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-eval_llama-wikitext-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama_runner_eager-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama-runner-linux (bf16, custom) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama-runner-linux (bf16, portable) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-llama-runner-linux (fp32, portable) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama-runner-linux (fp32, xnnpack+custom) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama-runner-linux (fp32, xnnpack+custom+qe) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-llama-runner-qnn-linux (fp32, qnn) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-llava-runner-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (buck2, mv3, portable, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (buck2, mv3, xnnpack-quantization-delegation, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (cmake, mv3, portable, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (cmake, mv3, xnnpack-quantization-delegation, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (cmake, vit, portable, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-models-linux (cmake, vit, xnnpack-quantization-delegation, linux.2xlarge, 90) / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-phi-3-mini-runner-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-pybind-build-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-quantized-aot-lib-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'
  • pull / test-selective-build-linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / test-setup-linux-gcc / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of ‘struct executorch::extension::internal::type_convert<std::optional<_Tp>, std::optional<_Up> >’
  • pull / unittest / linux / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / unittest / macos / macos-job (gh)
    /Users/ec2-user/runner/_work/executorch/executorch/pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:171:8: error: redefinition of 'type_convert<torch::executor::optional<F>, std::optional<T>>'
  • pull / unittest-arm / linux-job (gh)
    /pytorch/executorch/extension/llm/custom_ops/../../../../executorch/extension/aten_util/make_aten_functor_from_et_functor.h:93:12: error: no matching conversion for static_cast from 'std::optional<at::Tensor>' to 'std::optional<executorch::runtime::etensor::Tensor>'

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 18, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64634702

Summary:

Now that we're using C++17, we don't need to maintain a custom implementation of `optional`.

The standard optional has an implicit ctor that causes ambiguities in some reduce_util.h functions. Add explicit overrides to resolve the ambiguities.

Note that this is technically an API break, since exec_aten::optional is changing in a way that can break some existing code. There is no way to roll this out incrementally, though, and there should not be many examples of user code that would break because of this change.

Differential Revision: D64634702
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D64634702

@dbort dbort changed the title Remove custom implementations of optional and string_view Remove custom implementation of optional Nov 5, 2024
@github-actions
Copy link

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the stale PRs inactive for over 60 days label Aug 28, 2025
@github-actions
Copy link

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported stale PRs inactive for over 60 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants