Previously, OpDSL operation used hardcoded type conversion operations (cast or cast_unsigned). Supporting signed and unsigned casts thus meant implementing two different operations. Type function attributes allow us to define a single operation that has a cast type function attribute which at operation instantiation time may be set to cast or cast_unsigned. We may for example, defina a matmul operation with a cast argument:
@linalg_structured_op def matmul(A=TensorDef(T1, S.M, S.K), B=TensorDef(T2, S.K, S.N), C=TensorDef(U, S.M, S.N, output=True), cast=TypeFnAttrDef(default=TypeFn.cast)): C[D.m, D.n] += cast(U, A[D.m, D.k]) * cast(U, B[D.k, D.n])
When instantiating the operation the attribute may be set to the desired cast function:
linalg.matmul(lhs, rhs, outs=[out], cast=TypeFn.cast_unsigned)
The revsion introduces a enum in the Linalg dialect that maps one-by-one to the type functions defined by OpDSL.
Although I assume you want the common case to be shorter, there is something to say to use cast_signed and cast_unsigned to make the distinction explicit