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

[Feat] Add bfloat16 value type support in Redis and CPU table backend. #419

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ REGISTER_KERNEL_BUILDER(
REGISTER_KERNEL(int32, double);
REGISTER_KERNEL(int32, float);
REGISTER_KERNEL(int32, int32);
REGISTER_KERNEL(int32, bfloat16);
REGISTER_KERNEL(int64, double);
REGISTER_KERNEL(int64, float);
REGISTER_KERNEL(int64, int32);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ void CreateTableImpl(TableWrapperBase<K, V>** pptable, size_t init_size,
DECLARE_CREATE_TABLE(int32, double);
DECLARE_CREATE_TABLE(int32, float);
DECLARE_CREATE_TABLE(int32, int32);
DECLARE_CREATE_TABLE(int32, bfloat16);
DECLARE_CREATE_TABLE(int64, double);
DECLARE_CREATE_TABLE(int64, float);
DECLARE_CREATE_TABLE(int64, int32);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "tensorflow_recommenders_addons/dynamic_embedding/core/kernels/lookup_impl/lookup_table_op_cpu.h"
namespace tensorflow {
namespace recommenders_addons {
namespace lookup {
namespace cpu {
DEFINE_CREATE_TABLE(int32, bfloat16, 0, 0);
} // namespace cpu
} // namespace lookup
} // namespace recommenders_addons
} // namespace tensorflow
Original file line number Diff line number Diff line change
Expand Up @@ -1842,20 +1842,23 @@ REGISTER_KERNEL_BUILDER(
REGISTER_KERNEL(int32, double);
REGISTER_KERNEL(int32, float);
REGISTER_KERNEL(int32, int32);
REGISTER_KERNEL(int32, bfloat16);
REGISTER_KERNEL(int64_t, double);
REGISTER_KERNEL(int64_t, float);
REGISTER_KERNEL(int64_t, int32);
REGISTER_KERNEL(int64_t, int64_t);
REGISTER_KERNEL(int64_t, tstring);
REGISTER_KERNEL(int64_t, int8);
REGISTER_KERNEL(int64_t, Eigen::half);
REGISTER_KERNEL(int64_t, bfloat16);
REGISTER_KERNEL(tstring, bool);
REGISTER_KERNEL(tstring, double);
REGISTER_KERNEL(tstring, float);
REGISTER_KERNEL(tstring, int32);
REGISTER_KERNEL(tstring, int64_t);
REGISTER_KERNEL(tstring, int8);
REGISTER_KERNEL(tstring, Eigen::half);
REGISTER_KERNEL(tstring, bfloat16);

#undef REGISTER_KERNEL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,12 @@ def test_variable_find_with_exists_and_accum(self):
else:
dim_list = [1, 8, 16, 128]
kv_list = [[dtypes.int32, dtypes.double], [dtypes.int32, dtypes.float32],
[dtypes.int32, dtypes.int32], [dtypes.int64, dtypes.double],
[dtypes.int64, dtypes.float32], [dtypes.int64, dtypes.int32],
[dtypes.int64, dtypes.int64], [dtypes.int64, dtypes.int8],
[dtypes.int64, dtypes.half], [dtypes.int64, dtypes.bfloat16],
[dtypes.string, dtypes.double],
[dtypes.int32, dtypes.int32], [dtypes.int32, dtypes.bfloat16],
[dtypes.int64, dtypes.double], [dtypes.int64, dtypes.float32],
[dtypes.int64, dtypes.int32], [dtypes.int64, dtypes.int64],
[dtypes.int64, dtypes.int8], [dtypes.int64, dtypes.half],
[dtypes.int64,
dtypes.bfloat16], [dtypes.string, dtypes.double],
[dtypes.string, dtypes.float32], [dtypes.string, dtypes.int32],
[dtypes.string, dtypes.int64], [dtypes.string, dtypes.int8],
[dtypes.string, dtypes.half]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,12 @@ def test_variable(self):
else:
dim_list = [1, 8, 16, 128]
kv_list = [[dtypes.int32, dtypes.double], [dtypes.int32, dtypes.float32],
[dtypes.int32, dtypes.int32], [dtypes.int64, dtypes.double],
[dtypes.int64, dtypes.float32], [dtypes.int64, dtypes.int32],
[dtypes.int64, dtypes.int64], [dtypes.int64, dtypes.string],
[dtypes.int32, dtypes.int32], [dtypes.int32, dtypes.bfloat16],
[dtypes.int64, dtypes.double], [dtypes.int64, dtypes.float32],
[dtypes.int64, dtypes.int32], [dtypes.int64, dtypes.int64],
[dtypes.int64, dtypes.int8], [dtypes.int64, dtypes.half],
[dtypes.string, dtypes.double],
[dtypes.int64,
dtypes.bfloat16], [dtypes.string, dtypes.double],
[dtypes.string, dtypes.float32], [dtypes.string, dtypes.int32],
[dtypes.string, dtypes.int64], [dtypes.string, dtypes.int8],
[dtypes.string, dtypes.half]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ def _get_default_devices():
[dtypes.int32, dtypes.float32],
[dtypes.int32, dtypes.int32],
[dtypes.int32, dtypes.float64],
[dtypes.int32, dtypes.bfloat16],
[dtypes.string, dtypes.float32],
[dtypes.string, dtypes.half],
[dtypes.string, dtypes.bfloat16],
Expand Down
Loading