microsoft / microsoft/DirectXShaderCompiler

DxilValidation: TGSM size check should be per-entry in lib target

Open
#6,637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug validation
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
In DxilValidation.cpp, a check for the total size of TGSM (Thread Group Shared Memory) used counts all groupshared global variables in the module. This is not valid for a library with multiple entry points, when each of which only uses a subset of the groupshared globals. The correct per-entry groupshared usage is collected into the RDAT part, but the independent calculation in the validator is left-over from enforcing the maximum on compute targets at the module level instead.

This mainly impacts Work Graphs (node shader) for now, since that's the only runtime-supported compute entry in a DXIL library.

Steps to Reproduce
Repro here:
https://godbolt.org/z/z88esxr1s

Individually, these two entries are valid, but together in a lib, they produce a validation error due to the summed groupshared memory sizes.

Actual Behavior

error: validation errors
<source>:35: error: Total Thread Group Shared Memory storage is 65536, exceeded 32768.
Validation failed.

Environment

  • DXC version: 1.8.2403
  • Host Operating System: any

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 in DxilValidation.cpp and reproduce the failure with the Godbolt example linked in the issue. Compare the validator's module-level TGSM calculation with the per-entry usage already collected in RDAT. Done means a library with individually valid entries no longer fails because their groupshared sizes are summed together.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.