Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions backends/xnnpack/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ fbcode_target(_kind = runtime.python_test,
"//executorch/exir:lib",
"//executorch/exir/capture:config",
"//executorch/exir/passes:constant_prop_pass",
"//executorch/export:export_utils",
"//executorch/runtime:runtime",
"//pytorch/ao:torchao", # @manual
],
Expand Down Expand Up @@ -191,6 +192,7 @@ fbcode_target(_kind = runtime.python_test,
"//caffe2:torch",
"//executorch/backends/xnnpack/partition:xnnpack_partitioner",
"//executorch/exir:lib",
"//executorch/export:export_utils",
"//executorch/extension/pybindings:portable_lib",
],
)
5 changes: 5 additions & 0 deletions backends/xnnpack/test/ops/test_bmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import torch
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
from executorch.backends.xnnpack.test.tester import Tester, ToEdgeTransformAndLower
from executorch.export.utils import is_fbcode


class TestBMM(unittest.TestCase):
Expand Down Expand Up @@ -49,6 +50,10 @@ def test_fp32_bmm(self):
)
self._test_bmm(inputs)

@unittest.skipIf(
is_fbcode(),
"skipping for fbcode",
)
def test_bf16_bmm(self):
inputs = (
torch.randn(2, 3, 4).to(torch.bfloat16),
Expand Down
9 changes: 9 additions & 0 deletions backends/xnnpack/test/test_xnnpack_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
from executorch.exir import to_edge, to_edge_transform_and_lower
from executorch.export.utils import is_fbcode
from executorch.extension.pybindings.portable_lib import (
_load_for_executorch_from_buffer,
)
Expand Down Expand Up @@ -219,6 +220,10 @@ def lower(module, x):
).forward((bf16_x,))[0]
torch.testing.assert_close(output, module(bf16_x))

@unittest.skipIf(
is_fbcode(),
"skipping for fbcode",
)
def test_enable_bf16_fuses_batch_norm_into_a_linear(self):
"""
XNNPACK cannot define a bf16 BatchNorm on its own, but one that follows a
Expand Down Expand Up @@ -259,6 +264,10 @@ def forward(self, x):
).forward((x,))[0]
torch.testing.assert_close(output, module(x), atol=1e-2, rtol=1e-2)

@unittest.skipIf(
is_fbcode(),
"skipping for fbcode",
)
def test_enable_bf16_runs_an_attention_block(self):
"""
The linear layers and both batch matrix multiplications of a bf16 attention
Expand Down
Loading