OpenNMT / OpenNMT/CTranslate2

Hi, I'm unsure how to implement the ops::Div division operator

Open
#1,916 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
4.7k
Forks
536
Avg merge
12h 12m
Merged PRs (30d)
4

Description

Hi, I've spent some time reading the code,
In this project, there is no direct implementation towards the division operator.

But I found there is a similar CPU implementation in src/cpu/kernels.cc

    template <CpuIsa ISA, typename T>
    void rcp(const T* x, T* y, dim_t size) {
      vectorized_unary_transform<ISA>(x, y, size, Vec<T, ISA>::rcp);
    }

which is defined in src/cpu/vec.h:

      static inline value_type rcp(value_type a) {
        return static_cast<T>(1) / a;
      }

However, I can not find any similar implementation for GPU operation. Did I miss anything? Or, if there's no such implementation in the GPU, what's the recommended way to produce it?

Sincerely,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the CPU reciprocal implementation in src/cpu/kernels.cc and src/cpu/vec.h with the project's GPU kernel sources, which are not identified in the issue. Determine where ops::Div is expected to be handled and what GPU backends must support it; done requires a confirmed implementation path or documented recommendation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.