NVIDIA / NVIDIA/cutlass

[BUG] Sm90 & Sm100 Array gemm kernels read ahead of `wait_on_dependent_grids()`

Open
#2,962 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage bug CUTLASS C++ inactive-30d inactive-90d
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

Which component has the problem?

CUTLASS C++

Bug Report

Describe the bug

First, the first element of the array containing problem shapes are accessed in the constructor of group tile scheduler.
https://github.com/NVIDIA/cutlass/blob/8debf77437753beca676eb3c6bf97b56a5f9fd68/include/cutlass/gemm/kernel/sm90_tile_scheduler_group.hpp#L267

https://github.com/NVIDIA/cutlass/blob/8debf77437753beca676eb3c6bf97b56a5f9fd68/include/cutlass/gemm/group_array_problem_shape.hpp#L68

TileScheduler is constructed before the wait_on_dependent_grids(), which could risk a chance reading the pointer arrays before dependent data gets flushed into global memory by a preceding kernel.

https://github.com/NVIDIA/cutlass/blob/8debf77437753beca676eb3c6bf97b56a5f9fd68/include/cutlass/gemm/kernel/sm90_gemm_array_tma_warpspecialized_pingpong.hpp#L466-L475

https://github.com/NVIDIA/cutlass/blob/8debf77437753beca676eb3c6bf97b56a5f9fd68/include/cutlass/gemm/kernel/sm100_gemm_array_tma_warpspecialized.hpp#L836-L842

This would cause a race condition when PDL is enabled.

Steps/Code to reproduce bug

Hard to reproduce as it's a race condition.

I wish there was some compiler support to spot PDL related bugs, e.g. ,print a warning log when codes in a kernel access to global address before wait_on_dependent_grids(). It was frustrating to figure out this kind of issues.

Contributor guide

No contributing guide indexed for this repository

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 with the constructor and problem-shape access in include/cutlass/gemm/kernel/sm90_tile_scheduler_group.hpp and include/cutlass/gemm/group_array_problem_shape.hpp, then trace the ordering around wait_on_dependent_grids() in the SM90 and SM100 kernel files named in the report. Done means the array data is not read before dependent-grid synchronization when PDL is enabled, with validation for both affected kernels.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.