How to write cuda code of the multilayer units

オープン
#44 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python, pytorch

調査の方向性

The question concerns torch/nn/_functions/rnn.py, which calls torch._cudnn_rnn at line 281 and uses AutogradRNN near line 212. Read both to see how the multilayer call differs from the per-layer loop. The issue asks for a fused multilayer CUDA kernel, so there is no narrow done state; it is open-ended design work and has had no answer since it was opened.

索引モデルが issue の本文から書いたものです。

説明

This tutorials helped me to write a single layer unit with CUDA code.
But how to write CUDA code of the multilayer units, like torch/nn/_functions/rnn.py 281?

output, hy, cy, reserve, new_weight_buf = torch._cudnn_rnn(
           input, weight_arr, weight_stride0,
           flat_weight,
           hx, cx,
           mode, hidden_size, num_layers,
           batch_first, dropout, train, bool(bidirectional),
           list(batch_sizes.data) if variable_length else (),
           dropout_ts)

I have achieved the same results by using the template of AutogradRNN, i.e., torch/nn/_functions/rnn.py 212.

def AutogradRNN(mode, input_size, hidden_size, num_layers=1, batch_first=False,
                dropout=0, train=True, bidirectional=False, variable_length=False,
                dropout_state=None, flat_weight=None):

But gpu utilization was too low and speed was too slow. Perhaps because each single layer unit is called individually, which involve launch of a CUDA kernel. So I want to rewrite multilayer units in CUDA and fuse particular groups of single layer. Can you provide a boilerplate?

主要言語
Python
スター
1.2k
フォーク
250
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytorch/extension-cpp のほかの issue

pytorch/extension-cpp の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。