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

Add topk unary op #1699

Closed
WilliamTambellini opened this issue Aug 8, 2023 · 2 comments
Closed

Add topk unary op #1699

WilliamTambellini opened this issue Aug 8, 2023 · 2 comments
Assignees
Labels
enhancement A feature or an optimization request

Comments

@WilliamTambellini
Copy link
Contributor

Summary

Returns the k largest elements of the given input tensor along a given dimension.
eg:
https://pytorch.org/docs/stable/generated/torch.topk.html
https://arrayfire.org/docs/group__stat__func__topk.htm#gsc.tab=0

Problem statement

Returns the k largest elements of the given input tensor along a given dimension.

Preferred solution

No preference: single nD input, could compute results into 2 given dest tensors: one for top values, one for top indices.
Ref:
https://github.com/intel/x86-simd-sort/
https://arrayfire.org/docs/group__stat__func__topk.htm#gsc.tab=0

@WilliamTambellini WilliamTambellini added the enhancement A feature or an optimization request label Aug 8, 2023
@igorsafo
Copy link
Contributor

igorsafo commented Aug 8, 2023

Hi @WilliamTambellini ,
oneDNN doesn't try to optimize all operations available in DL frameworks, because it is not scaleble (There are thousands of operations in different frameworks with different semantics across them). Most of operations are good enough already or do not take much time comparing to overall execution time or used in one or two models. This operation is one of these operations and so far we haven't seen any models where it becomes a bottleneck and can be optimized further across multiple frameworks. It also applies to #1697 .

Here is a quote from Contributing.md:

oneDNN focuses on functionality that satisfies all of the following
criteria:

  1. Performance: the functionality has material impact on a workload level.
    In other words, this means that for a new primitive it should be
    demonstrated that it brings visible performance improvement to some
    workload.

  2. Generality: the functionality is useful in a wide range of deep learning
    applications. This implies that when introducing a new primitive, its API
    needs to be general enough to be integrated into multiple deep learning
    frameworks that have similar functionality.

  3. Complexity: it is not trivial to implement the functionality directly in
    a deep learning application.

@igorsafo igorsafo self-assigned this Aug 8, 2023
@igorsafo
Copy link
Contributor

Closing as stale. Feel free to reopen with additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or an optimization request
Projects
None yet
Development

No branches or pull requests

2 participants