Skip to content

Support Half/BFloat16 in scatter #7864

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

Merged
merged 2 commits into from
Jan 23, 2025
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
4 changes: 2 additions & 2 deletions kernels/portable/cpu/op_scatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Tensor& scatter_src_out(

constexpr auto name = "scatter.src_out";

ET_SWITCH_REALHB_TYPES(in.scalar_type(), ctx, name, CTYPE, [&]() {
ET_SWITCH_REALHBBF16_TYPES(in.scalar_type(), ctx, name, CTYPE, [&]() {
scatter_src_helper<CTYPE>(in, dim, index, src, out);
});

Expand Down Expand Up @@ -158,7 +158,7 @@ Tensor& scatter_value_out(
CTYPE_VAL val;
utils::extract_scalar(value, &val);

ET_SWITCH_REALHB_TYPES(in.scalar_type(), ctx, name, CTYPE, [&]() {
ET_SWITCH_REALHBBF16_TYPES(in.scalar_type(), ctx, name, CTYPE, [&]() {
scatter_value_helper<CTYPE>(in, dim, index, val, out);
});
});
Expand Down
1 change: 1 addition & 0 deletions kernels/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ set(all_test_sources
"op_rsqrt_test.cpp"
"op_rsub_test.cpp"
"op_scalar_tensor_test.cpp"
"op_scatter_test.cpp"
"op_scatter_add_test.cpp"
"op_select_scatter_test.cpp"
"op_select_copy_test.cpp"
Expand Down
4 changes: 2 additions & 2 deletions kernels/test/op_scatter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class OpScatterValueOutTest : public OperatorTest {

TEST_F(OpScatterSrcOutTest, AllValidInputOutputSupport) {
#define TEST_ENTRY(CTYPE, DTYPE) test_scatter_src_out<ScalarType::DTYPE>();
ET_FORALL_REAL_TYPES(TEST_ENTRY);
ET_FORALL_REALHBF16_TYPES(TEST_ENTRY);
#undef TEST_ENTRY
}

Expand All @@ -381,7 +381,7 @@ TEST_F(OpScatterSrcOutTest, InvalidDimensionsDies) {

TEST_F(OpScatterValueOutTest, AllValidInputOutputSupport) {
#define TEST_ENTRY(CTYPE, DTYPE) test_scatter_value_out<ScalarType::DTYPE>();
ET_FORALL_REAL_TYPES(TEST_ENTRY);
ET_FORALL_REALHBF16_TYPES(TEST_ENTRY);
#undef TEST_ENTRY
}

Expand Down
Loading