Skip to content

Arm backend: Add check to not partition ops with float64 input #10106

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
Apr 11, 2025
Merged
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
24 changes: 24 additions & 0 deletions backends/arm/operator_support/tosa_supported_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def tosa_support_factory(
# Negative checks: Remove nodes from partitioning
negative_checks: list[OperatorSupportBase] = [
CheckInt64Inputs(exported_program, reporter),
CheckFloat64Inputs(exported_program, reporter),
*[
reporter.wrap_check(check, f"Rejected by {check.__class__.__name__}")
for check in (additional_checks if additional_checks else [])
Expand Down Expand Up @@ -443,3 +444,26 @@ def is_node_supported(
)
return False
return True


class CheckFloat64Inputs(OperatorSupportBase):

def __init__(
self, exported_program: ExportedProgram, reporter: WhyNoPartitionReporter
):
self.reporter = reporter
super().__init__()

def is_node_supported(
self, submodules: typing.Mapping[str, torch.nn.Module], node: fx.Node
) -> bool:

for input_node in node.all_input_nodes:
tensor = get_first_fake_tensor(input_node)
if tensor.dtype == torch.float64:
self.reporter.report_reject(
node,
f"Had float64 input {input_node.name} that couldn't be handled.",
)
return False
return True
Loading