Skip to content

Conversation

@martinlsm
Copy link
Collaborator

@martinlsm martinlsm commented Feb 11, 2026

Add FP16 support for operators:

  • add
  • amax
  • amin
  • permute
  • sum

Add BF16 support for operators:

  • amax
  • amin

cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai

Martin Lindström added 2 commits February 11, 2026 14:42
Add FP16 support for operators:
 - add
 - amax
 - amin
 - permute
 - sum

Signed-off-by: Martin Lindström <Martin.Lindstroem@arm.com>
Change-Id: Iacdf79adf8e4ce9d16dce91f590f49eef339323d
Signed-off-by: Martin Lindström <Martin.Lindstroem@arm.com>
Change-Id: I42d15ff8c62463fe628bad103ef24b7a11b8b4a3
Copilot AI review requested due to automatic review settings February 11, 2026 13:51
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 11, 2026

🔗 Helpful Links

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

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

❌ 1 Awaiting Approval, 10 New Failures, 15 Unrelated Failures

As of commit c3b4336 with merge base 9c74c32 (image):

AWAITING APPROVAL - The following workflow needs approval before CI can run:

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-cla meta-cla 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 Feb 11, 2026
@martinlsm
Copy link
Collaborator Author

@pytorchbot label ciflow/trunk

@martinlsm
Copy link
Collaborator Author

@pytorchbot label "partner: arm"

@pytorch-bot pytorch-bot bot added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label Feb 11, 2026
@martinlsm
Copy link
Collaborator Author

@pytorchbot label "release notes: arm"

@pytorch-bot pytorch-bot bot added the release notes: arm Changes to the ARM backend delegate label Feb 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds FP16 (and for a subset, BF16) support coverage for the Arm backend by expanding operator dtype validation and extending the existing operator test suites.

Changes:

  • Allow FP16 (and BF16 where applicable) in Arm TOSA lowering dtype validation for add, sum, permute, amax, and amin.
  • Extend Arm backend operator tests to exercise FP16 (and BF16 for amax/amin) paths across TOSA FP and (where relevant) VGF pipelines.
  • Refactor some test parametrization/xfail mappings to separate FP vs INT expectations.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
backends/arm/test/ops/test_to_copy.py Splits redundant-cast xfail mappings for FP vs INT pipelines.
backends/arm/test/ops/test_sum.py Adds FP16 test coverage for sum (dim_IntList and default variants).
backends/arm/test/ops/test_permute.py Adds FP16 test coverage for permute and simplifies test suite dict composition.
backends/arm/test/ops/test_amin.py Adds FP16/BF16 test cases and uses explicit op-name constants for pipelines.
backends/arm/test/ops/test_amax.py Adds FP16/BF16 test cases and uses explicit op-name constants for pipelines.
backends/arm/test/ops/test_add.py Adds FP16/BF16 test cases for add variants and consolidates FP tests.
backends/arm/operators/op_sum.py Allows FP16 dtype in sum dtype validation.
backends/arm/operators/op_permute.py Allows FP16 dtype in permute dtype validation.
backends/arm/operators/op_amin.py Allows FP16 and BF16 dtypes in amin dtype validation.
backends/arm/operators/op_amax.py Allows FP16 and BF16 dtypes in amax dtype validation.
backends/arm/operators/op_add.py Allows FP16 dtype in add dtype validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +25
amin_exir_op = "executorch_exir_dialects_edge__ops_aten_amin_default"

min_aten_op = "torch.ops.aten.min"
min_exir_op = "executorch_exir_dialects_edge__ops_aten_min_default"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amin_exir_op and min_exir_op are defined but never referenced in this file. Consider deleting them or using them in the relevant pipelines / not-delegated checks to avoid unused-variable lint issues and keep the test definitions focused.

Suggested change
amin_exir_op = "executorch_exir_dialects_edge__ops_aten_amin_default"
min_aten_op = "torch.ops.aten.min"
min_exir_op = "executorch_exir_dialects_edge__ops_aten_min_default"
min_aten_op = "torch.ops.aten.min"

Copilot uses AI. Check for mistakes.

test_data_fp16 = {
"4d_big_small_fp16": lambda: (
(10e10) * torch.randn(1, 10, 20, 30, dtype=torch.float16),
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_data_fp16 scales random FP16 values by 10e10 (~1e11), which will overflow FP16 (max ~6.5e4) and likely produce inf/-inf. This makes the test less meaningful and can hide numerical issues; consider using a scale within FP16 range (or generate values already bounded) so the test exercises real finite FP16 behavior.

Suggested change
(10e10) * torch.randn(1, 10, 20, 30, dtype=torch.float16),
(1e4) * torch.randn(1, 10, 20, 30, dtype=torch.float16),

Copilot uses AI. Check for mistakes.
Comment on lines +109 to +114
test_data_fp16: list[input_t2] = {
"4d_randn_diff_rank_fp16": lambda: (
torch.randn(1, 1, 4, 4, dtype=torch.float16),
torch.randn(4, 1, dtype=torch.float16),
),
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation for test_data_fp16 is list[input_t2], but the assigned value is a dict keyed by test name. This mismatch can confuse readers and breaks static type checking; annotate it as a Dict[str, Callable[[], input_t2]] (or similar) to match usage.

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +121
test_data_bf16: list[input_t2] = {
"4d_randn_diff_rank_bf16": lambda: (
torch.randn(1, 1, 4, 4, dtype=torch.bfloat16),
torch.randn(4, 1, dtype=torch.bfloat16),
),
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation for test_data_bf16 is list[input_t2], but the assigned value is a dict keyed by test name. Update the annotation to a Dict[...] (matching how it’s used with common.parametrize and dict union) to avoid type confusion.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +24
amax_exir_op = "executorch_exir_dialects_edge__ops_aten_amax_default"

max_aten_op = "torch.ops.aten.max"
max_exir_op = "executorch_exir_dialects_edge__ops_aten_max_default"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amax_exir_op and max_exir_op are defined but never used in this test module. If they’re not needed, remove them; if they are, prefer using them where you currently inline the EXIR op strings to keep the file consistent and avoid unused-symbol lint failures.

Suggested change
amax_exir_op = "executorch_exir_dialects_edge__ops_aten_amax_default"
max_aten_op = "torch.ops.aten.max"
max_exir_op = "executorch_exir_dialects_edge__ops_aten_max_default"
max_aten_op = "torch.ops.aten.max"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants