NVIDIA / NVIDIA/cuda-samples

Question about cudaTensorCoreGemm

Open
#86 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
9.6k
Forks
2.4k
Avg merge
53m
Merged PRs (30d)
1

Description

I have a question regarding the following line of code:

https://github.com/NVIDIA/cuda-samples/blob/3342d604fe1cde5d01baced50368b783a3c88b77/Samples/cudaTensorCoreGemm/cudaTensorCoreGemm.cu#L232

It seems to me that this needs to be

((block_pos * BLOCK_COL_TILES) / N_TILES) * (BLOCK_ROW_TILES); 

My understanding is that matrix C is row-major and the CTA is moving right and then down processing an 8x8 tile. As there is only N_TILES to process along the column direction, we wrap around but then need to be multiplied by BLOCK_ROW_TILES to get the correct tile index in the row direction.

I feel the original code has issue when BLOCK_COL_TILES and BLOCK_ROW_TILES have different values.

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 at Samples/cudaTensorCoreGemm/cudaTensorCoreGemm.cu around line 232 and trace how block_pos, BLOCK_COL_TILES, BLOCK_ROW_TILES, and N_TILES map the CTA over the row-major matrix C. Verify the indexing when BLOCK_COL_TILES and BLOCK_ROW_TILES differ, and confirm whether the proposed expression produces the correct tile positions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.