This is an archive of the discontinued LLVM Phabricator instance.

[DX] Create globals for DXContainer parts
ClosedPublic

Authored by beanz on Oct 12 2022, 10:19 AM.

Details

Summary

DXContainer files have a handful of sections that need to be written.
This adds a pass to write the section data into IR globals, and writes
the shader flag data into a global.

The test cases here verify that the shader flags are correctly written
from the IR into the global and emitted to the DXContainer.

This change also fixes a bug in the MCDXContainerWriter, where the size
of the dxbc::ProgramHeader was not being included in the part offset
calcuations. This is verified to be working by the new testcases where
obj2yaml can properly dump part data for parts after the DXIL part.

Resolves issue #57742 (https://github.com/llvm/llvm-project/issues/57742)

Diff Detail

Event Timeline

beanz created this revision.Oct 12 2022, 10:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 10:19 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
beanz requested review of this revision.Oct 12 2022, 10:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 10:19 AM
python3kgae added inline comments.Oct 14 2022, 9:42 AM
llvm/lib/Target/DirectX/DirectX.h
47

Do we need to call initializeShaderFlagsAnalysisWrapperPass somewhere?

beanz updated this revision to Diff 467879.Oct 14 2022, 12:05 PM

Add call to initializeShaderFlagsAnalysisWrapperPass in LLVMInitializeDirectXTarget.

python3kgae accepted this revision.Oct 14 2022, 12:06 PM
This revision is now accepted and ready to land.Oct 14 2022, 12:06 PM
This revision was automatically updated to reflect the committed changes.