Skip to content

nir: Add NIR_OP_IS_DERIVATIVE property

Alyssa Rosenzweig requested to merge alyssa/mesa:nir/is-derivative into main

This adds a mostly-generated nir_op_is_derivative() helper. In comparison to the handwritten helper in nir_opt_gcm, this correctly handles Mali-specific derivatives, although this probably doesn't fix any actual bugs yet. This came up for !24833 (merged), which needs to skip over derivatives for correctness. We concluded that derivatives should probably be intrinsics, but changing that seems like a significant effort with little pay-off. As a stopgap, this makes them easier to deal with while ALU.

The idea of using opcode properties for this was first floated for nir_op_is_selection(), which is used as a guide here. Ultimately I'd like to encode more opcode "classes" as part of the Python descriptions instead of having random switch statements all over.

Merge request reports