Skip to content
Open
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
18 changes: 18 additions & 0 deletions backends/qualcomm/tests/rework/src/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -4209,9 +4209,15 @@ def forward(self, x, y):
squeeze_out = view_out.squeeze(-1)
return squeeze_out, conv_out

class _RemainderByScalar(torch.nn.Module):
# DecomposeRemainder turns the scalar into an int64 get_attr at the graph head
def forward(self, x, idx):
return x + (idx % 80).float()

@staticmethod
@unpack_pass_fixtures
def test(
subtests,
quantizer,
compile_spec,
backend_type: QnnExecuTorchBackendType,
Expand All @@ -4237,6 +4243,18 @@ def test(
gm, exir_ops.edge.aten._to_copy.default, expected_casts
)

# The int32 cast of a constant must still follow it once the constant is lifted
with subtests.test(msg="constant_cast_order"):
gm = pass_pipeline.lower_edge_ep(
module=I64toI32._RemainderByScalar(),
sample_input=(torch.randn(1, 3), torch.tensor([[3, 170, 85]])),
backend_type=backend_type,
compile_spec=compile_spec,
target_pass=target_pass,
quantizer=quantizer,
).graph_module
gm.graph.lint()


class InsertIOQDQ:
class _Basic(torch.nn.Module):
Expand Down
Loading