Skip to content

Commit 3dcc374

Browse files
authored
Arm backend: Corrected issue with bitwise and | (pytorch#21936)
Change-Id: Ica87df49e0b1da6ed6aaff422ef72d9065f83724 cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: Elena Zhelezina <elena.zhelezina@arm.com>
1 parent 3f09db5 commit 3dcc374

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎backends/arm/scripts/docgen/generate_vgf_op_support.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,15 @@ def add(target: object, profile: str, evidence: str) -> None:
21962196
return expected
21972197

21982198

2199+
def _format_markdown_table_row(cells: Sequence[str]) -> str:
2200+
# Serializes a list of cell values into a Markdown table row.
2201+
# It escapes literal | characters inside cells so they aren’t
2202+
# interpreted as column separators,
2203+
# then joins the cells using Markdown’s | delimiter.
2204+
escaped_cells = (cell.replace("|", r"\|") for cell in cells)
2205+
return "| " + " | ".join(escaped_cells) + " |"
2206+
2207+
21992208
def generate_markdown(repo_root: Path, *, debug: bool = False) -> str:
22002209
exact_rows, _unresolved, _diagnostics = _scan_vgf_pipeline_tests(repo_root)
22012210
command = "python backends/arm/scripts/docgen/generate_vgf_op_support.py"
@@ -2244,7 +2253,7 @@ def generate_markdown(repo_root: Path, *, debug: bool = False) -> str:
22442253
_format_items(exact_row.quantization_modes, QUANTIZATION_MODE_ORDER),
22452254
_format_test_items(exact_row.tests),
22462255
]
2247-
lines.append("| " + " | ".join(cells) + " |")
2256+
lines.append(_format_markdown_table_row(cells))
22482257
else:
22492258
public_rows = _public_rows_from_exact_rows(exact_rows)
22502259
lines.extend(
@@ -2262,8 +2271,7 @@ def generate_markdown(repo_root: Path, *, debug: bool = False) -> str:
22622271
_format_backtick_items(public_row.dtypes, DTYPE_ORDER),
22632272
_format_items(public_row.quantization_modes, QUANTIZATION_MODE_ORDER),
22642273
]
2265-
lines.append("| " + " | ".join(cells) + " |")
2266-
2274+
lines.append(_format_markdown_table_row(cells))
22672275
return "\n".join(lines).rstrip() + "\n"
22682276

22692277

‎docs/source/backends/arm-vgf/VGF_op_support.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Total supported PyTorch APIs: **153**.
3131
| `torch.bitwise_and` / `&` | FP, INT | `FP32`, `INT8` | 8x8 |
3232
| `torch.bitwise_left_shift` / `<<` | FP, INT | `FP32`, `INT8` | 8x8 |
3333
| `torch.bitwise_not` / `~` | FP, INT | `FP32`, `INT8`, `BOOL` | 8x8 |
34-
| `torch.bitwise_or` / `|` | FP, INT | `FP32`, `INT8` | 8x8 |
34+
| `torch.bitwise_or` / `\|` | FP, INT | `FP32`, `INT8` | 8x8 |
3535
| `torch.bitwise_right_shift` / `>>` | FP, INT | `FP32`, `INT8` | 8x8 |
3636
| `torch.bitwise_xor` / `^` | FP, INT | `FP32`, `INT8` | 8x8 |
3737
| `torch.bmm` | FP, INT | `FP32`, `INT8` | 8x8 |

0 commit comments

Comments
 (0)