Skip to content
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
1 change: 1 addition & 0 deletions mlir/utils/spirv/gen_spirv_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ def extract_td_op_info(op_def):
op_tmpl_params, _ = get_string_between_nested(op_def, "<", ">")
opstringname, rest = get_string_between(op_tmpl_params, '"', '"')
category_args = rest.split("[", 1)[0]
category_args = category_args.rsplit(",", 1)[0]
Copy link
Member

@kuhar kuhar Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you paste an example of how rest looks like and what you want category_args to be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, when the function is looking at the following op_def (showing just the start):

def SPIRV_VectorTimesScalarOp : SPIRV_Op<"VectorTimesScalar", [Pure]> {
  • rest is , [Pure]
  • we want category_args to be empty

And in this other op_def (again just the start):

def SPIRV_UDivOp : SPIRV_ArithmeticBinaryOp<"UDiv",
                                        SPIRV_Integer, [UnsignedOp, UsableInSpecConstantOp]> {
  • rest is , SPIRV_Integer, [UsableInSpecConstantOp] (whitespace compressed for clarity)
  • we want category_args to be , SPIRV_Integer.

There are different ways to handle this, e.g. store category args as an array and re-join at its users, but would've been larger changes without clear extra benefit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuhar ping


# Get traits
traits, _ = get_string_between_nested(rest, "[", "]")
Expand Down
Loading