Fix accidental signature change to get_serialized_metadata() from nanobind PR.

pybind11 accepts either Python strings or bytes as a std::string argument, whereas nanobind accepts only strings. Change the argument to nb::bytes instead.

PiperOrigin-RevId: 560086072
This commit is contained in:
Peter Hawkins 2023-08-25 07:30:44 -07:00 committed by jax authors
parent 87cec1a6e8
commit ac8ea86103

View File

@ -134,10 +134,11 @@ NB_MODULE(_triton, m) {
m.def("get_serialized_metadata",
ValueOrThrowWrapper(
[](std::string_view opaque) -> absl::StatusOr<nb::bytes> {
[](nb::bytes opaque) -> absl::StatusOr<nb::bytes> {
JAX_ASSIGN_OR_RETURN(
std::string metadata,
GetTritonKernelCallSerializedMetadata(opaque));
GetTritonKernelCallSerializedMetadata(
absl::string_view(opaque.c_str(), opaque.size())));
return nb::bytes(metadata.c_str(), metadata.size());
}));
}