Skip to content

Commit

Permalink
set AliasAnalysisKind of embedding_bag and interaction to PURE_FUNCTI…
Browse files Browse the repository at this point in the history
…ON (#163)
  • Loading branch information
chunyuan-w authored Aug 17, 2021
1 parent 8d52321 commit 4201cef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
10 changes: 7 additions & 3 deletions torch_ipex/csrc/cpu/embeddingbag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,13 @@ at::Tensor AtenIpexJITDev::dil_qembeddingbag(
} // namespace torch_ipex

namespace {
static auto dispatch =
torch::RegisterOperators()
.op("torch_ipex::embedding_bag", &torch_ipex::AtenIpexTypeExt::embedding_bag);
TORCH_LIBRARY_FRAGMENT(torch_ipex, m) {
m.def(torch::schema(
"torch_ipex::embedding_bag(Tensor weight, Tensor indices, Tensor "
"offsets, bool sparse, bool include_last_offset) -> Tensor",
c10::AliasAnalysisKind::PURE_FUNCTION),
torch_ipex::AtenIpexTypeExt::embedding_bag);
}
}

namespace torch_ipex {
Expand Down
16 changes: 10 additions & 6 deletions torch_ipex/csrc/cpu/interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,16 @@ at::Tensor AtenIpexJITDev::dil_qinteraction(const std::vector<at::Tensor> input,
} // namespace torch_ipex

namespace {
static auto dispatch =
torch::RegisterOperators()
.op("torch_ipex::interaction_forward",
&torch_ipex::AtenIpexTypeExt::interaction_forward)
.op("torch_ipex::interaction_backward",
&torch_ipex::AtenIpexTypeExt::interaction_backward);
TORCH_LIBRARY_FRAGMENT(torch_ipex, m) {
m.def(
torch::schema("torch_ipex::interaction_forward(Tensor[] input) -> Tensor",
c10::AliasAnalysisKind::PURE_FUNCTION),
torch_ipex::AtenIpexTypeExt::interaction_forward);
m.def(torch::schema("torch_ipex::interaction_backward(Tensor grad_out, "
"Tensor[] input) -> Tensor[]",
c10::AliasAnalysisKind::PURE_FUNCTION),
torch_ipex::AtenIpexTypeExt::interaction_backward);
}
}

namespace torch_ipex {
Expand Down

0 comments on commit 4201cef

Please sign in to comment.