Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request of !stablehlo.string type #2425

Open
qingyunqu opened this issue Jul 3, 2024 · 3 comments
Open

Request of !stablehlo.string type #2425

qingyunqu opened this issue Jul 3, 2024 · 3 comments

Comments

@qingyunqu
Copy link
Contributor

Request description

Is it possible to add !stablehlo.string type to undertake type like !tf_type.string in tensorflow dialect?

@qingyunqu
Copy link
Contributor Author

qingyunqu commented Jul 3, 2024

We will lowering !tf_type.string to !stablehlo.string in our custom pipeline. But I need serialization support on this type.
We may also need stablehlo.constant to support DenseStringElements, like:

%0 = stablehlo.constant dense<"abc"> : tensor<3x!stablehlo.string>

@GleasonK
Copy link
Member

GleasonK commented Jul 8, 2024

Can you say more on what happens to these types? Do you intend for there to be stablehlo op support for strings? add / concatenate / etc? Or only need for there to be some serialization support?

If the latter, I'm working on a VHLO interop mode which may satisfy the requirement, allow VHLO and other dialects/types to co-exist.

@qingyunqu
Copy link
Contributor Author

Can you say more on what happens to these types? Do you intend for there to be stablehlo op support for strings? add / concatenate / etc? Or only need for there to be some serialization support?

If the latter, I'm working on a VHLO interop mode which may satisfy the requirement, allow VHLO and other dialects/types to co-exist.

In our usage, it maybe like:

func.func @main(%arg0: tensor<512x!stablehlo.string>) -> tensor<512xi1> {
    %0 = stablehlo.constant dense<"aaa"> : tensor<512x!stablehlo.string>
    %1 = stablehlo.custom_call @tf.Equal(%arg0, %0) : (tensor<512x!stablehlo.string>, tensor<512x!stablehlo.string>) -> tensor<512xi1>
    return %1 : tensor<512xi1> 
}

We don't need add/concatenate support. Only need serialization support for stablehlo.constant with string type.
For stablehlo.custom_call, it's backward compatibility maintained by oursevles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants