Skip to content

Staging changes for cudnn frontend release. - #3

Merged
Anerudhan merged 4 commits into
mainfrom
staging
May 16, 2021
Merged

Staging changes for cudnn frontend release.#3
Anerudhan merged 4 commits into
mainfrom
staging

Conversation

@Anerudhan

Copy link
Copy Markdown
Collaborator
  • [New feature] Support reduction operation in the frontend.
  • [New feature] Add engine runtime compilation filter in the frontend as a behavior filter.
  • [New feature] Adding fallback list for convBiasAct
  • [New feature Beta] Adding Errata filter with an sample.
  • [Samples] Add ConvBnstats and ConvColReduction tests
  • [Bug Fix] Clamp upper_clip for float compute type to float max for pointwise descriptor when computeType is float.
  • [Bug Fix] Compilation fix for newer gcc toolchain (gcc 9+).
  • [Bug Fix] Add operation tag to the Plan generated by cudnnFind and cudnnGet
  • [Maintenance] Added default fallback lists to newer versions of cudnn.

Comment thread README.md Outdated
version : 1 - Mandatory. Tells the format version of the json.
rules : [] - Mandatory. Array of rule object which identifies the engine config
rule_id : "" - Optional. Used to uniquely identify a rule. Has no purpose other than being easy to debug.
operation : "" - Mandatory. Stringified version of the operation graph.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an indendation for the rule_id and other fields.

@Anerudhan
Anerudhan merged commit d58e45e into main May 16, 2021
@Anerudhan
Anerudhan deleted the staging branch May 16, 2021 21:43
zkyue added a commit to zkyue/cudnn-frontend that referenced this pull request Jul 18, 2026
Completes the remove/relocate edits from the code review that the inline
suggestion blocks could not express on their own:
- NVIDIA#2: remove the now-duplicate same_hdim t2r_dKV4 wait before dKV1
- NVIDIA#4: remove the now-duplicate same_hdim t2r_dKV01 wait before dKV3
- NVIDIA#6: switch same_hdim dKV2/dKV3 drain to split T2R + reduce_dKV_from_reg

Also repairs line-drift from batch-applying the earlier suggestions
(their anchors shifted after the first suggestion inserted lines):
- NVIDIA#3: remove a leftover dangling `if cutlass.const_expr(not
  self.same_hdim_kv):` with no body (IndentationError) left because the
  original lines were not replaced
- NVIDIA#5: remove the leftover old dKV0/dKV1 if/else block that sat before the
  new unified block, which would otherwise double the reduce/atomic_add
  and the t2r_dKV01 barrier arrival

Final state is the intended split-T2R + signal drain refactor: every
reduce site loads dKV into registers, fences, signals the MMA warp that
the TMEM columns are free, then does the global atomic_add; same_hdim and
not-same_hdim now follow the same protocol. dq is bitwise-identical to
ef50ddc; head_dim 576 and 512 both verified race-free (compute-sanitizer
racecheck 0).
zkyue added a commit to zkyue/cudnn-frontend that referenced this pull request Jul 20, 2026
Completes the remove/relocate edits from the code review that the inline
suggestion blocks could not express on their own:
- NVIDIA#2: remove the now-duplicate same_hdim t2r_dKV4 wait before dKV1
- NVIDIA#4: remove the now-duplicate same_hdim t2r_dKV01 wait before dKV3
- NVIDIA#6: switch same_hdim dKV2/dKV3 drain to split T2R + reduce_dKV_from_reg

Also repairs line-drift from batch-applying the earlier suggestions
(their anchors shifted after the first suggestion inserted lines):
- NVIDIA#3: remove a leftover dangling `if cutlass.const_expr(not
  self.same_hdim_kv):` with no body (IndentationError) left because the
  original lines were not replaced
- NVIDIA#5: remove the leftover old dKV0/dKV1 if/else block that sat before the
  new unified block, which would otherwise double the reduce/atomic_add
  and the t2r_dKV01 barrier arrival

Final state is the intended split-T2R + signal drain refactor: every
reduce site loads dKV into registers, fences, signals the MMA warp that
the TMEM columns are free, then does the global atomic_add; same_hdim and
not-same_hdim now follow the same protocol. dq is bitwise-identical to
ef50ddc; head_dim 576 and 512 both verified race-free (compute-sanitizer
racecheck 0).

Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>
Anerudhan pushed a commit that referenced this pull request Jul 20, 2026
…m 576) (#396)

* Fix latent TMEM WAR race in DSA backward SM100 dKV drain (head_dim 576 path)

In the not-same_hdim_kv path (head_dim 576 / head_dim_v 512), the reduce
warps read dKV2/dKV3 from TMEM inside store_dKV, after their
t2r_dKV4_done arrive. The MMA warp's next-iteration dKV0/dKV1 gemms
overwrite the same TMEM columns (tmem_dKV2_offset == tmem_dKV0_offset,
tmem_dKV3_offset == tmem_dKV1_offset) with no happens-before edge to
those reads: mma_reduce_dKV_pipeline has 2 stages, so the part1
producer_acquire of generation 3i+3 only orders against the
consumer_release of generation 3i+1 (the dKV4 generation), and no named
barrier separates part2's TMEM reads (generation 3i+2) from the issue of
the next part1's overwrites. Correctness currently depends on the tensor
core still draining queued work when the reduce warps issue their loads.

The window reproduces deterministically under adversarial delay: a 1 us
spin inserted in the reduce warps between the two part2 store_dKV calls
(no other change) corrupts dkv columns [384:512) on every run at
S=2048 H=64 D=576 topk=512 bf16 (rel L2 vs fp32 autograd 1.0e0 vs 5.6e-3
baseline); a 10 us spin before both calls corrupts [256:384) as well.
Delays at already-synchronized points (after part1's register-staged
T2Rs, or before the MMA warp's dKV0 issue) never corrupt.

Fix, mirroring part1's existing register-staging pattern: T2R dKV2/dKV3
into registers, fence, arrive on a new t2r_dKV23_done named barrier
(id 9), and only then run the global-memory atomic reduction; the MMA
warp waits on that barrier before issuing the next iteration's dKV0
(skipped on the first iteration, balanced by a final arrive after the
loop, like t2r_dKV4_done). Register peak is unchanged (part1 already
holds two fragments). The same_hdim_kv (head_dim 512) path is untouched
and compiles identically.

Measured on B200 (S=8192 H=64 topk=1024 bf16, ABAB paired):
head_dim 576: 5.398 -> 5.840 ms median (+8.0%), the cost of no longer
overlapping the next iteration's dKV issue with the dKV2/dKV3 readback;
head_dim 512: +0.03% (noise). dq stays bitwise-identical to develop on
both head dims; dkv/d_sink match the fp32 autograd reference at the
baseline rel L2 on both, and the adversarial-delay matrix that trips
develop is clean on the fixed kernel.

Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jie Fang <jief@nvidia.com>
Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>

* Complete review remove/relocate edits and repair suggestion line-drift

Completes the remove/relocate edits from the code review that the inline
suggestion blocks could not express on their own:
- #2: remove the now-duplicate same_hdim t2r_dKV4 wait before dKV1
- #4: remove the now-duplicate same_hdim t2r_dKV01 wait before dKV3
- #6: switch same_hdim dKV2/dKV3 drain to split T2R + reduce_dKV_from_reg

Also repairs line-drift from batch-applying the earlier suggestions
(their anchors shifted after the first suggestion inserted lines):
- #3: remove a leftover dangling `if cutlass.const_expr(not
  self.same_hdim_kv):` with no body (IndentationError) left because the
  original lines were not replaced
- #5: remove the leftover old dKV0/dKV1 if/else block that sat before the
  new unified block, which would otherwise double the reduce/atomic_add
  and the t2r_dKV01 barrier arrival

Final state is the intended split-T2R + signal drain refactor: every
reduce site loads dKV into registers, fences, signals the MMA warp that
the TMEM columns are free, then does the global atomic_add; same_hdim and
not-same_hdim now follow the same protocol. dq is bitwise-identical to
ef50ddc; head_dim 576 and 512 both verified race-free (compute-sanitizer
racecheck 0).

Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>

---------

Signed-off-by: zky <51477259+zkyue@users.noreply.github.com>
Co-authored-by: Jie Fang <jief@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant