[llvm] [Utils][SPIR-V] Adding spirv-sim to LLVM (PR #104020)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 07:42:27 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r b10ecfa914dd1bc2013584917d0505ba5f15f75c...e8358c77ada99c1e3baa300ee28bff34edca36a5 llvm/utils/spirv-sim/instructions.py llvm/utils/spirv-sim/spirv-sim.py llvm/test/lit.cfg.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- utils/spirv-sim/spirv-sim.py 2024-08-14 14:02:14.000000 +0000
+++ utils/spirv-sim/spirv-sim.py 2024-08-14 14:42:00.893157 +0000
@@ -8,10 +8,11 @@
from instructions import *
import argparse
import re
RE_EXPECTS = re.compile(r"^([0-9]+,)*[0-9]+$")
+
# Parse the SPIR-V instructions. Some instructions are ignored because
# not required to simulate this module.
# Instructions are to be implemented in instructions.py
def parseInstruction(i):
@@ -42,10 +43,11 @@
raise RuntimeError(
f"{i} instruction definition is not a class. Did you used 'def' instead of 'class'?"
)
return Type(i.line)
+
# Split a list of instructions into pieces. Pieces are delimited by instructions of the type splitType.
# The delimiter is the first instruction of the next piece.
# This function returns no empty pieces:
# - if 2 subsequent delimiters will mean 2 pieces. One with only the first delimiter, and the second
# with the delimiter and following instructions.
@@ -57,10 +59,11 @@
for instruction in instructions:
if type(instruction) is splitType and len(blocks[-1]) > 0:
blocks.append([])
blocks[-1].append(instruction)
return blocks
+
# Defines a BasicBlock in the simulator.
# Begins at an OpLabel, and ends with a control-flow instruction.
class BasicBlock:
def __init__(self, instructions):
``````````
</details>
https://github.com/llvm/llvm-project/pull/104020
More information about the llvm-commits
mailing list