Skip to content

Mesh shader ViewID-dependent groupshared byte counts in PSV0 are not populated #9107

Open

Description

Description
The PSV0 mesh-shader runtime information defines both GroupSharedBytesUsed and GroupSharedBytesDependentOnViewID, but DXC does not populate the dependent-byte count.

AI-assisted bug report:

At commit 74df1e093c4282282890f5ff2e4886d5f8dca13a:

  • MSInfo declares both fields.
  • [The PSV producer calculates total TGSM usage](
    case ShaderModel::Kind::Mesh: {
    pInfo->MS.MaxOutputVertices = (uint16_t)DM.GetMaxOutputVertices();
    pInfo->MS.MaxOutputPrimitives = (uint16_t)DM.GetMaxOutputPrimitives();
    Module *mod = DM.GetModule();
    const DataLayout &DL = mod->getDataLayout();
    unsigned totalByteSize = 0;
    for (GlobalVariable &GV : mod->globals()) {
    PointerType *gvPtrType = cast<PointerType>(GV.getType());
    if (gvPtrType->getAddressSpace() == hlsl::DXIL::kTGSMAddrSpace) {
    Type *gvType = gvPtrType->getPointerElementType();
    unsigned byteSize = DL.getTypeAllocSize(gvType);
    totalByteSize += byteSize;
    }
    }
    pInfo->MS.GroupSharedBytesUsed = totalByteSize;
    pInfo->MS.PayloadSizeInBytes = DM.GetPayloadSizeInBytes();
    break;
    ), but does not populate GroupSharedBytesDependentOnViewID.
  • [The experimental RDAT writer explicitly notes this PSV omission](
    (uint16_t)DxilShaderFlags::OutputPositionPresent);
    info.SigPrimOutputElements =
    AddSigElements(sig.PatchConstOrPrimSignature, shaderFlags);
    // TODO: Fill in ViewID related masks
    info.NumThreads =
    Builder.InsertArray(&props.numThreads[0], &props.numThreads[0] + 3);
    info.GroupSharedBytesUsed = tgsmSizeInBytes;
    info.GroupSharedBytesDependentOnViewID =
    (uint32_t)0; // TODO: same thing (note: this isn't filled in for PSV!)
    info.PayloadSizeInBytes =
    ).

The [mesh-shader ViewID rules](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#sv_viewid) require ViewID-dependent groupshared storage to be expanded while remaining within the storage limit. The missing byte count leaves a gap in the compiler metadata available for that validation.

Expected behavior: Track groupshared storage requiring per-view expansion and emit its byte count in PSV0. Regression coverage should include view-independent storage, ViewID-dependent storage, mixed storage, and dependencies involving memory accesses and dynamic indexing.

Discovered during authoring of microsoft/DirectX-Specs#272, diffing mesh shader proposal language which says the compiler "will" do this, against what was actually implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions